@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.
- package/LICENSE +149 -29
- package/dist/core.cjs +13 -0
- package/dist/core.d.mts +8 -7
- package/dist/core.mjs +7 -6
- package/dist/index.cjs +17 -1
- package/dist/index.d.mts +12 -12
- package/dist/index.mjs +10 -10
- package/dist/types/hub.cjs +9 -100
- package/dist/types/hub.cjs.map +1 -1
- package/dist/types/hub.d.mts +12 -110
- package/dist/types/hub.d.mts.map +1 -1
- package/dist/types/hub.mjs +9 -79
- package/dist/types/hub.mjs.map +1 -1
- package/dist/types/notification.cjs +4 -4
- package/dist/types/notification.cjs.map +1 -1
- package/dist/types/notification.d.mts +5 -5
- package/dist/types/notification.d.mts.map +1 -1
- package/dist/types/notification.mjs +5 -5
- package/dist/types/notification.mjs.map +1 -1
- package/dist/types/settings.cjs.map +1 -1
- package/dist/types/settings.d.mts +1 -1
- package/dist/types/settings.mjs.map +1 -1
- package/dist/types.cjs +2 -23
- package/dist/types.d.mts +3 -3
- package/dist/types.mjs +3 -3
- package/dist/views.cjs +1 -0
- package/dist/views.d.mts +2 -2
- package/dist/views.mjs +2 -2
- package/dist/web/components/SessionMcp.cjs +17 -17
- package/dist/web/components/SessionMcp.cjs.map +1 -1
- package/dist/web/components/SessionMcp.mjs +17 -17
- package/dist/web/components/SessionMcp.mjs.map +1 -1
- package/dist/web/components/Story.fixture.cjs +4 -3
- package/dist/web/components/Story.fixture.cjs.map +1 -1
- package/dist/web/components/Story.fixture.d.mts.map +1 -1
- package/dist/web/components/Story.fixture.mjs +4 -3
- package/dist/web/components/Story.fixture.mjs.map +1 -1
- package/dist/web/components/Template.fixture.cjs +1 -1
- package/dist/web/components/Template.fixture.cjs.map +1 -1
- package/dist/web/components/Template.fixture.mjs +1 -1
- package/dist/web/components/Template.fixture.mjs.map +1 -1
- package/dist/web/components/ToolRendererBoundary.d.mts +1 -0
- package/dist/web/features/activity/ActivityDock.cjs +68 -47
- package/dist/web/features/activity/ActivityDock.cjs.map +1 -1
- package/dist/web/features/activity/ActivityDock.d.mts +2 -1
- package/dist/web/features/activity/ActivityDock.d.mts.map +1 -1
- package/dist/web/features/activity/ActivityDock.mjs +70 -49
- package/dist/web/features/activity/ActivityDock.mjs.map +1 -1
- package/dist/web/features/activity/ContextItemDialog.cjs +17 -17
- package/dist/web/features/activity/ContextItemDialog.cjs.map +1 -1
- package/dist/web/features/activity/ContextItemDialog.d.mts +1 -0
- package/dist/web/features/activity/ContextItemDialog.mjs +17 -17
- package/dist/web/features/activity/ContextItemDialog.mjs.map +1 -1
- package/dist/web/features/activity/ContextPanel.cjs +184 -148
- package/dist/web/features/activity/ContextPanel.cjs.map +1 -1
- package/dist/web/features/activity/ContextPanel.d.mts +23 -0
- package/dist/web/features/activity/ContextPanel.d.mts.map +1 -1
- package/dist/web/features/activity/ContextPanel.mjs +186 -151
- package/dist/web/features/activity/ContextPanel.mjs.map +1 -1
- package/dist/web/features/activity/DockTabs.cjs +1 -1
- package/dist/web/features/activity/DockTabs.cjs.map +1 -1
- package/dist/web/features/activity/DockTabs.mjs +1 -1
- package/dist/web/features/activity/DockTabs.mjs.map +1 -1
- package/dist/web/features/connection/RefusedCard.cjs +9 -9
- package/dist/web/features/connection/RefusedCard.cjs.map +1 -1
- package/dist/web/features/connection/RefusedCard.mjs +9 -9
- package/dist/web/features/connection/RefusedCard.mjs.map +1 -1
- package/dist/web/features/dialogs/DialogOverlay.cjs +9 -9
- package/dist/web/features/dialogs/DialogOverlay.cjs.map +1 -1
- package/dist/web/features/dialogs/DialogOverlay.mjs +9 -9
- package/dist/web/features/dialogs/DialogOverlay.mjs.map +1 -1
- package/dist/web/features/leader/CommandPalette.cjs +23 -23
- package/dist/web/features/leader/CommandPalette.cjs.map +1 -1
- package/dist/web/features/leader/CommandPalette.mjs +23 -23
- package/dist/web/features/leader/CommandPalette.mjs.map +1 -1
- package/dist/web/features/remote/DevProxyTargets.cjs +6 -6
- package/dist/web/features/remote/DevProxyTargets.cjs.map +1 -1
- package/dist/web/features/remote/DevProxyTargets.mjs +6 -6
- package/dist/web/features/remote/DevProxyTargets.mjs.map +1 -1
- package/dist/web/features/remote/HandoverProgress.cjs +2 -2
- package/dist/web/features/remote/HandoverProgress.cjs.map +1 -1
- package/dist/web/features/remote/HandoverProgress.mjs +2 -2
- package/dist/web/features/remote/HandoverProgress.mjs.map +1 -1
- package/dist/web/features/remote/PairedDeviceList.cjs +3 -3
- package/dist/web/features/remote/PairedDeviceList.cjs.map +1 -1
- package/dist/web/features/remote/PairedDeviceList.mjs +3 -3
- package/dist/web/features/remote/PairedDeviceList.mjs.map +1 -1
- package/dist/web/features/remote/PairingApprovalDialog.cjs +3 -3
- package/dist/web/features/remote/PairingApprovalDialog.cjs.map +1 -1
- package/dist/web/features/remote/PairingApprovalDialog.mjs +3 -3
- package/dist/web/features/remote/PairingApprovalDialog.mjs.map +1 -1
- package/dist/web/features/remote/RemoteAccessDialog.cjs +3 -3
- package/dist/web/features/remote/RemoteAccessDialog.cjs.map +1 -1
- package/dist/web/features/remote/RemoteAccessDialog.mjs +3 -3
- package/dist/web/features/remote/RemoteAccessDialog.mjs.map +1 -1
- package/dist/web/features/remote/RemoteAccessOptions.cjs +11 -11
- package/dist/web/features/remote/RemoteAccessOptions.cjs.map +1 -1
- package/dist/web/features/remote/RemoteAccessOptions.mjs +11 -11
- package/dist/web/features/remote/RemoteAccessOptions.mjs.map +1 -1
- package/dist/web/features/remote/RemoteAccessPairing.cjs +8 -8
- package/dist/web/features/remote/RemoteAccessPairing.cjs.map +1 -1
- package/dist/web/features/remote/RemoteAccessPairing.mjs +8 -8
- package/dist/web/features/remote/RemoteAccessPairing.mjs.map +1 -1
- package/dist/web/features/remote/SandboxWorkspaces.cjs +3 -3
- package/dist/web/features/remote/SandboxWorkspaces.cjs.map +1 -1
- package/dist/web/features/remote/SandboxWorkspaces.mjs +3 -3
- package/dist/web/features/remote/SandboxWorkspaces.mjs.map +1 -1
- package/dist/web/features/remote/TrustedDeviceList.cjs +4 -4
- package/dist/web/features/remote/TrustedDeviceList.cjs.map +1 -1
- package/dist/web/features/remote/TrustedDeviceList.mjs +4 -4
- package/dist/web/features/remote/TrustedDeviceList.mjs.map +1 -1
- package/dist/web/features/selection/SelectionBar.cjs +40 -37
- package/dist/web/features/selection/SelectionBar.cjs.map +1 -1
- package/dist/web/features/selection/SelectionBar.d.mts.map +1 -1
- package/dist/web/features/selection/SelectionBar.mjs +41 -38
- package/dist/web/features/selection/SelectionBar.mjs.map +1 -1
- package/dist/web/features/session/AgentLockPanel.cjs +3 -3
- package/dist/web/features/session/AgentLockPanel.cjs.map +1 -1
- package/dist/web/features/session/AgentLockPanel.mjs +3 -3
- package/dist/web/features/session/AgentLockPanel.mjs.map +1 -1
- package/dist/web/features/session/Composer.cjs +11 -11
- package/dist/web/features/session/Composer.cjs.map +1 -1
- package/dist/web/features/session/Composer.mjs +11 -11
- package/dist/web/features/session/Composer.mjs.map +1 -1
- package/dist/web/features/session/DormantPanel.cjs +4 -4
- package/dist/web/features/session/DormantPanel.cjs.map +1 -1
- package/dist/web/features/session/DormantPanel.mjs +4 -4
- package/dist/web/features/session/DormantPanel.mjs.map +1 -1
- package/dist/web/features/session/MentionPreviews.cjs +10 -10
- package/dist/web/features/session/MentionPreviews.cjs.map +1 -1
- package/dist/web/features/session/MentionPreviews.mjs +10 -10
- package/dist/web/features/session/MentionPreviews.mjs.map +1 -1
- package/dist/web/features/session/QueueSheet.cjs +28 -35
- package/dist/web/features/session/QueueSheet.cjs.map +1 -1
- package/dist/web/features/session/QueueSheet.mjs +28 -35
- package/dist/web/features/session/QueueSheet.mjs.map +1 -1
- package/dist/web/features/session/SessionActivity.cjs +8 -4
- package/dist/web/features/session/SessionActivity.cjs.map +1 -1
- package/dist/web/features/session/SessionActivity.d.mts +1 -1
- package/dist/web/features/session/SessionActivity.d.mts.map +1 -1
- package/dist/web/features/session/SessionActivity.mjs +8 -4
- package/dist/web/features/session/SessionActivity.mjs.map +1 -1
- package/dist/web/features/session/ThreadView.cjs +1 -0
- package/dist/web/features/session/ThreadView.cjs.map +1 -1
- package/dist/web/features/session/ThreadView.mjs +1 -0
- package/dist/web/features/session/ThreadView.mjs.map +1 -1
- package/dist/web/features/session/Timeline.cjs +173 -69
- package/dist/web/features/session/Timeline.cjs.map +1 -1
- package/dist/web/features/session/Timeline.d.mts +3 -1
- package/dist/web/features/session/Timeline.d.mts.map +1 -1
- package/dist/web/features/session/Timeline.mjs +174 -70
- package/dist/web/features/session/Timeline.mjs.map +1 -1
- package/dist/web/features/session/ToolCard.cjs +6 -6
- package/dist/web/features/session/ToolCard.cjs.map +1 -1
- package/dist/web/features/session/ToolCard.mjs +6 -6
- package/dist/web/features/session/ToolCard.mjs.map +1 -1
- package/dist/web/features/sessions/NewSessionDialog.cjs +3 -3
- package/dist/web/features/sessions/NewSessionDialog.cjs.map +1 -1
- package/dist/web/features/sessions/NewSessionDialog.mjs +3 -3
- package/dist/web/features/sessions/NewSessionDialog.mjs.map +1 -1
- package/dist/web/features/sessions/ResumeSessionDialog.cjs +11 -8
- package/dist/web/features/sessions/ResumeSessionDialog.cjs.map +1 -1
- package/dist/web/features/sessions/ResumeSessionDialog.d.mts +1 -0
- package/dist/web/features/sessions/ResumeSessionDialog.mjs +11 -8
- package/dist/web/features/sessions/ResumeSessionDialog.mjs.map +1 -1
- package/dist/web/features/sessions/WelcomePanel.cjs +29 -15
- package/dist/web/features/sessions/WelcomePanel.cjs.map +1 -1
- package/dist/web/features/sessions/WelcomePanel.d.mts +3 -0
- package/dist/web/features/sessions/WelcomePanel.d.mts.map +1 -1
- package/dist/web/features/sessions/WelcomePanel.mjs +29 -15
- package/dist/web/features/sessions/WelcomePanel.mjs.map +1 -1
- package/dist/web/features/sessions/useSessionRail.cjs +14 -16
- package/dist/web/features/sessions/useSessionRail.cjs.map +1 -1
- package/dist/web/features/sessions/useSessionRail.d.mts.map +1 -1
- package/dist/web/features/sessions/useSessionRail.mjs +16 -18
- package/dist/web/features/sessions/useSessionRail.mjs.map +1 -1
- package/dist/web/features/settings/AppearanceSettings.cjs +3 -3
- package/dist/web/features/settings/AppearanceSettings.cjs.map +1 -1
- package/dist/web/features/settings/AppearanceSettings.mjs +3 -3
- package/dist/web/features/settings/AppearanceSettings.mjs.map +1 -1
- package/dist/web/features/settings/ContributedSettings.cjs +9 -9
- package/dist/web/features/settings/ContributedSettings.cjs.map +1 -1
- package/dist/web/features/settings/ContributedSettings.d.mts +1 -0
- package/dist/web/features/settings/ContributedSettings.mjs +9 -9
- package/dist/web/features/settings/ContributedSettings.mjs.map +1 -1
- package/dist/web/features/settings/ImageSettings.cjs +2 -2
- package/dist/web/features/settings/ImageSettings.cjs.map +1 -1
- package/dist/web/features/settings/ImageSettings.d.mts +1 -1
- package/dist/web/features/settings/ImageSettings.mjs +2 -2
- package/dist/web/features/settings/ImageSettings.mjs.map +1 -1
- package/dist/web/features/settings/LoginFlowDialog.cjs +18 -18
- package/dist/web/features/settings/LoginFlowDialog.cjs.map +1 -1
- package/dist/web/features/settings/LoginFlowDialog.mjs +18 -18
- package/dist/web/features/settings/LoginFlowDialog.mjs.map +1 -1
- package/dist/web/features/settings/PluginSettings.cjs +1 -1
- package/dist/web/features/settings/PluginSettings.cjs.map +1 -1
- package/dist/web/features/settings/PluginSettings.mjs +1 -1
- package/dist/web/features/settings/PluginSettings.mjs.map +1 -1
- package/dist/web/features/settings/ProviderSettings.cjs +18 -18
- package/dist/web/features/settings/ProviderSettings.cjs.map +1 -1
- package/dist/web/features/settings/ProviderSettings.mjs +18 -18
- package/dist/web/features/settings/ProviderSettings.mjs.map +1 -1
- package/dist/web/features/settings/RepositorySettings.cjs +6 -6
- package/dist/web/features/settings/RepositorySettings.cjs.map +1 -1
- package/dist/web/features/settings/RepositorySettings.mjs +6 -6
- package/dist/web/features/settings/RepositorySettings.mjs.map +1 -1
- package/dist/web/features/settings/RepositoryWorkspace.cjs +3 -3
- package/dist/web/features/settings/RepositoryWorkspace.cjs.map +1 -1
- package/dist/web/features/settings/RepositoryWorkspace.mjs +3 -3
- package/dist/web/features/settings/RepositoryWorkspace.mjs.map +1 -1
- package/dist/web/features/settings/SessionMcpSettings.cjs +14 -14
- package/dist/web/features/settings/SessionMcpSettings.cjs.map +1 -1
- package/dist/web/features/settings/SessionMcpSettings.mjs +14 -14
- package/dist/web/features/settings/SessionMcpSettings.mjs.map +1 -1
- package/dist/web/features/settings/SettingsMenu.cjs +8 -8
- package/dist/web/features/settings/SettingsMenu.cjs.map +1 -1
- package/dist/web/features/settings/SettingsMenu.mjs +8 -8
- package/dist/web/features/settings/SettingsMenu.mjs.map +1 -1
- package/dist/web/features/settings/SettingsPanelHost.d.mts +1 -0
- package/dist/web/features/settings/TemplateSettings.cjs +8 -8
- package/dist/web/features/settings/TemplateSettings.cjs.map +1 -1
- package/dist/web/features/settings/TemplateSettings.mjs +8 -8
- package/dist/web/features/settings/TemplateSettings.mjs.map +1 -1
- package/dist/web/features/settings/TunnelSettings.cjs +6 -6
- package/dist/web/features/settings/TunnelSettings.cjs.map +1 -1
- package/dist/web/features/settings/TunnelSettings.mjs +6 -6
- package/dist/web/features/settings/TunnelSettings.mjs.map +1 -1
- package/dist/web/features/status/TopBar.cjs +6 -6
- package/dist/web/features/status/TopBar.cjs.map +1 -1
- package/dist/web/features/status/TopBar.mjs +6 -6
- package/dist/web/features/status/TopBar.mjs.map +1 -1
- package/dist/web/lib/browserNotifications.cjs.map +1 -1
- package/dist/web/lib/browserNotifications.d.mts +2 -2
- package/dist/web/lib/browserNotifications.d.mts.map +1 -1
- package/dist/web/lib/browserNotifications.mjs.map +1 -1
- package/dist/web/lib/browserTelemetry.cjs.map +1 -1
- package/dist/web/lib/browserTelemetry.d.mts +2 -1
- package/dist/web/lib/browserTelemetry.d.mts.map +1 -1
- package/dist/web/lib/browserTelemetry.mjs.map +1 -1
- package/dist/web/lib/commands.d.mts +1 -0
- package/dist/web/lib/composerSubmissions.d.mts +1 -0
- package/dist/web/lib/composition.cjs +21 -5
- package/dist/web/lib/composition.cjs.map +1 -1
- package/dist/web/lib/composition.d.mts +15 -0
- package/dist/web/lib/composition.d.mts.map +1 -1
- package/dist/web/lib/composition.mjs +21 -6
- package/dist/web/lib/composition.mjs.map +1 -1
- package/dist/web/lib/contextComposition.cjs +1 -1
- package/dist/web/lib/contextComposition.cjs.map +1 -1
- package/dist/web/lib/contextComposition.mjs +1 -1
- package/dist/web/lib/contextComposition.mjs.map +1 -1
- package/dist/web/lib/dashboardRoute.d.mts +1 -0
- package/dist/web/lib/hubApi.cjs +62 -1
- package/dist/web/lib/hubApi.cjs.map +1 -1
- package/dist/web/lib/hubApi.d.mts +19 -0
- package/dist/web/lib/hubApi.d.mts.map +1 -1
- package/dist/web/lib/hubApi.mjs +59 -3
- package/dist/web/lib/hubApi.mjs.map +1 -1
- package/dist/web/lib/modelContextAdapter.d.mts +1 -0
- package/dist/web/lib/piTransport.cjs +34 -53
- package/dist/web/lib/piTransport.cjs.map +1 -1
- package/dist/web/lib/piTransport.d.mts +3 -3
- package/dist/web/lib/piTransport.d.mts.map +1 -1
- package/dist/web/lib/piTransport.mjs +34 -53
- package/dist/web/lib/piTransport.mjs.map +1 -1
- package/dist/web/lib/pluginRegistry.cjs +53 -4
- package/dist/web/lib/pluginRegistry.cjs.map +1 -1
- package/dist/web/lib/pluginRegistry.d.mts +15 -1
- package/dist/web/lib/pluginRegistry.d.mts.map +1 -1
- package/dist/web/lib/pluginRegistry.mjs +53 -5
- package/dist/web/lib/pluginRegistry.mjs.map +1 -1
- package/dist/web/lib/protocolHubSocket.cjs +151 -89
- package/dist/web/lib/protocolHubSocket.cjs.map +1 -1
- package/dist/web/lib/protocolHubSocket.d.mts +21 -6
- package/dist/web/lib/protocolHubSocket.d.mts.map +1 -1
- package/dist/web/lib/protocolHubSocket.mjs +152 -90
- package/dist/web/lib/protocolHubSocket.mjs.map +1 -1
- package/dist/web/lib/sessionActivityRenderer.d.mts +1 -0
- package/dist/web/lib/sessionModel.cjs +120 -20
- package/dist/web/lib/sessionModel.cjs.map +1 -1
- package/dist/web/lib/sessionModel.d.mts +32 -2
- package/dist/web/lib/sessionModel.d.mts.map +1 -1
- package/dist/web/lib/sessionModel.mjs +120 -22
- package/dist/web/lib/sessionModel.mjs.map +1 -1
- package/dist/web/lib/sessionProtocolCommands.cjs +33 -34
- package/dist/web/lib/sessionProtocolCommands.cjs.map +1 -1
- package/dist/web/lib/sessionProtocolCommands.d.mts +3 -2
- package/dist/web/lib/sessionProtocolCommands.d.mts.map +1 -1
- package/dist/web/lib/sessionProtocolCommands.mjs +33 -34
- package/dist/web/lib/sessionProtocolCommands.mjs.map +1 -1
- package/dist/web/lib/sessionRailModel.cjs +2 -1
- package/dist/web/lib/sessionRailModel.cjs.map +1 -1
- package/dist/web/lib/sessionRailModel.d.mts +1 -1
- package/dist/web/lib/sessionRailModel.d.mts.map +1 -1
- package/dist/web/lib/sessionRailModel.mjs +2 -1
- package/dist/web/lib/sessionRailModel.mjs.map +1 -1
- package/dist/web/lib/sessionSelectionApi.cjs +72 -0
- package/dist/web/lib/sessionSelectionApi.cjs.map +1 -0
- package/dist/web/lib/sessionSelectionApi.d.mts +18 -0
- package/dist/web/lib/sessionSelectionApi.d.mts.map +1 -0
- package/dist/web/lib/sessionSelectionApi.mjs +72 -0
- package/dist/web/lib/sessionSelectionApi.mjs.map +1 -0
- package/dist/web/lib/sessionSummary.cjs +1 -0
- package/dist/web/lib/sessionSummary.cjs.map +1 -1
- package/dist/web/lib/sessionSummary.d.mts +1 -1
- package/dist/web/lib/sessionSummary.d.mts.map +1 -1
- package/dist/web/lib/sessionSummary.mjs +1 -0
- package/dist/web/lib/sessionSummary.mjs.map +1 -1
- package/dist/web/lib/sessionTranscriptRenderer.d.mts +1 -0
- package/dist/web/lib/statusLine.d.mts +1 -0
- package/dist/web/lib/stepUp.d.mts.map +1 -1
- package/dist/web/lib/threadRenderer.d.mts +1 -0
- package/dist/web/lib/toolCompletionTabs.d.mts +1 -0
- package/dist/web/lib/transport.cjs +10 -2
- package/dist/web/lib/transport.cjs.map +1 -1
- package/dist/web/lib/transport.d.mts +6 -2
- package/dist/web/lib/transport.d.mts.map +1 -1
- package/dist/web/lib/transport.mjs +10 -3
- package/dist/web/lib/transport.mjs.map +1 -1
- package/dist/web/stores/captureStore.cjs +22 -4
- package/dist/web/stores/captureStore.cjs.map +1 -1
- package/dist/web/stores/captureStore.d.mts.map +1 -1
- package/dist/web/stores/captureStore.mjs +22 -4
- package/dist/web/stores/captureStore.mjs.map +1 -1
- package/dist/web/stores/fileLinkModesStore.cjs +27 -10
- package/dist/web/stores/fileLinkModesStore.cjs.map +1 -1
- package/dist/web/stores/fileLinkModesStore.d.mts +5 -0
- package/dist/web/stores/fileLinkModesStore.d.mts.map +1 -1
- package/dist/web/stores/fileLinkModesStore.mjs +28 -12
- package/dist/web/stores/fileLinkModesStore.mjs.map +1 -1
- package/dist/web/stores/pagedTranscriptStore.cjs +29 -37
- package/dist/web/stores/pagedTranscriptStore.cjs.map +1 -1
- package/dist/web/stores/pagedTranscriptStore.d.mts.map +1 -1
- package/dist/web/stores/pagedTranscriptStore.mjs +30 -38
- package/dist/web/stores/pagedTranscriptStore.mjs.map +1 -1
- package/dist/web/stores/sessionStore.cjs +81 -3
- package/dist/web/stores/sessionStore.cjs.map +1 -1
- package/dist/web/stores/sessionStore.d.mts +13 -2
- package/dist/web/stores/sessionStore.d.mts.map +1 -1
- package/dist/web/stores/sessionStore.mjs +80 -5
- package/dist/web/stores/sessionStore.mjs.map +1 -1
- package/dist/web/stores/sessionsStore.cjs +37 -5
- package/dist/web/stores/sessionsStore.cjs.map +1 -1
- package/dist/web/stores/sessionsStore.d.mts +10 -0
- package/dist/web/stores/sessionsStore.d.mts.map +1 -1
- package/dist/web/stores/sessionsStore.mjs +36 -6
- package/dist/web/stores/sessionsStore.mjs.map +1 -1
- package/dist/web/stores/templateStore.cjs +1 -1
- package/dist/web/stores/templateStore.cjs.map +1 -1
- package/dist/web/stores/templateStore.d.mts +1 -1
- package/dist/web/stores/templateStore.mjs +1 -1
- package/dist/web/stores/templateStore.mjs.map +1 -1
- package/dist/web/stores/threadStore.cjs +12 -9
- package/dist/web/stores/threadStore.cjs.map +1 -1
- package/dist/web/stores/threadStore.d.mts +7 -3
- package/dist/web/stores/threadStore.d.mts.map +1 -1
- package/dist/web/stores/threadStore.mjs +13 -10
- package/dist/web/stores/threadStore.mjs.map +1 -1
- package/dist/web/stores/transientTabsStore.d.mts +1 -0
- package/dist/web/stores/useToolPrompt.cjs +18 -9
- package/dist/web/stores/useToolPrompt.cjs.map +1 -1
- package/dist/web/stores/useToolPrompt.d.mts +3 -2
- package/dist/web/stores/useToolPrompt.d.mts.map +1 -1
- package/dist/web/stores/useToolPrompt.mjs +18 -9
- package/dist/web/stores/useToolPrompt.mjs.map +1 -1
- package/package.json +13 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pluginRegistry.mjs","names":[],"sources":["../../../src/web/lib/pluginRegistry.ts"],"sourcesContent":["import type {\n ActivityGroupContribution,\n ContextActionContribution,\n DockFaceContribution,\n FileLinkSource,\n LeaderBindingContribution,\n MinorModeContribution,\n PaletteCommandContribution,\n RepositorySettingsPanelContribution,\n SettingsPanelContribution,\n SettingsSectionContribution,\n SelectionAxisContribution,\n SessionChannelContribution,\n SlotDeclaration,\n SlotFillContribution,\n SurfaceContribution,\n TabContribution,\n ToolRendererContribution,\n UserMessageActionContribution,\n WebPluginDefinition,\n WebPluginMount,\n WebPluginRuntime,\n WebPluginSlotProps,\n} from '@agimon-ai/po-core/web';\nimport type { ComponentType } from 'react';\n\nimport { leaderConflicts } from './leaderTree';\nimport { mergeScopedPlugins, pluginsAtScope } from './pluginScopes';\nimport {\n collectNativeTemplates,\n collectWebTemplates,\n type NativeTemplateCatalog,\n type WebTemplateCatalog,\n} from './templateCatalog';\n\n/**\n * The installed plugin set.\n *\n * Plain module state rather than a reactive store: the generated plugin list\n * is installed once at startup, before the first render, so every read during\n * render is stable. Install runs in two phases. The first collects every\n * plugin's contributions in the generated order, which is (registrationOrder,\n * pluginId); the second resolves every relation between plugins by name, so\n * a plugin may fill a slot whichever of the two installs first.\n *\n * Plugins are independent and a user may install any of them, so a collision\n * between two plugins never fails the install: a shared name goes to the\n * first plugin (a Leader Space leaf to the later one, as the TUI documents)\n * and the loser is recorded as a diagnostic. Only a malformed contribution\n * inside one plugin throws, because that is a developer error its own tests\n * catch. resetWebPlugins exists for unit tests only.\n */\n\nexport type InstallDiagnosticKind =\n | 'duplicate-plugin'\n | 'duplicate-tab'\n | 'duplicate-dock-face'\n | 'duplicate-channel'\n | 'duplicate-tool'\n | 'duplicate-activity-group'\n | 'duplicate-minor-mode'\n | 'duplicate-selection-axis'\n | 'duplicate-palette-command'\n | 'duplicate-settings-section'\n | 'leader-leaf-override'\n | 'leader-group-label'\n | 'orphan-fill'\n | 'rejected-fill'\n | 'invalid-template'\n | 'duplicate-template'\n | 'slot-load-failed';\n\nexport interface InstallDiagnostic {\n /** The plugin that lost or misfiled the contribution. */\n pluginId: string;\n kind: InstallDiagnosticKind;\n message: string;\n}\n\n/** One placed fill, as the owner's renderSlot and slotData read it. */\nexport interface ResolvedFill {\n slot: string;\n pluginId: string;\n id: string;\n order: number;\n data?: unknown;\n component?: ComponentType<WebPluginSlotProps>;\n}\n\nexport interface InstalledContextAction extends ContextActionContribution {\n pluginId: string;\n}\n\nexport interface InstalledUserMessageAction extends UserMessageActionContribution {\n pluginId: string;\n}\n/** The slots the host itself declares; a plugin's own slots are namespaced by its id instead. */\nexport const HOST_SLOTS = {\n overlay: 'overlay',\n rail: 'rail',\n context: 'context',\n selectionBar: 'selection-bar',\n activity: 'activity',\n composerActions: 'composer-actions',\n composerMenu: 'composer-menu',\n sessionMenu: 'session-menu',\n /** A workspace plugin fill here replaces the host's new-session dialog for that workspace. */\n newSession: 'new-session',\n} as const;\n\nconst SLOT_SEPARATOR = '.';\nconst DEFAULT_FILL_ORDER = 1000;\nconst RESERVED_PLUGIN_IDS: ReadonlySet<string> = new Set(Object.values(HOST_SLOTS));\n\n/** The keyed slot an activity group opens: sections fill it and render as the group's body. */\nexport function activityGroupSlot(name: string): string {\n return `${HOST_SLOTS.activity}${SLOT_SEPARATOR}${name}`;\n}\n\ninterface RegistryState {\n plugins: WebPluginDefinition[];\n tabs: TabContribution[];\n dockFaces: DockFaceContribution[];\n channels: Map<string, SessionChannelContribution>;\n commands: PaletteCommandContribution[];\n contextActions: InstalledContextAction[];\n userMessageActions: InstalledUserMessageAction[];\n leaderBindings: LeaderBindingContribution[];\n selectionAxes: SelectionAxisContribution[];\n minorModes: MinorModeContribution[];\n activityGroups: ActivityGroupContribution[];\n settingsSections: SettingsSectionContribution[];\n settingsPanels: InstalledSettingsPanel[];\n toolRenderers: Map<string, ToolRendererContribution>;\n toolMatchers: ToolRendererContribution[];\n slots: Map<string, SlotDeclaration>;\n fills: Map<string, ResolvedFill[]>;\n fileLinks: FileLinkSource[];\n diagnostics: InstallDiagnostic[];\n}\n\nfunction emptyState(): RegistryState {\n return {\n plugins: [],\n tabs: [],\n dockFaces: [],\n channels: new Map(),\n commands: [],\n contextActions: [],\n userMessageActions: [],\n leaderBindings: [],\n selectionAxes: [],\n minorModes: [],\n activityGroups: [],\n settingsSections: [],\n settingsPanels: [],\n toolRenderers: new Map(),\n toolMatchers: [],\n slots: new Map(),\n fills: new Map(),\n fileLinks: [],\n diagnostics: [],\n };\n}\n\nlet defaultState = emptyState();\nlet installingState = defaultState;\nlet defaultInstalled = false;\nconst sessionStates = new Map<string, RegistryState>();\nconst workspaceStates = new Map<string, RegistryState>();\nconst sessionPlugins = new Map<string, readonly WebPluginDefinition[]>();\nconst sessionWorkspaces = new Map<string, string>();\nlet activeWorkspaceId: string | null = null;\nconst pendingSessionFrames = new Map<string, Map<string, Record<string, unknown>>>();\nconst MAX_PENDING_CHANNEL_TYPES = 64;\nlet activeSessionId: string | null = null;\n/** Slots each mount could not load, keyed `global`, `workspace:<id>` or `session:<id>`. */\nconst loadDiagnostics = new Map<string, readonly InstallDiagnostic[]>();\nlet registryRevision = 0;\nconst registryListeners = new Set<() => void>();\n\nfunction activeState(sessionId?: string | null): RegistryState {\n if (sessionId !== undefined && sessionId !== null) {\n const workspaceId = sessionWorkspaces.get(sessionId);\n return (\n sessionStates.get(sessionId) ??\n (workspaceId === undefined ? undefined : workspaceStates.get(workspaceId)) ??\n defaultState\n );\n }\n return (\n (activeSessionId === null ? undefined : sessionStates.get(activeSessionId)) ?? workspaceState() ?? defaultState\n );\n}\n\nfunction workspaceState(): RegistryState | undefined {\n return activeWorkspaceId === null ? undefined : workspaceStates.get(activeWorkspaceId);\n}\n\n/** Settings requests an explicit scope; the cockpit reads its active session composition. */\nexport function webTemplateCatalog(mount?: WebPluginMount): WebTemplateCatalog {\n if (mount === undefined) {\n const scope = activeSessionId === null ? (activeWorkspaceId === null ? 'global' : 'workspace') : 'session';\n return collectWebTemplates(activeState().plugins, scope);\n }\n if (mount.scope === 'global') return collectWebTemplates(defaultState.plugins, 'global');\n const workspace = workspaceStates.get(mount.workspaceId);\n const plugins = mount.scope === 'session' ? sessionStates.get(mount.sessionId)?.plugins : undefined;\n return collectWebTemplates(\n plugins ?? mergeScopedPlugins(defaultState.plugins, workspace?.plugins ?? []),\n mount.scope,\n );\n}\n\n/** The phone app's layouts at the server-resolved `native.template` mount. */\nexport function nativeTemplateCatalog(mount: WebPluginMount): NativeTemplateCatalog {\n if (mount.scope === 'global') return collectNativeTemplates(defaultState.plugins, 'global');\n const workspace = workspaceStates.get(mount.workspaceId);\n const plugins = mount.scope === 'session' ? sessionStates.get(mount.sessionId)?.plugins : undefined;\n return collectNativeTemplates(\n plugins ?? mergeScopedPlugins(defaultState.plugins, workspace?.plugins ?? []),\n mount.scope,\n );\n}\nfunction rebuildSession(sessionId: string): RegistryState {\n const previous = sessionStates.get(sessionId);\n const workspaceId = sessionWorkspaces.get(sessionId);\n const workspace = workspaceId === undefined ? undefined : workspaceStates.get(workspaceId);\n const state = buildWebPluginState(\n mergeScopedPlugins(defaultState.plugins, workspace?.plugins ?? [], sessionPlugins.get(sessionId) ?? []),\n );\n sessionStates.set(sessionId, state);\n // Drop stale stores before replay, since replacement channels may share a store.\n for (const [type, channel] of previous?.channels.entries() ?? [])\n if (state.channels.get(type) !== channel) channel.drop(sessionId);\n const pending = pendingSessionFrames.get(sessionId);\n if (pending !== undefined) {\n for (const [type, frame] of pending) if (dispatchFrameToState(state, frame)) pending.delete(type);\n if (pending.size === 0) pendingSessionFrames.delete(sessionId);\n }\n return state;\n}\n\nexport function installGlobalWebPlugins(plugins: readonly WebPluginDefinition[]): void {\n defaultState = buildWebPluginState(pluginsAtScope(plugins, 'global'));\n for (const id of sessionPlugins.keys()) rebuildSession(id);\n emitRegistryChange();\n}\n\nexport function installWorkspaceWebPlugins(workspaceId: string, plugins: readonly WebPluginDefinition[]): void {\n const state = buildWebPluginState(pluginsAtScope(plugins, 'workspace'));\n workspaceStates.set(workspaceId, state);\n for (const [id, owner] of sessionWorkspaces) if (owner === workspaceId) rebuildSession(id);\n emitRegistryChange();\n}\n\nexport function removeWorkspaceWebPlugins(workspaceId: string): void {\n workspaceStates.delete(workspaceId);\n loadDiagnostics.delete(`workspace:${workspaceId}`);\n for (const [id, owner] of sessionWorkspaces) if (owner === workspaceId) rebuildSession(id);\n if (activeWorkspaceId === workspaceId) activeWorkspaceId = null;\n emitRegistryChange();\n}\n\nexport function activateWebPluginWorkspace(workspaceId: string | null): void {\n if (activeWorkspaceId === workspaceId) return;\n activeWorkspaceId = workspaceId;\n emitRegistryChange();\n}\n\nexport function bindSessionWebWorkspace(sessionId: string, workspaceId: string): void {\n sessionWorkspaces.set(sessionId, workspaceId);\n if (sessionPlugins.has(sessionId)) rebuildSession(sessionId);\n}\n\nfunction emitRegistryChange(): void {\n registryRevision += 1;\n for (const listener of registryListeners) listener();\n}\n\n/** The TUI's leader alphabet: one lowercase letter or digit per segment. */\nconst LEADER_KEY = /^[a-z0-9]$/;\nconst MAX_LEADER_PATH = 4;\n\n/**\n * A malformed binding fails the install rather than the keypress: the plugin\n * set is generated at build time, so this is a developer error, and the TUI's\n * registry refuses the same shapes.\n */\nfunction checkLeaderBinding(pluginId: string, binding: LeaderBindingContribution): void {\n if (binding.path.length === 0 || binding.path.length > MAX_LEADER_PATH) {\n throw new Error(\n `Web plugin '${pluginId}' leader binding '${binding.id}' needs 1 to ${MAX_LEADER_PATH} path segments.`,\n );\n }\n for (const segment of binding.path) {\n if (!LEADER_KEY.test(segment.key)) {\n throw new Error(\n `Web plugin '${pluginId}' leader binding '${binding.id}' key '${segment.key}' must be one lowercase letter or digit.`,\n );\n }\n if (segment.label.trim() === '') {\n throw new Error(`Web plugin '${pluginId}' leader binding '${binding.id}' has an unlabeled segment.`);\n }\n }\n}\n\ninterface PendingFill {\n pluginId: string;\n fill: SlotFillContribution;\n}\n\ninterface PendingSection {\n pluginId: string;\n section: SurfaceContribution;\n}\n\ninterface PendingBinding {\n pluginId: string;\n binding: LeaderBindingContribution;\n}\n\ntype SharedNamespace =\n | 'plugin'\n | 'tab'\n | 'dock-face'\n | 'channel'\n | 'tool'\n | 'activity-group'\n | 'minor-mode'\n | 'selection-axis'\n | 'palette-command'\n | 'settings-section';\n\n/**\n * Claims `id` in one shared namespace: false, with a diagnostic, when another\n * plugin already holds it; a throw when this plugin declared it twice, which\n * is a developer error rather than a composition.\n */\nfunction claim(owners: Map<string, string>, thing: SharedNamespace, id: string, pluginId: string): boolean {\n const holder = owners.get(id);\n if (holder === pluginId) {\n throw new Error(`Web plugin '${pluginId}' declares ${thing.replace('-', ' ')} '${id}' twice.`);\n }\n if (holder !== undefined) {\n installingState.diagnostics.push({\n pluginId,\n kind: `duplicate-${thing}`,\n message: `Web plugin '${pluginId}' ${thing.replace('-', ' ')} '${id}' is already provided by '${holder}'; keeping the first.`,\n });\n return false;\n }\n owners.set(id, pluginId);\n return true;\n}\n\nfunction surfaceFill(slot: string, surface: SurfaceContribution): SlotFillContribution {\n return { slot, id: surface.id, component: surface.component };\n}\n\nfunction checkSlotDeclaration(pluginId: string, declared: Set<string>, declaration: SlotDeclaration): void {\n const prefix = `${pluginId}${SLOT_SEPARATOR}`;\n if (!declaration.slot.startsWith(prefix) || declaration.slot.length === prefix.length) {\n throw new Error(\n `Web plugin '${pluginId}' declares slot '${declaration.slot}', which must be named '${prefix}<name>'.`,\n );\n }\n if (declared.has(declaration.slot)) {\n throw new Error(`Web plugin '${pluginId}' declares slot '${declaration.slot}' twice.`);\n }\n declared.add(declaration.slot);\n}\n\nfunction checkFill(pluginId: string, seen: Set<string>, fill: SlotFillContribution): void {\n if (fill.id === '') throw new Error(`Web plugin '${pluginId}' has a fill into '${fill.slot}' with an empty id.`);\n if (fill.component === undefined && fill.data === undefined) {\n throw new Error(`Web plugin '${pluginId}' fill '${fill.id}' into '${fill.slot}' has neither a component nor data.`);\n }\n const key = `${fill.slot} ${fill.id}`;\n if (seen.has(key)) throw new Error(`Web plugin '${pluginId}' fills '${fill.slot}' with id '${fill.id}' twice.`);\n seen.add(key);\n}\n\nfunction checkContextAction(pluginId: string, seen: Set<string>, action: ContextActionContribution): void {\n if (action.id.trim() === '') throw new Error(`Web plugin '${pluginId}' has a context action with an empty id.`);\n if (seen.has(action.id)) throw new Error(`Web plugin '${pluginId}' declares context action '${action.id}' twice.`);\n if (action.label.trim() === '')\n throw new Error(`Web plugin '${pluginId}' context action '${action.id}' has an empty label.`);\n if (action.kinds.length === 0 || action.kinds.some((kind) => kind.trim() === '')) {\n throw new Error(`Web plugin '${pluginId}' context action '${action.id}' needs non-empty kinds.`);\n }\n seen.add(action.id);\n}\n\nfunction checkUserMessageAction(pluginId: string, seen: Set<string>, action: UserMessageActionContribution): void {\n if (action.id.trim() === '') throw new Error(`Web plugin '${pluginId}' has a user message action with an empty id.`);\n if (seen.has(action.id))\n throw new Error(`Web plugin '${pluginId}' declares user message action '${action.id}' twice.`);\n if (action.label.trim() === '')\n throw new Error(`Web plugin '${pluginId}' user message action '${action.id}' has an empty label.`);\n seen.add(action.id);\n}\n\nconst byFillOrder = (left: ResolvedFill, right: ResolvedFill): number =>\n left.order - right.order || left.pluginId.localeCompare(right.pluginId) || left.id.localeCompare(right.id);\n\nconst byDisplayOrder = (left: { order?: number; name: string }, right: { order?: number; name: string }): number =>\n (left.order ?? DEFAULT_FILL_ORDER) - (right.order ?? DEFAULT_FILL_ORDER) || left.name.localeCompare(right.name);\n\nfunction placeFill(pluginId: string, fill: SlotFillContribution): void {\n const declaration = installingState.slots.get(fill.slot);\n if (declaration === undefined) {\n installingState.diagnostics.push({\n pluginId,\n kind: 'orphan-fill',\n message: `Web plugin '${pluginId}' fills slot '${fill.slot}', which no installed plugin declares; nothing is placed.`,\n });\n return;\n }\n let data = fill.data;\n if (data !== undefined && declaration.parse !== undefined) {\n const parsed = declaration.parse(data);\n if (parsed === null) {\n installingState.diagnostics.push({\n pluginId,\n kind: 'rejected-fill',\n message: `Web plugin '${pluginId}' fill '${fill.id}' into '${fill.slot}' was rejected by the slot's parse gate.`,\n });\n return;\n }\n data = parsed;\n }\n const placed: ResolvedFill = {\n slot: fill.slot,\n pluginId,\n id: fill.id,\n order: fill.order ?? DEFAULT_FILL_ORDER,\n ...(data === undefined ? {} : { data }),\n ...(fill.component === undefined ? {} : { component: fill.component }),\n };\n const list = installingState.fills.get(fill.slot);\n if (list === undefined) installingState.fills.set(fill.slot, [placed]);\n else list.push(placed);\n}\n\nfunction resolveLeaderConflicts(bindings: readonly PendingBinding[]): void {\n const owner = new Map<LeaderBindingContribution, string>(bindings.map((entry) => [entry.binding, entry.pluginId]));\n for (const conflict of leaderConflicts(bindings.map((entry) => entry.binding))) {\n const winner = owner.get(conflict.winner) ?? '';\n const loser = owner.get(conflict.loser) ?? '';\n if (winner === loser) {\n throw new Error(\n `Web plugin '${winner}' binds Leader Space '${conflict.path}' twice ('${conflict.loser.id}' and '${conflict.winner.id}').`,\n );\n }\n if (conflict.kind === 'leaf-override') {\n installingState.diagnostics.push({\n pluginId: loser,\n kind: 'leader-leaf-override',\n message: `Web plugin '${loser}' Leader Space leaf '${conflict.path}' ('${conflict.loser.id}') is taken over by '${winner}' ('${conflict.winner.id}').`,\n });\n } else {\n installingState.diagnostics.push({\n pluginId: loser,\n kind: 'leader-group-label',\n message: `Web plugin '${loser}' words Leader Space group '${conflict.path}' differently from '${winner}', which named it first; keeping the first label.`,\n });\n }\n }\n}\n\nfunction buildWebPluginState(plugins: readonly WebPluginDefinition[]): RegistryState {\n const previous = installingState;\n installingState = emptyState();\n try {\n const owners: Record<SharedNamespace, Map<string, string>> = {\n plugin: new Map(),\n tab: new Map(),\n 'dock-face': new Map(),\n channel: new Map(),\n tool: new Map(),\n 'activity-group': new Map(),\n 'minor-mode': new Map(),\n 'selection-axis': new Map(),\n 'palette-command': new Map(),\n 'settings-section': new Map(),\n };\n const pendingFills: PendingFill[] = [];\n const pendingSections: PendingSection[] = [];\n const pendingBindings: PendingBinding[] = [];\n const pendingSlots: SlotDeclaration[] = [];\n\n // Phase 1: collect, in the generated (registrationOrder, pluginId) order.\n for (const plugin of plugins) {\n if (RESERVED_PLUGIN_IDS.has(plugin.id)) {\n throw new Error(`Web plugin id '${plugin.id}' is reserved for a host slot.`);\n }\n if (owners.plugin.has(plugin.id)) {\n installingState.diagnostics.push({\n pluginId: plugin.id,\n kind: 'duplicate-plugin',\n message: `Web plugin id '${plugin.id}' is declared twice; keeping the first definition.`,\n });\n continue;\n }\n owners.plugin.set(plugin.id, plugin.id);\n installingState.plugins.push(plugin);\n for (const tab of plugin.tabs ?? []) {\n if (claim(owners.tab, 'tab', tab.id, plugin.id)) installingState.tabs.push(tab);\n }\n for (const face of plugin.dockFaces ?? []) {\n if (face.id === 'activity' || face.id === 'context') {\n throw new Error(`Web plugin '${plugin.id}' dock face '${face.id}' is reserved by the host.`);\n }\n if (face.id.trim() === '' || face.label.trim() === '') {\n throw new Error(`Web plugin '${plugin.id}' has an unlabeled dock face.`);\n }\n if (claim(owners['dock-face'], 'dock-face', face.id, plugin.id)) installingState.dockFaces.push(face);\n }\n // A panel and a section both become a /settings/:id route, so the two\n // share one id namespace rather than racing to own the same URL.\n for (const section of plugin.settingsSections ?? []) {\n if (claim(owners['settings-section'], 'settings-section', section.id, plugin.id)) {\n installingState.settingsSections.push(section);\n }\n }\n for (const panel of plugin.settingsPanels ?? []) {\n if (claim(owners['settings-section'], 'settings-section', panel.id, plugin.id)) {\n installingState.settingsPanels.push({ pluginId: plugin.id, ...panel });\n }\n }\n for (const channel of plugin.channels ?? []) {\n if (claim(owners.channel, 'channel', channel.channel, plugin.id))\n installingState.channels.set(channel.channel, channel);\n }\n for (const command of plugin.paletteCommands ?? []) {\n if (claim(owners['palette-command'], 'palette-command', command.id, plugin.id))\n installingState.commands.push(command);\n }\n const contextActions = new Set<string>();\n for (const action of plugin.contextActions ?? []) {\n checkContextAction(plugin.id, contextActions, action);\n installingState.contextActions.push({ pluginId: plugin.id, ...action });\n }\n const userMessageActions = new Set<string>();\n for (const action of plugin.userMessageActions ?? []) {\n checkUserMessageAction(plugin.id, userMessageActions, action);\n installingState.userMessageActions.push({ pluginId: plugin.id, ...action });\n }\n for (const binding of plugin.leaderBindings ?? []) {\n checkLeaderBinding(plugin.id, binding);\n pendingBindings.push({ pluginId: plugin.id, binding });\n }\n for (const axis of plugin.selectionAxes ?? []) {\n if (claim(owners['selection-axis'], 'selection-axis', axis.name, plugin.id))\n installingState.selectionAxes.push(axis);\n }\n for (const mode of plugin.minorModes ?? []) {\n if (claim(owners['minor-mode'], 'minor-mode', mode.name, plugin.id)) installingState.minorModes.push(mode);\n }\n for (const group of plugin.activityGroups ?? []) {\n if (claim(owners['activity-group'], 'activity-group', group.name, plugin.id))\n installingState.activityGroups.push(group);\n }\n for (const renderer of plugin.toolRenderers ?? []) {\n for (const tool of renderer.tools) {\n if (claim(owners.tool, 'tool', tool, plugin.id)) installingState.toolRenderers.set(tool, renderer);\n }\n if (renderer.matches !== undefined) installingState.toolMatchers.push(renderer);\n }\n const declared = new Set<string>();\n for (const declaration of plugin.slots ?? []) {\n checkSlotDeclaration(plugin.id, declared, declaration);\n pendingSlots.push(declaration);\n }\n const filled = new Set<string>();\n for (const fill of plugin.fills ?? []) {\n checkFill(plugin.id, filled, fill);\n pendingFills.push({ pluginId: plugin.id, fill });\n }\n for (const surface of plugin.overlays ?? []) {\n pendingFills.push({ pluginId: plugin.id, fill: surfaceFill(HOST_SLOTS.overlay, surface) });\n }\n for (const surface of plugin.railSections ?? []) {\n pendingFills.push({ pluginId: plugin.id, fill: surfaceFill(HOST_SLOTS.rail, surface) });\n }\n for (const surface of plugin.contextSections ?? []) {\n pendingFills.push({ pluginId: plugin.id, fill: surfaceFill(HOST_SLOTS.context, surface) });\n }\n for (const surface of plugin.selectionBarItems ?? []) {\n pendingFills.push({ pluginId: plugin.id, fill: surfaceFill(HOST_SLOTS.selectionBar, surface) });\n }\n for (const surface of plugin.composerActions ?? []) {\n pendingFills.push({ pluginId: plugin.id, fill: surfaceFill(HOST_SLOTS.composerActions, surface) });\n }\n for (const surface of plugin.composerMenuItems ?? []) {\n pendingFills.push({ pluginId: plugin.id, fill: surfaceFill(HOST_SLOTS.composerMenu, surface) });\n }\n for (const section of plugin.activitySections ?? []) pendingSections.push({ pluginId: plugin.id, section });\n if (plugin.fileLinks !== undefined) installingState.fileLinks.push(plugin.fileLinks);\n }\n\n installingState.diagnostics.push(...collectWebTemplates(installingState.plugins).diagnostics);\n\n // Phase 2: resolve by name, now that every declaration is known.\n for (const slot of Object.values(HOST_SLOTS)) installingState.slots.set(slot, { slot });\n for (const group of installingState.activityGroups) {\n installingState.slots.set(activityGroupSlot(group.name), { slot: activityGroupSlot(group.name) });\n }\n for (const declaration of pendingSlots) installingState.slots.set(declaration.slot, declaration);\n for (const { pluginId, section } of pendingSections) {\n const keyed = activityGroupSlot(section.id);\n pendingFills.push({\n pluginId,\n fill: surfaceFill(installingState.slots.has(keyed) ? keyed : HOST_SLOTS.activity, section),\n });\n }\n for (const { pluginId, fill } of pendingFills) placeFill(pluginId, fill);\n for (const list of installingState.fills.values()) list.sort(byFillOrder);\n\n resolveLeaderConflicts(pendingBindings);\n installingState.leaderBindings.push(...pendingBindings.map((entry) => entry.binding));\n installingState.contextActions.sort(\n (left, right) =>\n (left.order ?? DEFAULT_FILL_ORDER) - (right.order ?? DEFAULT_FILL_ORDER) ||\n left.pluginId.localeCompare(right.pluginId) ||\n left.id.localeCompare(right.id),\n );\n installingState.userMessageActions.sort(\n (left, right) =>\n (left.order ?? DEFAULT_FILL_ORDER) - (right.order ?? DEFAULT_FILL_ORDER) ||\n left.pluginId.localeCompare(right.pluginId) ||\n left.id.localeCompare(right.id),\n );\n installingState.selectionAxes.sort(byDisplayOrder);\n installingState.minorModes.sort(byDisplayOrder);\n installingState.activityGroups.sort(byDisplayOrder);\n installingState.dockFaces.sort(\n (left, right) =>\n (left.order ?? DEFAULT_FILL_ORDER) - (right.order ?? DEFAULT_FILL_ORDER) || left.id.localeCompare(right.id),\n );\n return installingState;\n } finally {\n installingState = previous;\n }\n}\n\nexport function installWebPlugins(plugins: readonly WebPluginDefinition[]): void {\n if (defaultInstalled) throw new Error('Web plugins are already installed.');\n defaultState = buildWebPluginState(plugins);\n installingState = defaultState;\n defaultInstalled = true;\n}\n\nexport function webPluginsInstalled(): boolean {\n return defaultInstalled;\n}\n\n/** Unit-test escape hatch; production installs exactly once. */\nexport function resetWebPlugins(): void {\n defaultState = emptyState();\n installingState = defaultState;\n defaultInstalled = false;\n sessionStates.clear();\n workspaceStates.clear();\n sessionPlugins.clear();\n sessionWorkspaces.clear();\n activeWorkspaceId = null;\n pendingSessionFrames.clear();\n loadDiagnostics.clear();\n activeSessionId = null;\n emitRegistryChange();\n}\n\n/** Installs or atomically replaces one session's independently synchronized plugin definitions. */\nexport function installSessionWebPlugins(sessionId: string, plugins: readonly WebPluginDefinition[]): void {\n sessionPlugins.set(\n sessionId,\n plugins.flatMap((plugin) => (plugin.session === undefined ? [plugin] : pluginsAtScope([plugin], 'session'))),\n );\n rebuildSession(sessionId);\n // Background-session consumers also wait for their verified composition to arrive.\n emitRegistryChange();\n}\n\n/** Selects which session composition the no-argument contribution readers expose. */\nexport function activateWebPluginSession(sessionId: string | null): void {\n if (activeSessionId === sessionId) return;\n activeSessionId = sessionId;\n emitRegistryChange();\n}\n\n/** Removes one session registry after its plugin-owned stores have been dropped. */\nexport function removeSessionWebPlugins(sessionId: string): void {\n const sessionState = sessionStates.get(sessionId);\n pendingSessionFrames.delete(sessionId);\n loadDiagnostics.delete(`session:${sessionId}`);\n if (sessionState === undefined) return;\n for (const channel of sessionState.channels.values()) channel.drop(sessionId);\n sessionStates.delete(sessionId);\n sessionPlugins.delete(sessionId);\n sessionWorkspaces.delete(sessionId);\n if (sessionId === activeSessionId) emitRegistryChange();\n}\n\nexport function subscribeWebPluginRegistry(listener: () => void): () => void {\n registryListeners.add(listener);\n return () => registryListeners.delete(listener);\n}\n\nexport function webPluginRegistryRevision(): number {\n return registryRevision;\n}\n\n/**\n * Records the slots one mount could not load, replacing its previous record. The mount still\n * installs the slots that loaded, so one broken plugin never hides the others.\n */\nexport function setWebPluginLoadDiagnostics(mount: WebPluginMount, diagnostics: readonly InstallDiagnostic[]): void {\n const key =\n mount.scope === 'global'\n ? 'global'\n : mount.scope === 'workspace'\n ? `workspace:${mount.workspaceId}`\n : `session:${mount.sessionId}`;\n if (diagnostics.length === 0 && !loadDiagnostics.has(key)) return;\n if (diagnostics.length === 0) loadDiagnostics.delete(key);\n else loadDiagnostics.set(key, [...diagnostics]);\n emitRegistryChange();\n}\n\n/**\n * What the install had to resolve between plugins, plus the slots the visible mounts could not\n * load; empty for a composition whose plugins all load and never collide.\n */\nexport function webPluginDiagnostics(): readonly InstallDiagnostic[] {\n const workspaceId =\n (activeSessionId === null ? undefined : sessionWorkspaces.get(activeSessionId)) ?? activeWorkspaceId;\n const failed = [\n 'global',\n ...(workspaceId === null ? [] : [`workspace:${workspaceId}`]),\n ...(activeSessionId === null ? [] : [`session:${activeSessionId}`]),\n ].flatMap((key) => loadDiagnostics.get(key) ?? []);\n const installed = activeState().diagnostics;\n return failed.length === 0 ? installed : [...installed, ...failed];\n}\n\n/** Every installed plugin definition, in install order; the settings page lists them. */\nexport function installedWebPlugins(): readonly WebPluginDefinition[] {\n return activeState().plugins;\n}\n\nexport interface InstalledRepositorySettingsPanel extends RepositorySettingsPanelContribution {\n pluginId: string;\n}\n\n/** Package panels placed under the host's repository controls, in stable display order. */\nexport function pluginRepositorySettingsPanels(): readonly InstalledRepositorySettingsPanel[] {\n return (workspaceState() ?? emptyState()).plugins\n .flatMap((plugin) =>\n plugin.repositorySettingsPanel === undefined ? [] : [{ pluginId: plugin.id, ...plugin.repositorySettingsPanel }],\n )\n .sort(\n (left, right) =>\n (left.order ?? DEFAULT_FILL_ORDER) - (right.order ?? DEFAULT_FILL_ORDER) ||\n left.pluginId.localeCompare(right.pluginId),\n );\n}\n\nexport function webTabs(sessionId?: string | null): readonly TabContribution[] {\n return activeState(sessionId).tabs;\n}\n\n/** Optional right-dock faces from the active session composition, in display order. */\nexport function pluginDockFaces(): readonly DockFaceContribution[] {\n return activeState().dockFaces;\n}\n\n/** UI discovery only. Requests still require a proof injected by Electron's main process. */\nexport function isDesktopClient(): boolean {\n return (\n typeof window !== 'undefined' &&\n (window as Window & { poDesktop?: { platform?: string } }).poDesktop?.platform === 'desktop'\n );\n}\n/**\n * The settings pages plugins contribute, in menu order. Sorted here rather than\n * at the reader so the menu and the page agree without either sorting twice.\n */\nexport function pluginSettingsSections(\n scope: 'global' | 'workspace' = 'global',\n): readonly SettingsSectionContribution[] {\n const sections = (scope === 'global' ? defaultState : workspaceState())?.settingsSections ?? [];\n return isDesktopClient() ? sections : sections.filter((section) => !section.desktopOnly);\n}\n\nexport interface InstalledSettingsPanel extends SettingsPanelContribution {\n pluginId: string;\n}\n\n/** The settings pages plugins draw themselves, in install order; the reader sorts them with the sections. */\nexport function pluginSettingsPanels(): readonly InstalledSettingsPanel[] {\n return defaultState.settingsPanels;\n}\n\n/** The fills placed into one slot, in slot order; empty for a slot nobody declared. */\nexport function slotFills(slot: string, sessionId?: string | null): readonly ResolvedFill[] {\n return activeState(sessionId).fills.get(slot) ?? [];\n}\n\n/** One workspace's own fills for a slot, whichever session or workspace is focused. */\nexport function workspaceSlotFills(workspaceId: string, slot: string): readonly ResolvedFill[] {\n return workspaceStates.get(workspaceId)?.fills.get(slot) ?? [];\n}\n\nexport function paletteCommands(): readonly PaletteCommandContribution[] {\n return activeState().commands;\n}\n\n/** Context actions from every installed plugin, in stable display order. */\nexport function pluginContextActions(sessionId?: string | null): readonly InstalledContextAction[] {\n return activeState(sessionId).contextActions;\n}\n\n/** User-message actions from every installed plugin, in stable display order. */\nexport function pluginUserMessageActions(): readonly InstalledUserMessageAction[] {\n return activeState().userMessageActions;\n}\n\n/** Leader Space bindings from every installed plugin, in install order: a later binding on a bound leaf wins. */\nexport function pluginLeaderBindings(): readonly LeaderBindingContribution[] {\n return activeState().leaderBindings;\n}\n\n/** Selection-axis declarations from every installed plugin, in display order. */\nexport function pluginSelectionAxes(): readonly SelectionAxisContribution[] {\n return activeState().selectionAxes;\n}\n\n/** Minor-mode declarations from every installed plugin, in display order. */\nexport function pluginMinorModes(): readonly MinorModeContribution[] {\n return activeState().minorModes;\n}\n\n/** Activity-dock group declarations from every installed plugin, in display order. */\nexport function pluginActivityGroups(): readonly ActivityGroupContribution[] {\n const groups = activeState().activityGroups;\n return isDesktopClient() ? groups : groups.filter((group) => !group.desktopOnly);\n}\n\n/**\n * The file-link sources installed plugins contribute, in install order.\n *\n * More than one is allowed and the first to claim a path wins, the same way a\n * runtime tool matcher does: the host has no way to choose between two\n * packages that both recognise a path, and the alternative is two tabs for one\n * file.\n */\nexport function pluginFileLinks(sessionId?: string | null): readonly FileLinkSource[] {\n return activeState(sessionId).fileLinks;\n}\n\n/**\n * The renderer a plugin registered for one tool: the exact name claim first,\n * then the first runtime matcher that accepts it, in install order (the one\n * place besides `start` where that order is observable); undefined leaves\n * the host's default card.\n */\nexport function pluginToolRenderer(\n toolName: string,\n statuses: Readonly<Record<string, string>> = {},\n details?: unknown,\n): ToolRendererContribution | undefined {\n return resolveToolRenderer(activeState(), toolName, statuses, details);\n}\n\nfunction resolveToolRenderer(\n state: RegistryState,\n toolName: string,\n statuses: Readonly<Record<string, string>>,\n details: unknown,\n): ToolRendererContribution | undefined {\n return (\n state.toolRenderers.get(toolName) ??\n state.toolMatchers.find((renderer) => {\n try {\n return renderer.matches?.(toolName, statuses, details);\n } catch {\n // A plugin's predicate must not take down tool cards, prompts or completion routing.\n return false;\n }\n })\n );\n}\n\n/**\n * A session-scoped renderer, resolved the way pluginToolRenderer resolves the\n * active one, or undefined until that session's verified composition is installed.\n */\nexport function sessionToolRenderer(\n sessionId: string,\n toolName: string,\n statuses: Readonly<Record<string, string>> = {},\n details?: unknown,\n): ToolRendererContribution | undefined {\n const state = sessionStates.get(sessionId);\n return state === undefined ? undefined : resolveToolRenderer(state, toolName, statuses, details);\n}\n\nexport function sessionWebPluginsInstalled(sessionId: string): boolean {\n return sessionStates.has(sessionId);\n}\n\n/**\n * Routes one wire frame to the channel owning its type. Returns false when no\n * channel claims it, so the demux can fall through silently the way unknown\n * frames always have.\n */\nfunction dispatchFrameToState(state: RegistryState, frame: Record<string, unknown>): boolean {\n if (typeof frame.type !== 'string' || typeof frame.sessionId !== 'string') return false;\n const channel = state.channels.get(frame.type);\n if (channel === undefined) return false;\n const payload = channel.parse(frame.payload);\n if (payload !== null) channel.apply(frame.sessionId, payload);\n return true;\n}\n\nexport function dispatchChannelFrame(frame: Record<string, unknown>): boolean {\n if (typeof frame.type !== 'string' || typeof frame.sessionId !== 'string') return false;\n const state = sessionStates.get(frame.sessionId);\n if (state !== undefined) {\n if (dispatchFrameToState(state, frame)) return true;\n } else if (activeSessionId === null) return dispatchFrameToState(defaultState, frame);\n // Channel envelopes carry payload; protocol events do not and must not accumulate.\n if (!Object.hasOwn(frame, 'payload')) return false;\n const pending = pendingSessionFrames.get(frame.sessionId) ?? new Map<string, Record<string, unknown>>();\n if (!pending.has(frame.type) && pending.size >= MAX_PENDING_CHANNEL_TYPES) {\n const oldest = pending.keys().next().value as string | undefined;\n if (oldest !== undefined) pending.delete(oldest);\n }\n pending.set(frame.type, frame);\n pendingSessionFrames.set(frame.sessionId, pending);\n return false;\n}\n\n/** Session teardown: every channel forgets the session's data. */\nexport function dropPluginSessionData(sessionId: string): void {\n pendingSessionFrames.delete(sessionId);\n const state = sessionStates.get(sessionId) ?? (activeSessionId === null ? defaultState : undefined);\n for (const channel of state?.channels.values() ?? []) channel.drop(sessionId);\n}\n\n/** Starts every plugin runtime in install order; the disposer runs in reverse. */\nexport function startPluginDefinitions(plugins: readonly WebPluginDefinition[], runtime: WebPluginRuntime): () => void {\n const disposers: Array<() => void> = [];\n const disposeStarted = (): void => {\n for (const dispose of disposers.reverse()) dispose();\n };\n try {\n for (const plugin of plugins) {\n const dispose = plugin.start?.(runtime);\n if (dispose) disposers.push(dispose);\n }\n } catch (error) {\n disposeStarted();\n throw error;\n }\n return disposeStarted;\n}\n\nexport function startWebPlugins(runtime: WebPluginRuntime): () => void {\n return startPluginDefinitions(activeState().plugins, runtime);\n}\n"],"mappings":";;;;;AAiGA,MAAa,aAAa;CACxB,SAAS;CACT,MAAM;CACN,SAAS;CACT,cAAc;CACd,UAAU;CACV,iBAAiB;CACjB,cAAc;CACd,aAAa;;CAEb,YAAY;AACd;AAEA,MAAM,iBAAiB;AACvB,MAAM,qBAAqB;AAC3B,MAAM,sBAA2C,IAAI,IAAI,OAAO,OAAO,UAAU,CAAC;;AAGlF,SAAgB,kBAAkB,MAAsB;CACtD,OAAO,GAAG,WAAW,WAAW,iBAAiB;AACnD;AAwBA,SAAS,aAA4B;CACnC,OAAO;EACL,SAAS,CAAC;EACV,MAAM,CAAC;EACP,WAAW,CAAC;EACZ,0BAAU,IAAI,IAAI;EAClB,UAAU,CAAC;EAC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B,MAAM,OAAO,qBAAqB,cAAc,KAAK;CAEpF,IAAI,CAAC,OAAO,OAAO,OAAO,SAAS,GAAG,OAAO;CAC7C,MAAM,UAAU,qBAAqB,IAAI,MAAM,SAAS,qBAAK,IAAI,IAAqC;CACtG,IAAI,CAAC,QAAQ,IAAI,MAAM,IAAI,KAAK,QAAQ,QAAQ,2BAA2B;EACzE,MAAM,SAAS,QAAQ,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC;EACrC,IAAI,WAAW,KAAA,GAAW,QAAQ,OAAO,MAAM;CACjD;CACA,QAAQ,IAAI,MAAM,MAAM,KAAK;CAC7B,qBAAqB,IAAI,MAAM,WAAW,OAAO;CACjD,OAAO;AACT;;AAGA,SAAgB,sBAAsB,WAAyB;CAC7D,qBAAqB,OAAO,SAAS;CACrC,MAAM,QAAQ,cAAc,IAAI,SAAS,MAAM,oBAAoB,OAAO,eAAe,KAAA;CACzF,KAAK,MAAM,WAAW,OAAO,SAAS,OAAO,KAAK,CAAC,GAAG,QAAQ,KAAK,SAAS;AAC9E;;AAGA,SAAgB,uBAAuB,SAAyC,SAAuC;CACrH,MAAM,YAA+B,CAAC;CACtC,MAAM,uBAA6B;EACjC,KAAK,MAAM,WAAW,UAAU,QAAQ,GAAG,QAAQ;CACrD;CACA,IAAI;EACF,KAAK,MAAM,UAAU,SAAS;GAC5B,MAAM,UAAU,OAAO,QAAQ,OAAO;GACtC,IAAI,SAAS,UAAU,KAAK,OAAO;EACrC;CACF,SAAS,OAAO;EACd,eAAe;EACf,MAAM;CACR;CACA,OAAO;AACT;AAEA,SAAgB,gBAAgB,SAAuC;CACrE,OAAO,uBAAuB,YAAY,CAAC,CAAC,SAAS,OAAO;AAC9D"}
|
|
1
|
+
{"version":3,"file":"pluginRegistry.mjs","names":[],"sources":["../../../src/web/lib/pluginRegistry.ts"],"sourcesContent":["import type {\n ActivityGroupContribution,\n ContextActionContribution,\n DockFaceContribution,\n FileLinkSource,\n LeaderBindingContribution,\n MinorModeContribution,\n PaletteCommandContribution,\n RepositorySettingsPanelContribution,\n SettingsPanelContribution,\n SettingsSectionContribution,\n SelectionAxisContribution,\n SessionChannelContribution,\n SlotDeclaration,\n SlotFillContribution,\n SurfaceContribution,\n TabContribution,\n ToolRendererContribution,\n UserMessageActionContribution,\n WebPluginDefinition,\n WebPluginMount,\n WebPluginRuntime,\n WebPluginSlotProps,\n} from '@agimon-ai/po-core/web';\nimport { parseHomeContribution, type HomeContribution } from '@agimon-ai/po-core/web';\nimport type { ComponentType } from 'react';\n\nimport { leaderConflicts } from './leaderTree';\nimport { mergeScopedPlugins, pluginsAtScope } from './pluginScopes';\nimport {\n collectNativeTemplates,\n collectWebTemplates,\n type NativeTemplateCatalog,\n type WebTemplateCatalog,\n} from './templateCatalog';\n\n/**\n * The installed plugin set.\n *\n * Plain module state rather than a reactive store: the generated plugin list\n * is installed once at startup, before the first render, so every read during\n * render is stable. Install runs in two phases. The first collects every\n * plugin's contributions in the generated order, which is (registrationOrder,\n * pluginId); the second resolves every relation between plugins by name, so\n * a plugin may fill a slot whichever of the two installs first.\n *\n * Plugins are independent and a user may install any of them, so a collision\n * between two plugins never fails the install: a shared name goes to the\n * first plugin (a Leader Space leaf to the later one, as the TUI documents)\n * and the loser is recorded as a diagnostic. Only a malformed contribution\n * inside one plugin throws, because that is a developer error its own tests\n * catch. resetWebPlugins exists for unit tests only.\n */\n\nexport type InstallDiagnosticKind =\n | 'duplicate-plugin'\n | 'duplicate-tab'\n | 'duplicate-dock-face'\n | 'duplicate-channel'\n | 'duplicate-tool'\n | 'duplicate-activity-group'\n | 'duplicate-minor-mode'\n | 'duplicate-selection-axis'\n | 'duplicate-palette-command'\n | 'duplicate-settings-section'\n | 'leader-leaf-override'\n | 'leader-group-label'\n | 'orphan-fill'\n | 'rejected-fill'\n | 'invalid-template'\n | 'duplicate-template'\n | 'slot-load-failed';\n\nexport interface InstallDiagnostic {\n /** The plugin that lost or misfiled the contribution. */\n pluginId: string;\n kind: InstallDiagnosticKind;\n message: string;\n}\n\n/** One placed fill, as the owner's renderSlot and slotData read it. */\nexport interface ResolvedFill {\n slot: string;\n pluginId: string;\n id: string;\n order: number;\n data?: unknown;\n component?: ComponentType<WebPluginSlotProps>;\n}\n\nexport interface InstalledContextAction extends ContextActionContribution {\n pluginId: string;\n}\n\nexport interface InstalledUserMessageAction extends UserMessageActionContribution {\n pluginId: string;\n}\n/** The slots the host itself declares; a plugin's own slots are namespaced by its id instead. */\nexport const HOST_SLOTS = {\n home: 'home',\n overlay: 'overlay',\n rail: 'rail',\n context: 'context',\n selectionBar: 'selection-bar',\n activity: 'activity',\n composerActions: 'composer-actions',\n composerMenu: 'composer-menu',\n sessionMenu: 'session-menu',\n /** A workspace plugin fill here replaces the host's new-session dialog for that workspace. */\n newSession: 'new-session',\n} as const;\n\nconst SLOT_SEPARATOR = '.';\nconst DEFAULT_FILL_ORDER = 1000;\nconst RESERVED_PLUGIN_IDS: ReadonlySet<string> = new Set(Object.values(HOST_SLOTS));\n\n/** The keyed slot an activity group opens: sections fill it and render as the group's body. */\nexport function activityGroupSlot(name: string): string {\n return `${HOST_SLOTS.activity}${SLOT_SEPARATOR}${name}`;\n}\n\ninterface RegistryState {\n plugins: WebPluginDefinition[];\n tabs: TabContribution[];\n dockFaces: DockFaceContribution[];\n channels: Map<string, SessionChannelContribution>;\n commands: PaletteCommandContribution[];\n contextActions: InstalledContextAction[];\n userMessageActions: InstalledUserMessageAction[];\n leaderBindings: LeaderBindingContribution[];\n selectionAxes: SelectionAxisContribution[];\n minorModes: MinorModeContribution[];\n activityGroups: ActivityGroupContribution[];\n settingsSections: SettingsSectionContribution[];\n settingsPanels: InstalledSettingsPanel[];\n toolRenderers: Map<string, ToolRendererContribution>;\n toolMatchers: ToolRendererContribution[];\n slots: Map<string, SlotDeclaration>;\n fills: Map<string, ResolvedFill[]>;\n fileLinks: FileLinkSource[];\n diagnostics: InstallDiagnostic[];\n}\n\nfunction emptyState(): RegistryState {\n return {\n plugins: [],\n tabs: [],\n dockFaces: [],\n channels: new Map(),\n commands: [],\n contextActions: [],\n userMessageActions: [],\n leaderBindings: [],\n selectionAxes: [],\n minorModes: [],\n activityGroups: [],\n settingsSections: [],\n settingsPanels: [],\n toolRenderers: new Map(),\n toolMatchers: [],\n slots: new Map(),\n fills: new Map(),\n fileLinks: [],\n diagnostics: [],\n };\n}\n\nlet defaultState = emptyState();\nlet installingState = defaultState;\nlet defaultInstalled = false;\nconst sessionStates = new Map<string, RegistryState>();\nconst workspaceStates = new Map<string, RegistryState>();\nconst sessionPlugins = new Map<string, readonly WebPluginDefinition[]>();\nconst sessionWorkspaces = new Map<string, string>();\nlet activeWorkspaceId: string | null = null;\nconst pendingSessionFrames = new Map<string, Map<string, Record<string, unknown>>>();\nconst MAX_PENDING_CHANNEL_TYPES = 64;\nlet activeSessionId: string | null = null;\n/** Slots each mount could not load, keyed `global`, `workspace:<id>` or `session:<id>`. */\nconst loadDiagnostics = new Map<string, readonly InstallDiagnostic[]>();\nlet registryRevision = 0;\nconst registryListeners = new Set<() => void>();\n\nfunction activeState(sessionId?: string | null): RegistryState {\n if (sessionId !== undefined && sessionId !== null) {\n const workspaceId = sessionWorkspaces.get(sessionId);\n return (\n sessionStates.get(sessionId) ??\n (workspaceId === undefined ? undefined : workspaceStates.get(workspaceId)) ??\n defaultState\n );\n }\n return (\n (activeSessionId === null ? undefined : sessionStates.get(activeSessionId)) ?? workspaceState() ?? defaultState\n );\n}\n\nfunction workspaceState(): RegistryState | undefined {\n return activeWorkspaceId === null ? undefined : workspaceStates.get(activeWorkspaceId);\n}\n\n/** Settings requests an explicit scope; the cockpit reads its active session composition. */\nexport function webTemplateCatalog(mount?: WebPluginMount): WebTemplateCatalog {\n if (mount === undefined) {\n const scope = activeSessionId === null ? (activeWorkspaceId === null ? 'global' : 'workspace') : 'session';\n return collectWebTemplates(activeState().plugins, scope);\n }\n if (mount.scope === 'global') return collectWebTemplates(defaultState.plugins, 'global');\n const workspace = workspaceStates.get(mount.workspaceId);\n const plugins = mount.scope === 'session' ? sessionStates.get(mount.sessionId)?.plugins : undefined;\n return collectWebTemplates(\n plugins ?? mergeScopedPlugins(defaultState.plugins, workspace?.plugins ?? []),\n mount.scope,\n );\n}\n\n/** The phone app's layouts at the server-resolved `native.template` mount. */\nexport function nativeTemplateCatalog(mount: WebPluginMount): NativeTemplateCatalog {\n if (mount.scope === 'global') return collectNativeTemplates(defaultState.plugins, 'global');\n const workspace = workspaceStates.get(mount.workspaceId);\n const plugins = mount.scope === 'session' ? sessionStates.get(mount.sessionId)?.plugins : undefined;\n return collectNativeTemplates(\n plugins ?? mergeScopedPlugins(defaultState.plugins, workspace?.plugins ?? []),\n mount.scope,\n );\n}\nfunction rebuildSession(sessionId: string): RegistryState {\n const previous = sessionStates.get(sessionId);\n const workspaceId = sessionWorkspaces.get(sessionId);\n const workspace = workspaceId === undefined ? undefined : workspaceStates.get(workspaceId);\n const state = buildWebPluginState(\n mergeScopedPlugins(defaultState.plugins, workspace?.plugins ?? [], sessionPlugins.get(sessionId) ?? []),\n );\n sessionStates.set(sessionId, state);\n // Drop stale stores before replay, since replacement channels may share a store.\n for (const [type, channel] of previous?.channels.entries() ?? [])\n if (state.channels.get(type) !== channel) channel.drop(sessionId);\n const pending = pendingSessionFrames.get(sessionId);\n if (pending !== undefined) {\n for (const [type, frame] of pending) if (dispatchFrameToState(state, frame)) pending.delete(type);\n if (pending.size === 0) pendingSessionFrames.delete(sessionId);\n }\n return state;\n}\n\nexport function installGlobalWebPlugins(plugins: readonly WebPluginDefinition[]): void {\n defaultState = buildWebPluginState(pluginsAtScope(plugins, 'global'), plugins);\n for (const id of sessionPlugins.keys()) rebuildSession(id);\n emitRegistryChange();\n}\n\nexport function installWorkspaceWebPlugins(workspaceId: string, plugins: readonly WebPluginDefinition[]): void {\n const state = buildWebPluginState(pluginsAtScope(plugins, 'workspace'), plugins);\n workspaceStates.set(workspaceId, state);\n for (const [id, owner] of sessionWorkspaces) if (owner === workspaceId) rebuildSession(id);\n emitRegistryChange();\n}\n\nexport function removeWorkspaceWebPlugins(workspaceId: string): void {\n workspaceStates.delete(workspaceId);\n loadDiagnostics.delete(`workspace:${workspaceId}`);\n for (const [id, owner] of sessionWorkspaces) if (owner === workspaceId) rebuildSession(id);\n if (activeWorkspaceId === workspaceId) activeWorkspaceId = null;\n emitRegistryChange();\n}\n\nexport function activateWebPluginWorkspace(workspaceId: string | null): void {\n if (activeWorkspaceId === workspaceId) return;\n activeWorkspaceId = workspaceId;\n emitRegistryChange();\n}\n\nexport function bindSessionWebWorkspace(sessionId: string, workspaceId: string): void {\n sessionWorkspaces.set(sessionId, workspaceId);\n if (sessionPlugins.has(sessionId)) rebuildSession(sessionId);\n}\n\nfunction emitRegistryChange(): void {\n registryRevision += 1;\n for (const listener of registryListeners) listener();\n}\n\n/** The TUI's leader alphabet: one lowercase letter or digit per segment. */\nconst LEADER_KEY = /^[a-z0-9]$/;\nconst MAX_LEADER_PATH = 4;\n\n/**\n * A malformed binding fails the install rather than the keypress: the plugin\n * set is generated at build time, so this is a developer error, and the TUI's\n * registry refuses the same shapes.\n */\nfunction checkLeaderBinding(pluginId: string, binding: LeaderBindingContribution): void {\n if (binding.path.length === 0 || binding.path.length > MAX_LEADER_PATH) {\n throw new Error(\n `Web plugin '${pluginId}' leader binding '${binding.id}' needs 1 to ${MAX_LEADER_PATH} path segments.`,\n );\n }\n for (const segment of binding.path) {\n if (!LEADER_KEY.test(segment.key)) {\n throw new Error(\n `Web plugin '${pluginId}' leader binding '${binding.id}' key '${segment.key}' must be one lowercase letter or digit.`,\n );\n }\n if (segment.label.trim() === '') {\n throw new Error(`Web plugin '${pluginId}' leader binding '${binding.id}' has an unlabeled segment.`);\n }\n }\n}\n\ninterface PendingFill {\n pluginId: string;\n fill: SlotFillContribution;\n}\n\ninterface PendingSection {\n pluginId: string;\n section: SurfaceContribution;\n}\n\ninterface PendingBinding {\n pluginId: string;\n binding: LeaderBindingContribution;\n}\n\ntype SharedNamespace =\n | 'plugin'\n | 'tab'\n | 'dock-face'\n | 'channel'\n | 'tool'\n | 'activity-group'\n | 'minor-mode'\n | 'selection-axis'\n | 'palette-command'\n | 'settings-section';\n\n/**\n * Claims `id` in one shared namespace: false, with a diagnostic, when another\n * plugin already holds it; a throw when this plugin declared it twice, which\n * is a developer error rather than a composition.\n */\nfunction claim(owners: Map<string, string>, thing: SharedNamespace, id: string, pluginId: string): boolean {\n const holder = owners.get(id);\n if (holder === pluginId) {\n throw new Error(`Web plugin '${pluginId}' declares ${thing.replace('-', ' ')} '${id}' twice.`);\n }\n if (holder !== undefined) {\n installingState.diagnostics.push({\n pluginId,\n kind: `duplicate-${thing}`,\n message: `Web plugin '${pluginId}' ${thing.replace('-', ' ')} '${id}' is already provided by '${holder}'; keeping the first.`,\n });\n return false;\n }\n owners.set(id, pluginId);\n return true;\n}\n\nfunction surfaceFill(slot: string, surface: SurfaceContribution): SlotFillContribution {\n return { slot, id: surface.id, component: surface.component };\n}\n\nfunction checkSlotDeclaration(pluginId: string, declared: Set<string>, declaration: SlotDeclaration): void {\n const prefix = `${pluginId}${SLOT_SEPARATOR}`;\n if (!declaration.slot.startsWith(prefix) || declaration.slot.length === prefix.length) {\n throw new Error(\n `Web plugin '${pluginId}' declares slot '${declaration.slot}', which must be named '${prefix}<name>'.`,\n );\n }\n if (declared.has(declaration.slot)) {\n throw new Error(`Web plugin '${pluginId}' declares slot '${declaration.slot}' twice.`);\n }\n declared.add(declaration.slot);\n}\n\nfunction checkFill(pluginId: string, seen: Set<string>, fill: SlotFillContribution): void {\n if (fill.id === '') throw new Error(`Web plugin '${pluginId}' has a fill into '${fill.slot}' with an empty id.`);\n if (fill.component === undefined && fill.data === undefined) {\n throw new Error(`Web plugin '${pluginId}' fill '${fill.id}' into '${fill.slot}' has neither a component nor data.`);\n }\n const key = `${fill.slot} ${fill.id}`;\n if (seen.has(key)) throw new Error(`Web plugin '${pluginId}' fills '${fill.slot}' with id '${fill.id}' twice.`);\n seen.add(key);\n}\n\nfunction checkContextAction(pluginId: string, seen: Set<string>, action: ContextActionContribution): void {\n if (action.id.trim() === '') throw new Error(`Web plugin '${pluginId}' has a context action with an empty id.`);\n if (seen.has(action.id)) throw new Error(`Web plugin '${pluginId}' declares context action '${action.id}' twice.`);\n if (action.label.trim() === '')\n throw new Error(`Web plugin '${pluginId}' context action '${action.id}' has an empty label.`);\n if (action.kinds.length === 0 || action.kinds.some((kind) => kind.trim() === '')) {\n throw new Error(`Web plugin '${pluginId}' context action '${action.id}' needs non-empty kinds.`);\n }\n seen.add(action.id);\n}\n\nfunction checkUserMessageAction(pluginId: string, seen: Set<string>, action: UserMessageActionContribution): void {\n if (action.id.trim() === '') throw new Error(`Web plugin '${pluginId}' has a user message action with an empty id.`);\n if (seen.has(action.id))\n throw new Error(`Web plugin '${pluginId}' declares user message action '${action.id}' twice.`);\n if (action.label.trim() === '')\n throw new Error(`Web plugin '${pluginId}' user message action '${action.id}' has an empty label.`);\n seen.add(action.id);\n}\n\nconst byFillOrder = (left: ResolvedFill, right: ResolvedFill): number =>\n left.order - right.order || left.pluginId.localeCompare(right.pluginId) || left.id.localeCompare(right.id);\n\nconst byDisplayOrder = (left: { order?: number; name: string }, right: { order?: number; name: string }): number =>\n (left.order ?? DEFAULT_FILL_ORDER) - (right.order ?? DEFAULT_FILL_ORDER) || left.name.localeCompare(right.name);\n\nfunction placeFill(pluginId: string, fill: SlotFillContribution): void {\n const declaration = installingState.slots.get(fill.slot);\n if (declaration === undefined) {\n installingState.diagnostics.push({\n pluginId,\n kind: 'orphan-fill',\n message: `Web plugin '${pluginId}' fills slot '${fill.slot}', which no installed plugin declares; nothing is placed.`,\n });\n return;\n }\n let data = fill.data;\n if (data !== undefined && declaration.parse !== undefined) {\n const parsed = declaration.parse(data);\n if (parsed === null) {\n installingState.diagnostics.push({\n pluginId,\n kind: 'rejected-fill',\n message: `Web plugin '${pluginId}' fill '${fill.id}' into '${fill.slot}' was rejected by the slot's parse gate.`,\n });\n return;\n }\n data = parsed;\n }\n const placed: ResolvedFill = {\n slot: fill.slot,\n pluginId,\n id: fill.id,\n order: fill.order ?? DEFAULT_FILL_ORDER,\n ...(data === undefined ? {} : { data }),\n ...(fill.component === undefined ? {} : { component: fill.component }),\n };\n const list = installingState.fills.get(fill.slot);\n if (list === undefined) installingState.fills.set(fill.slot, [placed]);\n else list.push(placed);\n}\n\nfunction resolveLeaderConflicts(bindings: readonly PendingBinding[]): void {\n const owner = new Map<LeaderBindingContribution, string>(bindings.map((entry) => [entry.binding, entry.pluginId]));\n for (const conflict of leaderConflicts(bindings.map((entry) => entry.binding))) {\n const winner = owner.get(conflict.winner) ?? '';\n const loser = owner.get(conflict.loser) ?? '';\n if (winner === loser) {\n throw new Error(\n `Web plugin '${winner}' binds Leader Space '${conflict.path}' twice ('${conflict.loser.id}' and '${conflict.winner.id}').`,\n );\n }\n if (conflict.kind === 'leaf-override') {\n installingState.diagnostics.push({\n pluginId: loser,\n kind: 'leader-leaf-override',\n message: `Web plugin '${loser}' Leader Space leaf '${conflict.path}' ('${conflict.loser.id}') is taken over by '${winner}' ('${conflict.winner.id}').`,\n });\n } else {\n installingState.diagnostics.push({\n pluginId: loser,\n kind: 'leader-group-label',\n message: `Web plugin '${loser}' words Leader Space group '${conflict.path}' differently from '${winner}', which named it first; keeping the first label.`,\n });\n }\n }\n}\n\nfunction buildWebPluginState(\n plugins: readonly WebPluginDefinition[],\n definitions: readonly WebPluginDefinition[] = plugins,\n): RegistryState {\n const previous = installingState;\n installingState = emptyState();\n try {\n const owners: Record<SharedNamespace, Map<string, string>> = {\n plugin: new Map(),\n tab: new Map(),\n 'dock-face': new Map(),\n channel: new Map(),\n tool: new Map(),\n 'activity-group': new Map(),\n 'minor-mode': new Map(),\n 'selection-axis': new Map(),\n 'palette-command': new Map(),\n 'settings-section': new Map(),\n };\n const pendingFills: PendingFill[] = [];\n const pendingSections: PendingSection[] = [];\n const pendingBindings: PendingBinding[] = [];\n const pendingSlots: SlotDeclaration[] = [];\n\n // Phase 1: collect, in the generated (registrationOrder, pluginId) order.\n for (const plugin of plugins) {\n if (RESERVED_PLUGIN_IDS.has(plugin.id)) {\n throw new Error(`Web plugin id '${plugin.id}' is reserved for a host slot.`);\n }\n if (owners.plugin.has(plugin.id)) {\n installingState.diagnostics.push({\n pluginId: plugin.id,\n kind: 'duplicate-plugin',\n message: `Web plugin id '${plugin.id}' is declared twice; keeping the first definition.`,\n });\n continue;\n }\n owners.plugin.set(plugin.id, plugin.id);\n installingState.plugins.push(plugin);\n for (const tab of plugin.tabs ?? []) {\n if (claim(owners.tab, 'tab', tab.id, plugin.id)) installingState.tabs.push(tab);\n }\n for (const face of plugin.dockFaces ?? []) {\n if (face.id === 'activity' || face.id === 'context') {\n throw new Error(`Web plugin '${plugin.id}' dock face '${face.id}' is reserved by the host.`);\n }\n if (face.id.trim() === '' || face.label.trim() === '') {\n throw new Error(`Web plugin '${plugin.id}' has an unlabeled dock face.`);\n }\n if (claim(owners['dock-face'], 'dock-face', face.id, plugin.id)) installingState.dockFaces.push(face);\n }\n // A panel and a section both become a /settings/:id route, so the two\n // share one id namespace rather than racing to own the same URL.\n for (const section of plugin.settingsSections ?? []) {\n if (claim(owners['settings-section'], 'settings-section', section.id, plugin.id)) {\n installingState.settingsSections.push(section);\n }\n }\n for (const panel of plugin.settingsPanels ?? []) {\n if (claim(owners['settings-section'], 'settings-section', panel.id, plugin.id)) {\n installingState.settingsPanels.push({ pluginId: plugin.id, ...panel });\n }\n }\n for (const channel of plugin.channels ?? []) {\n if (claim(owners.channel, 'channel', channel.channel, plugin.id))\n installingState.channels.set(channel.channel, channel);\n }\n for (const command of plugin.paletteCommands ?? []) {\n if (claim(owners['palette-command'], 'palette-command', command.id, plugin.id))\n installingState.commands.push(command);\n }\n const contextActions = new Set<string>();\n for (const action of plugin.contextActions ?? []) {\n checkContextAction(plugin.id, contextActions, action);\n installingState.contextActions.push({ pluginId: plugin.id, ...action });\n }\n const userMessageActions = new Set<string>();\n for (const action of plugin.userMessageActions ?? []) {\n checkUserMessageAction(plugin.id, userMessageActions, action);\n installingState.userMessageActions.push({ pluginId: plugin.id, ...action });\n }\n for (const binding of plugin.leaderBindings ?? []) {\n checkLeaderBinding(plugin.id, binding);\n pendingBindings.push({ pluginId: plugin.id, binding });\n }\n for (const axis of plugin.selectionAxes ?? []) {\n if (claim(owners['selection-axis'], 'selection-axis', axis.name, plugin.id))\n installingState.selectionAxes.push(axis);\n }\n for (const mode of plugin.minorModes ?? []) {\n if (claim(owners['minor-mode'], 'minor-mode', mode.name, plugin.id)) installingState.minorModes.push(mode);\n }\n for (const group of plugin.activityGroups ?? []) {\n if (claim(owners['activity-group'], 'activity-group', group.name, plugin.id))\n installingState.activityGroups.push(group);\n }\n for (const renderer of plugin.toolRenderers ?? []) {\n for (const tool of renderer.tools) {\n if (claim(owners.tool, 'tool', tool, plugin.id)) installingState.toolRenderers.set(tool, renderer);\n }\n if (renderer.matches !== undefined) installingState.toolMatchers.push(renderer);\n }\n const declared = new Set<string>();\n for (const declaration of plugin.slots ?? []) {\n checkSlotDeclaration(plugin.id, declared, declaration);\n pendingSlots.push(declaration);\n }\n const filled = new Set<string>();\n for (const fill of plugin.fills ?? []) {\n checkFill(plugin.id, filled, fill);\n pendingFills.push({ pluginId: plugin.id, fill });\n }\n for (const surface of plugin.overlays ?? []) {\n pendingFills.push({ pluginId: plugin.id, fill: surfaceFill(HOST_SLOTS.overlay, surface) });\n }\n for (const surface of plugin.railSections ?? []) {\n pendingFills.push({ pluginId: plugin.id, fill: surfaceFill(HOST_SLOTS.rail, surface) });\n }\n for (const surface of plugin.contextSections ?? []) {\n pendingFills.push({ pluginId: plugin.id, fill: surfaceFill(HOST_SLOTS.context, surface) });\n }\n for (const surface of plugin.selectionBarItems ?? []) {\n pendingFills.push({ pluginId: plugin.id, fill: surfaceFill(HOST_SLOTS.selectionBar, surface) });\n }\n for (const surface of plugin.composerActions ?? []) {\n pendingFills.push({ pluginId: plugin.id, fill: surfaceFill(HOST_SLOTS.composerActions, surface) });\n }\n for (const surface of plugin.composerMenuItems ?? []) {\n pendingFills.push({ pluginId: plugin.id, fill: surfaceFill(HOST_SLOTS.composerMenu, surface) });\n }\n for (const section of plugin.activitySections ?? []) pendingSections.push({ pluginId: plugin.id, section });\n if (plugin.fileLinks !== undefined) installingState.fileLinks.push(plugin.fileLinks);\n }\n\n installingState.diagnostics.push(...collectWebTemplates(installingState.plugins).diagnostics);\n\n // Phase 2: resolve by name, now that every declaration is known.\n for (const slot of Object.values(HOST_SLOTS)) installingState.slots.set(slot, { slot });\n installingState.slots.set(HOST_SLOTS.home, { slot: HOST_SLOTS.home, parse: parseHomeContribution });\n for (const group of installingState.activityGroups) {\n installingState.slots.set(activityGroupSlot(group.name), { slot: activityGroupSlot(group.name) });\n }\n for (const declaration of pendingSlots) installingState.slots.set(declaration.slot, declaration);\n for (const { pluginId, section } of pendingSections) {\n const keyed = activityGroupSlot(section.id);\n pendingFills.push({\n pluginId,\n fill: surfaceFill(installingState.slots.has(keyed) ? keyed : HOST_SLOTS.activity, section),\n });\n }\n for (const { pluginId, fill } of pendingFills) {\n if (fill.slot === HOST_SLOTS.home) {\n const data = parseHomeContribution(fill.data);\n const definition = definitions.find((plugin) => plugin.id === pluginId);\n const sources = [definition, definition?.global, definition?.workspace, definition?.session].flatMap(\n (contribution) => contribution?.channels ?? [],\n );\n if (data === null || !sources.some((channel) => channel.channel === data.source)) {\n installingState.diagnostics.push({\n pluginId,\n kind: 'rejected-fill',\n message: `Web plugin '${pluginId}' Home fill '${fill.id}' needs valid data and an owned source channel.`,\n });\n continue;\n }\n }\n placeFill(pluginId, fill);\n }\n for (const list of installingState.fills.values()) list.sort(byFillOrder);\n\n resolveLeaderConflicts(pendingBindings);\n installingState.leaderBindings.push(...pendingBindings.map((entry) => entry.binding));\n installingState.contextActions.sort(\n (left, right) =>\n (left.order ?? DEFAULT_FILL_ORDER) - (right.order ?? DEFAULT_FILL_ORDER) ||\n left.pluginId.localeCompare(right.pluginId) ||\n left.id.localeCompare(right.id),\n );\n installingState.userMessageActions.sort(\n (left, right) =>\n (left.order ?? DEFAULT_FILL_ORDER) - (right.order ?? DEFAULT_FILL_ORDER) ||\n left.pluginId.localeCompare(right.pluginId) ||\n left.id.localeCompare(right.id),\n );\n installingState.selectionAxes.sort(byDisplayOrder);\n installingState.minorModes.sort(byDisplayOrder);\n installingState.activityGroups.sort(byDisplayOrder);\n installingState.dockFaces.sort(\n (left, right) =>\n (left.order ?? DEFAULT_FILL_ORDER) - (right.order ?? DEFAULT_FILL_ORDER) || left.id.localeCompare(right.id),\n );\n return installingState;\n } finally {\n installingState = previous;\n }\n}\n\nexport function installWebPlugins(plugins: readonly WebPluginDefinition[]): void {\n if (defaultInstalled) throw new Error('Web plugins are already installed.');\n defaultState = buildWebPluginState(plugins);\n installingState = defaultState;\n defaultInstalled = true;\n}\n\nexport function webPluginsInstalled(): boolean {\n return defaultInstalled;\n}\n\n/** Unit-test escape hatch; production installs exactly once. */\nexport function resetWebPlugins(): void {\n defaultState = emptyState();\n installingState = defaultState;\n defaultInstalled = false;\n sessionStates.clear();\n workspaceStates.clear();\n sessionPlugins.clear();\n sessionWorkspaces.clear();\n activeWorkspaceId = null;\n pendingSessionFrames.clear();\n loadDiagnostics.clear();\n activeSessionId = null;\n emitRegistryChange();\n}\n\n/** Installs or atomically replaces one session's independently synchronized plugin definitions. */\nexport function installSessionWebPlugins(sessionId: string, plugins: readonly WebPluginDefinition[]): void {\n sessionPlugins.set(\n sessionId,\n plugins.flatMap((plugin) => (plugin.session === undefined ? [plugin] : pluginsAtScope([plugin], 'session'))),\n );\n rebuildSession(sessionId);\n // Background-session consumers also wait for their verified composition to arrive.\n emitRegistryChange();\n}\n\n/** Selects which session composition the no-argument contribution readers expose. */\nexport function activateWebPluginSession(sessionId: string | null): void {\n if (activeSessionId === sessionId) return;\n activeSessionId = sessionId;\n emitRegistryChange();\n}\n\n/** Removes one session registry after its plugin-owned stores have been dropped. */\nexport function removeSessionWebPlugins(sessionId: string): void {\n const sessionState = sessionStates.get(sessionId);\n pendingSessionFrames.delete(sessionId);\n loadDiagnostics.delete(`session:${sessionId}`);\n if (sessionState === undefined) return;\n for (const channel of sessionState.channels.values()) channel.drop(sessionId);\n sessionStates.delete(sessionId);\n sessionPlugins.delete(sessionId);\n sessionWorkspaces.delete(sessionId);\n if (sessionId === activeSessionId) emitRegistryChange();\n}\n\nexport function subscribeWebPluginRegistry(listener: () => void): () => void {\n registryListeners.add(listener);\n return () => registryListeners.delete(listener);\n}\n\nexport function webPluginRegistryRevision(): number {\n return registryRevision;\n}\n\n/**\n * Records the slots one mount could not load, replacing its previous record. The mount still\n * installs the slots that loaded, so one broken plugin never hides the others.\n */\nexport function setWebPluginLoadDiagnostics(mount: WebPluginMount, diagnostics: readonly InstallDiagnostic[]): void {\n const key =\n mount.scope === 'global'\n ? 'global'\n : mount.scope === 'workspace'\n ? `workspace:${mount.workspaceId}`\n : `session:${mount.sessionId}`;\n if (diagnostics.length === 0 && !loadDiagnostics.has(key)) return;\n if (diagnostics.length === 0) loadDiagnostics.delete(key);\n else loadDiagnostics.set(key, [...diagnostics]);\n emitRegistryChange();\n}\n\n/**\n * What the install had to resolve between plugins, plus the slots the visible mounts could not\n * load; empty for a composition whose plugins all load and never collide.\n */\nexport function webPluginDiagnostics(): readonly InstallDiagnostic[] {\n const workspaceId =\n (activeSessionId === null ? undefined : sessionWorkspaces.get(activeSessionId)) ?? activeWorkspaceId;\n const failed = [\n 'global',\n ...(workspaceId === null ? [] : [`workspace:${workspaceId}`]),\n ...(activeSessionId === null ? [] : [`session:${activeSessionId}`]),\n ].flatMap((key) => loadDiagnostics.get(key) ?? []);\n const installed = activeState().diagnostics;\n return failed.length === 0 ? installed : [...installed, ...failed];\n}\n\n/** Every installed plugin definition, in install order; the settings page lists them. */\nexport function installedWebPlugins(): readonly WebPluginDefinition[] {\n return activeState().plugins;\n}\n\nexport interface InstalledRepositorySettingsPanel extends RepositorySettingsPanelContribution {\n pluginId: string;\n}\n\n/** Package panels placed under the host's repository controls, in stable display order. */\nexport function pluginRepositorySettingsPanels(): readonly InstalledRepositorySettingsPanel[] {\n return (workspaceState() ?? emptyState()).plugins\n .flatMap((plugin) =>\n plugin.repositorySettingsPanel === undefined ? [] : [{ pluginId: plugin.id, ...plugin.repositorySettingsPanel }],\n )\n .sort(\n (left, right) =>\n (left.order ?? DEFAULT_FILL_ORDER) - (right.order ?? DEFAULT_FILL_ORDER) ||\n left.pluginId.localeCompare(right.pluginId),\n );\n}\n\nexport function webTabs(sessionId?: string | null): readonly TabContribution[] {\n return activeState(sessionId).tabs;\n}\n\n/** Optional right-dock faces from the active session composition, in display order. */\nexport function pluginDockFaces(): readonly DockFaceContribution[] {\n return activeState().dockFaces;\n}\n\n/** UI discovery only. Requests still require a proof injected by Electron's main process. */\nexport function isDesktopClient(): boolean {\n return (\n typeof window !== 'undefined' &&\n (window as Window & { poDesktop?: { platform?: string } }).poDesktop?.platform === 'desktop'\n );\n}\n/**\n * The settings pages plugins contribute, in menu order. Sorted here rather than\n * at the reader so the menu and the page agree without either sorting twice.\n */\nexport function pluginSettingsSections(\n scope: 'global' | 'workspace' = 'global',\n): readonly SettingsSectionContribution[] {\n const sections = (scope === 'global' ? defaultState : workspaceState())?.settingsSections ?? [];\n return isDesktopClient() ? sections : sections.filter((section) => !section.desktopOnly);\n}\n\nexport interface InstalledSettingsPanel extends SettingsPanelContribution {\n pluginId: string;\n}\n\n/** The settings pages plugins draw themselves, in install order; the reader sorts them with the sections. */\nexport function pluginSettingsPanels(): readonly InstalledSettingsPanel[] {\n return defaultState.settingsPanels;\n}\n\n/** The fills placed into one slot, in slot order; empty for a slot nobody declared. */\nexport function slotFills(slot: string, sessionId?: string | null): readonly ResolvedFill[] {\n return activeState(sessionId).fills.get(slot) ?? [];\n}\n\n/** One workspace's own fills for a slot, whichever session or workspace is focused. */\nexport function workspaceSlotFills(workspaceId: string, slot: string): readonly ResolvedFill[] {\n return workspaceStates.get(workspaceId)?.fills.get(slot) ?? [];\n}\n\nexport interface InstalledHomeContribution {\n pluginId: string;\n id: string;\n order: number;\n data: HomeContribution;\n mount: Exclude<WebPluginMount, { scope: 'session' }>;\n}\n\n/** Home reads an explicit host mount, never the focused session or workspace. */\nexport function pluginHomeContributions(\n mount: Exclude<WebPluginMount, { scope: 'session' }>,\n): readonly InstalledHomeContribution[] {\n const global = defaultState.fills.get(HOST_SLOTS.home) ?? [];\n const workspace =\n mount.scope === 'workspace' ? (workspaceStates.get(mount.workspaceId)?.fills.get(HOST_SLOTS.home) ?? []) : [];\n const seen = new Set<string>();\n const contributions: InstalledHomeContribution[] = [];\n for (const fill of [...global, ...workspace]) {\n const data = parseHomeContribution(fill.data);\n if (data === null) continue;\n const key = `${fill.pluginId}\\0${data.source}`;\n if (seen.has(key)) continue;\n seen.add(key);\n contributions.push({\n pluginId: fill.pluginId,\n id: fill.id,\n order: fill.order,\n data,\n mount: global.includes(fill) ? { scope: 'global' } : mount,\n });\n }\n return contributions.sort(\n (left, right) =>\n left.order - right.order || left.pluginId.localeCompare(right.pluginId) || left.id.localeCompare(right.id),\n );\n}\n\nexport function paletteCommands(): readonly PaletteCommandContribution[] {\n return activeState().commands;\n}\n\n/** Context actions from every installed plugin, in stable display order. */\nexport function pluginContextActions(sessionId?: string | null): readonly InstalledContextAction[] {\n return activeState(sessionId).contextActions;\n}\n\n/** User-message actions from every installed plugin, in stable display order. */\nexport function pluginUserMessageActions(): readonly InstalledUserMessageAction[] {\n return activeState().userMessageActions;\n}\n\n/** Leader Space bindings from every installed plugin, in install order: a later binding on a bound leaf wins. */\nexport function pluginLeaderBindings(): readonly LeaderBindingContribution[] {\n return activeState().leaderBindings;\n}\n\n/** Selection-axis declarations from every installed plugin, in display order. */\nexport function pluginSelectionAxes(): readonly SelectionAxisContribution[] {\n return activeState().selectionAxes;\n}\n\n/** Minor-mode declarations from every installed plugin, in display order. */\nexport function pluginMinorModes(): readonly MinorModeContribution[] {\n return activeState().minorModes;\n}\n\n/** Activity-dock group declarations from every installed plugin, in display order. */\nexport function pluginActivityGroups(): readonly ActivityGroupContribution[] {\n const groups = activeState().activityGroups;\n return isDesktopClient() ? groups : groups.filter((group) => !group.desktopOnly);\n}\n\n/**\n * The file-link sources installed plugins contribute, in install order.\n *\n * More than one is allowed and the first to claim a path wins, the same way a\n * runtime tool matcher does: the host has no way to choose between two\n * packages that both recognise a path, and the alternative is two tabs for one\n * file.\n */\nexport function pluginFileLinks(sessionId?: string | null): readonly FileLinkSource[] {\n return activeState(sessionId).fileLinks;\n}\n\n/**\n * The renderer a plugin registered for one tool: the exact name claim first,\n * then the first runtime matcher that accepts it, in install order (the one\n * place besides `start` where that order is observable); undefined leaves\n * the host's default card.\n */\nexport function pluginToolRenderer(\n toolName: string,\n statuses: Readonly<Record<string, string>> = {},\n details?: unknown,\n): ToolRendererContribution | undefined {\n return resolveToolRenderer(activeState(), toolName, statuses, details);\n}\n\nfunction resolveToolRenderer(\n state: RegistryState,\n toolName: string,\n statuses: Readonly<Record<string, string>>,\n details: unknown,\n): ToolRendererContribution | undefined {\n return (\n state.toolRenderers.get(toolName) ??\n state.toolMatchers.find((renderer) => {\n try {\n return renderer.matches?.(toolName, statuses, details);\n } catch {\n // A plugin's predicate must not take down tool cards, prompts or completion routing.\n return false;\n }\n })\n );\n}\n\n/**\n * A session-scoped renderer, resolved the way pluginToolRenderer resolves the\n * active one, or undefined until that session's verified composition is installed.\n */\nexport function sessionToolRenderer(\n sessionId: string,\n toolName: string,\n statuses: Readonly<Record<string, string>> = {},\n details?: unknown,\n): ToolRendererContribution | undefined {\n const state = sessionStates.get(sessionId);\n return state === undefined ? undefined : resolveToolRenderer(state, toolName, statuses, details);\n}\n\nexport function sessionWebPluginsInstalled(sessionId: string): boolean {\n return sessionStates.has(sessionId);\n}\n\n/**\n * Routes one wire frame to the channel owning its type. Returns false when no\n * channel claims it, so the demux can fall through silently the way unknown\n * frames always have.\n */\nfunction dispatchFrameToState(state: RegistryState, frame: Record<string, unknown>): boolean {\n if (typeof frame.type !== 'string' || typeof frame.sessionId !== 'string') return false;\n const channel = state.channels.get(frame.type);\n if (channel === undefined) return false;\n const payload = channel.parse(frame.payload);\n if (payload !== null) channel.apply(frame.sessionId, payload);\n return true;\n}\n\nexport function dispatchChannelFrame(frame: Record<string, unknown>): boolean {\n if (typeof frame.type !== 'string' || typeof frame.sessionId !== 'string') return false;\n const state = sessionStates.get(frame.sessionId);\n if (state !== undefined) {\n if (dispatchFrameToState(state, frame)) return true;\n } else if (activeSessionId === null) return dispatchFrameToState(defaultState, frame);\n // Channel envelopes carry payload; protocol events do not and must not accumulate.\n if (!Object.hasOwn(frame, 'payload')) return false;\n const pending = pendingSessionFrames.get(frame.sessionId) ?? new Map<string, Record<string, unknown>>();\n if (!pending.has(frame.type) && pending.size >= MAX_PENDING_CHANNEL_TYPES) {\n const oldest = pending.keys().next().value as string | undefined;\n if (oldest !== undefined) pending.delete(oldest);\n }\n pending.set(frame.type, frame);\n pendingSessionFrames.set(frame.sessionId, pending);\n return false;\n}\n\n/** Session teardown: every channel forgets the session's data. */\nexport function dropPluginSessionData(sessionId: string): void {\n pendingSessionFrames.delete(sessionId);\n const state = sessionStates.get(sessionId) ?? (activeSessionId === null ? defaultState : undefined);\n for (const channel of state?.channels.values() ?? []) channel.drop(sessionId);\n}\n\n/** Starts every plugin runtime in install order; the disposer runs in reverse. */\nexport function startPluginDefinitions(plugins: readonly WebPluginDefinition[], runtime: WebPluginRuntime): () => void {\n const disposers: Array<() => void> = [];\n const disposeStarted = (): void => {\n for (const dispose of disposers.reverse()) dispose();\n };\n try {\n for (const plugin of plugins) {\n const dispose = plugin.start?.(runtime);\n if (dispose) disposers.push(dispose);\n }\n } catch (error) {\n disposeStarted();\n throw error;\n }\n return disposeStarted;\n}\n\nexport function startWebPlugins(runtime: WebPluginRuntime): () => void {\n return startPluginDefinitions(activeState().plugins, runtime);\n}\n"],"mappings":";;;;;;AAkGA,MAAa,aAAa;CACxB,MAAM;CACN,SAAS;CACT,MAAM;CACN,SAA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M,uBAA6B;EACjC,KAAK,MAAM,WAAW,UAAU,QAAQ,GAAG,QAAQ;CACrD;CACA,IAAI;EACF,KAAK,MAAM,UAAU,SAAS;GAC5B,MAAM,UAAU,OAAO,QAAQ,OAAO;GACtC,IAAI,SAAS,UAAU,KAAK,OAAO;EACrC;CACF,SAAS,OAAO;EACd,eAAe;EACf,MAAM;CACR;CACA,OAAO;AACT;AAEA,SAAgB,gBAAgB,SAAuC;CACrE,OAAO,uBAAuB,YAAY,CAAC,CAAC,SAAS,OAAO;AAC9D"}
|
|
@@ -1,103 +1,165 @@
|
|
|
1
|
-
let _earendil_works_chord_context = require("@earendil-works/chord/context");
|
|
2
|
-
let _agimon_ai_po_core_pluginProtocol = require("@agimon-ai/po-core/pluginProtocol");
|
|
3
1
|
let _agimon_ai_po_core_sessionProtocol = require("@agimon-ai/po-core/sessionProtocol");
|
|
4
|
-
let _earendil_works_chord = require("@earendil-works/chord");
|
|
5
|
-
let _earendil_works_pi_client = require("@earendil-works/pi-client");
|
|
6
2
|
//#region src/web/lib/protocolHubSocket.ts
|
|
7
|
-
/**
|
|
8
|
-
function
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
let
|
|
15
|
-
let
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Holds one object until the returned function is called. A reference the server forced
|
|
5
|
+
* away after it was live (a Desktop claim) is held again; one refused outright stays released.
|
|
6
|
+
* A refusal because this code is older than the server's stops the whole client instead.
|
|
7
|
+
* Before the first link a hold has no route and Chord refuses it for good, so it waits for the link.
|
|
8
|
+
*/
|
|
9
|
+
function keep(client, hold, attach) {
|
|
10
|
+
let released = false;
|
|
11
|
+
let detach = () => void 0;
|
|
12
|
+
const take = () => {
|
|
13
|
+
if (!client.connected) {
|
|
14
|
+
const stop = client.onConnectionStateChange(({ state }) => {
|
|
15
|
+
if (state !== "connected") return;
|
|
16
|
+
stop();
|
|
17
|
+
if (!released) take();
|
|
18
|
+
});
|
|
19
|
+
detach = stop;
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const ref = hold();
|
|
23
|
+
let live = false;
|
|
24
|
+
const stopAttach = attach(ref);
|
|
25
|
+
const stopStatus = ref.onStatus((status) => {
|
|
26
|
+
if (status === "live") live = true;
|
|
27
|
+
if (status !== "gone" || released) return;
|
|
28
|
+
detach();
|
|
29
|
+
if ((0, _agimon_ai_po_core_sessionProtocol.isUpdateRequired)(ref.error)) client.reportError(ref.error);
|
|
30
|
+
else if (live) take();
|
|
35
31
|
});
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
32
|
+
detach = () => {
|
|
33
|
+
stopStatus();
|
|
34
|
+
stopAttach();
|
|
35
|
+
ref.release();
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
take();
|
|
39
|
+
return () => {
|
|
40
|
+
released = true;
|
|
41
|
+
detach();
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/** Hub, channels and threads over the page's one Chord connection; references survive reconnects. */
|
|
45
|
+
function createProtocolHubSocket(client, handlers) {
|
|
46
|
+
const { host } = client;
|
|
47
|
+
let hub;
|
|
48
|
+
let updateRequired = false;
|
|
49
|
+
const acknowledged = /* @__PURE__ */ new Set();
|
|
50
|
+
const releaseHub = keep(client, () => host.hold(_agimon_ai_po_core_sessionProtocol.PoHubContract, {}), (ref) => {
|
|
51
|
+
hub = ref;
|
|
52
|
+
const stops = [
|
|
53
|
+
ref.sessions.subscribe((sessions) => {
|
|
54
|
+
if (sessions) handlers.onSessions(Object.values(sessions));
|
|
55
|
+
}),
|
|
56
|
+
ref.workspaces.subscribe((workspaces) => {
|
|
57
|
+
if (workspaces) handlers.onWorkspaces(Object.values(workspaces));
|
|
58
|
+
}),
|
|
59
|
+
ref.pending.subscribe((notices) => {
|
|
60
|
+
if (!notices) return;
|
|
61
|
+
const current = new Set(notices.map((notice) => notice.id));
|
|
62
|
+
for (const id of acknowledged) if (!current.has(id)) acknowledged.delete(id);
|
|
63
|
+
for (const notice of notices) {
|
|
64
|
+
if (acknowledged.has(notice.id)) continue;
|
|
65
|
+
acknowledged.add(notice.id);
|
|
66
|
+
handlers.onNotice(notice.sessionId, notice.frame);
|
|
67
|
+
ref.ackNotice({ id: notice.id }).catch(() => void 0);
|
|
52
68
|
}
|
|
69
|
+
}),
|
|
70
|
+
ref.onStatus((status) => {
|
|
71
|
+
if (updateRequired) return;
|
|
72
|
+
if (status === "live") handlers.onOpen();
|
|
73
|
+
else if (status === "loading" || status === "gone") handlers.onClose();
|
|
74
|
+
})
|
|
75
|
+
];
|
|
76
|
+
return () => {
|
|
77
|
+
if (hub === ref) hub = void 0;
|
|
78
|
+
for (const stop of stops) stop();
|
|
79
|
+
};
|
|
80
|
+
});
|
|
81
|
+
const channels = /* @__PURE__ */ new Map();
|
|
82
|
+
const stopUpdateWatch = client.onConnectionStateChange(({ state }) => {
|
|
83
|
+
if (state !== "update_required" || updateRequired) return;
|
|
84
|
+
updateRequired = true;
|
|
85
|
+
handlers.onClose();
|
|
86
|
+
handlers.onUpdateRequired?.();
|
|
87
|
+
});
|
|
88
|
+
const watchChannels = (sessionId) => {
|
|
89
|
+
const entry = {
|
|
90
|
+
ref: void 0,
|
|
91
|
+
release: () => void 0
|
|
92
|
+
};
|
|
93
|
+
entry.release = keep(client, () => host.hold(_agimon_ai_po_core_sessionProtocol.PoChannelsContract, { sessionId }), (ref) => {
|
|
94
|
+
entry.ref = ref;
|
|
95
|
+
let previous = {};
|
|
96
|
+
const stop = ref.latest.subscribe((latest) => {
|
|
97
|
+
if (!latest) return;
|
|
98
|
+
for (const [type, payload] of Object.entries(latest)) if (previous[type] !== payload) handlers.onChannel({
|
|
99
|
+
type,
|
|
100
|
+
sessionId,
|
|
101
|
+
payload
|
|
102
|
+
});
|
|
103
|
+
previous = latest;
|
|
104
|
+
});
|
|
105
|
+
return () => {
|
|
106
|
+
if (entry.ref === ref) entry.ref = void 0;
|
|
107
|
+
stop();
|
|
53
108
|
};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
unsubscribe = hub.state.subscribe(publish);
|
|
57
|
-
} catch {
|
|
58
|
-
if (!stopped && mine === generation) {
|
|
59
|
-
release();
|
|
60
|
-
handlers.onClose();
|
|
61
|
-
client.disconnect();
|
|
62
|
-
}
|
|
63
|
-
} finally {
|
|
64
|
-
if (cancelOpening === opening.cancel) cancelOpening = void 0;
|
|
65
|
-
if (binding === next && (stopped || mine !== generation)) {
|
|
66
|
-
binding = void 0;
|
|
67
|
-
await next.dispose(_earendil_works_chord_context.BACKGROUND_CONTEXT).catch(() => void 0);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
109
|
+
});
|
|
110
|
+
return entry;
|
|
70
111
|
};
|
|
71
|
-
const stopWatch = client.onConnectionStateChange((change) => {
|
|
72
|
-
if (stopped) return;
|
|
73
|
-
if (change.state === "connected") open();
|
|
74
|
-
else if (change.state === "disconnected") {
|
|
75
|
-
release();
|
|
76
|
-
handlers.onClose();
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
if (client.connected) open();
|
|
80
112
|
return {
|
|
81
|
-
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
113
|
+
watchSessions(sessionIds) {
|
|
114
|
+
const wanted = new Set(sessionIds);
|
|
115
|
+
for (const [sessionId, entry] of channels) {
|
|
116
|
+
if (wanted.has(sessionId)) continue;
|
|
117
|
+
channels.delete(sessionId);
|
|
118
|
+
entry.release();
|
|
119
|
+
}
|
|
120
|
+
for (const sessionId of wanted) if (!channels.has(sessionId)) channels.set(sessionId, watchChannels(sessionId));
|
|
121
|
+
},
|
|
122
|
+
watchThread(sessionId, threadId) {
|
|
123
|
+
return keep(client, () => host.hold(_agimon_ai_po_core_sessionProtocol.PoThreadContract, {
|
|
124
|
+
sessionId,
|
|
125
|
+
threadId
|
|
126
|
+
}), (ref) => ref.frame.subscribe((frame) => {
|
|
127
|
+
if (frame) handlers.onThreadFrame(sessionId, threadId, frame);
|
|
128
|
+
}));
|
|
85
129
|
},
|
|
86
130
|
send(frame) {
|
|
87
|
-
const
|
|
88
|
-
if (
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
|
|
131
|
+
const { type, sessionId, payload } = frame;
|
|
132
|
+
if (typeof type !== "string" || typeof sessionId !== "string") return;
|
|
133
|
+
const watched = channels.get(sessionId)?.ref;
|
|
134
|
+
if (watched !== void 0) {
|
|
135
|
+
watched.receive({
|
|
136
|
+
type,
|
|
137
|
+
payload
|
|
138
|
+
}).catch(() => void 0);
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
const ref = host.hold(_agimon_ai_po_core_sessionProtocol.PoChannelsContract, { sessionId });
|
|
142
|
+
ref.receive({
|
|
143
|
+
type,
|
|
144
|
+
payload
|
|
145
|
+
}).catch(() => void 0).finally(() => ref.release());
|
|
146
|
+
},
|
|
147
|
+
async invokePlugin(call) {
|
|
148
|
+
if (!hub) throw new Error("The hub protocol is not connected.");
|
|
149
|
+
return hub.invoke(call);
|
|
150
|
+
},
|
|
151
|
+
async readHome(request, signal) {
|
|
152
|
+
if (!hub) throw new Error("The hub protocol is not connected.");
|
|
153
|
+
signal?.throwIfAborted();
|
|
154
|
+
const result = await hub.readHome(request);
|
|
155
|
+
signal?.throwIfAborted();
|
|
156
|
+
return result;
|
|
96
157
|
},
|
|
97
158
|
close() {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
159
|
+
stopUpdateWatch();
|
|
160
|
+
for (const entry of channels.values()) entry.release();
|
|
161
|
+
channels.clear();
|
|
162
|
+
releaseHub();
|
|
101
163
|
}
|
|
102
164
|
};
|
|
103
165
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocolHubSocket.cjs","names":["BACKGROUND_CONTEXT","createRemoteServiceBinding","DoomHubService","DoomPluginService","createClientServiceTransport","DOOM_COCKPIT_SERVER_ID","withCancel"],"sources":["../../../src/web/lib/protocolHubSocket.ts"],"sourcesContent":["import { DoomPluginService, type DoomPluginCall } from '@agimon-ai/po-core/pluginProtocol';\nimport { DOOM_COCKPIT_SERVER_ID, DoomHubService, type HubService } from '@agimon-ai/po-core/sessionProtocol';\nimport { createRemoteServiceBinding, type RemoteServiceBinding } from '@earendil-works/chord';\nimport { BACKGROUND_CONTEXT, withCancel } from '@earendil-works/chord/context';\nimport { createClientServiceTransport, type Client } from '@earendil-works/pi-client';\ntype Frame = Record<string, unknown>;\n\nexport interface SessionSocket {\n send(frame: object): void;\n invokePlugin(call: DoomPluginCall): Promise<unknown>;\n close(): void;\n}\n\nexport interface SessionSocketHandlers {\n onFrame(frame: Frame): void;\n onOpen(): void;\n onClose(): void;\n}\n\n/** Hub administration and plugin events share the session's authenticated Pi byte connection. */\nexport function createProtocolHubSocket(client: Client, handlers: SessionSocketHandlers): SessionSocket {\n let binding: RemoteServiceBinding | undefined;\n let service: HubService | undefined;\n let pluginService: DoomPluginService | undefined;\n let unsubscribe: (() => void) | undefined;\n let cancelOpening: ((reason?: unknown) => void) | undefined;\n let stopped = false;\n let generation = 0;\n const release = () => {\n generation += 1;\n cancelOpening?.(new Error('The hub binding was replaced.'));\n cancelOpening = undefined;\n service = undefined;\n pluginService = undefined;\n unsubscribe?.();\n unsubscribe = undefined;\n const previous = binding;\n binding = undefined;\n if (previous) void previous.dispose(BACKGROUND_CONTEXT).catch(() => undefined);\n };\n const open = async () => {\n if (service) handlers.onClose();\n release();\n const mine = generation;\n const next = createRemoteServiceBinding({\n services: [DoomHubService, DoomPluginService],\n transport: createClientServiceTransport(client, () => ({ serverId: DOOM_COCKPIT_SERVER_ID })),\n });\n binding = next;\n const opening = withCancel(BACKGROUND_CONTEXT);\n cancelOpening = opening.cancel;\n try {\n const hub = next.use(DoomHubService);\n await next.ready(opening.context);\n if (stopped || mine !== generation) return;\n service = hub;\n pluginService = next.use(DoomPluginService);\n let sequence = 0;\n const publish = (state: NonNullable<typeof hub.state.value>) => {\n for (const event of state.events) {\n if (event.sequence <= sequence) continue;\n if (event.sequence !== sequence + 1) throw new Error('Hub replay gap; reconnect required.');\n sequence = event.sequence;\n handlers.onFrame(event.frame);\n }\n };\n handlers.onOpen();\n if (hub.state.value) publish(hub.state.value);\n unsubscribe = hub.state.subscribe(publish);\n } catch {\n if (!stopped && mine === generation) {\n release();\n handlers.onClose();\n client.disconnect();\n }\n } finally {\n if (cancelOpening === opening.cancel) cancelOpening = undefined;\n // A stale opening may have been replaced before ready completed. If release\n // did not already own disposal, close this binding here.\n if (binding === next && (stopped || mine !== generation)) {\n binding = undefined;\n await next.dispose(BACKGROUND_CONTEXT).catch(() => undefined);\n }\n }\n };\n const stopWatch = client.onConnectionStateChange((change) => {\n if (stopped) return;\n if (change.state === 'connected') void open();\n else if (change.state === 'disconnected') {\n release();\n handlers.onClose();\n }\n });\n if (client.connected) void open();\n return {\n async invokePlugin(call) {\n const current = pluginService;\n if (!current) throw new Error('The hub protocol is not connected.');\n return current.invoke(call as Parameters<DoomPluginService['invoke']>[0], BACKGROUND_CONTEXT);\n },\n send(frame) {\n const current = service;\n if (!current) throw new Error('The hub protocol is not connected.');\n const mine = generation;\n void current.send(frame as Parameters<HubService['send']>[0], BACKGROUND_CONTEXT).catch(() => {\n if (!stopped && mine === generation && service === current) {\n handlers.onClose();\n client.disconnect();\n }\n });\n },\n close() {\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ract"],"sources":["../../../src/web/lib/protocolHubSocket.ts"],"sourcesContent":["import type { PoPluginCall } from '@agimon-ai/po-core/pluginProtocol';\nimport {\n isUpdateRequired,\n PoChannelsContract,\n PoHubContract,\n PoThreadContract,\n type ChannelsRef,\n type HomeRequest,\n type HomeSnapshot,\n type HubRef,\n type HubSessionView,\n type HubWorkspaceView,\n type ProtocolClient,\n} from '@agimon-ai/po-core/sessionProtocol';\nimport type { RefStatus } from '@earendil-works/chord';\n\ntype Frame = Record<string, unknown>;\n\nexport interface SessionSocket {\n /** Holds the extension channels of exactly these sessions. */\n watchSessions(sessionIds: Iterable<string>): void;\n /** Follows one child thread until the returned function is called. */\n watchThread(sessionId: string, threadId: string): () => void;\n /** Sends one extension channel frame `{ type, sessionId, payload }` to its session. */\n send(frame: object): void;\n invokePlugin(call: PoPluginCall): Promise<unknown>;\n readHome(request: HomeRequest, signal?: AbortSignal): Promise<HomeSnapshot>;\n close(): void;\n}\n\nexport interface SessionSocketHandlers {\n onSessions(sessions: HubSessionView[]): void;\n onWorkspaces(workspaces: HubWorkspaceView[]): void;\n /** A notification entry or agent dialog of any visible session, delivered once. */\n onNotice(sessionId: string, frame: Frame): void;\n /** An extension channel frame `{ type, sessionId, payload }` of a watched session. */\n onChannel(frame: Frame): void;\n onThreadFrame(sessionId: string, threadId: string, frame: Frame): void;\n onOpen(): void;\n onClose(): void;\n /** The server needs newer client code. Heard once, after `onClose`; the socket never reconnects. */\n onUpdateRequired?(): void;\n}\n\ninterface Held {\n readonly error: unknown;\n onStatus(listener: (status: RefStatus) => void): () => void;\n release(): void;\n}\n\n/**\n * Holds one object until the returned function is called. A reference the server forced\n * away after it was live (a Desktop claim) is held again; one refused outright stays released.\n * A refusal because this code is older than the server's stops the whole client instead.\n * Before the first link a hold has no route and Chord refuses it for good, so it waits for the link.\n */\nfunction keep<R extends Held>(client: ProtocolClient, hold: () => R, attach: (ref: R) => () => void): () => void {\n let released = false;\n let detach = (): void => undefined;\n const take = (): void => {\n if (!client.connected) {\n const stop = client.onConnectionStateChange(({ state }) => {\n if (state !== 'connected') return;\n stop();\n if (!released) take();\n });\n detach = stop;\n return;\n }\n const ref = hold();\n let live = false;\n const stopAttach = attach(ref);\n const stopStatus = ref.onStatus((status) => {\n if (status === 'live') live = true;\n if (status !== 'gone' || released) return;\n detach();\n if (isUpdateRequired(ref.error)) client.reportError(ref.error);\n else if (live) take();\n });\n detach = () => {\n stopStatus();\n stopAttach();\n ref.release();\n };\n };\n take();\n return () => {\n released = true;\n detach();\n };\n}\n\n/** Hub, channels and threads over the page's one Chord connection; references survive reconnects. */\nexport function createProtocolHubSocket(client: ProtocolClient, handlers: SessionSocketHandlers): SessionSocket {\n const { host } = client;\n let hub: HubRef | undefined;\n let updateRequired = false;\n const acknowledged = new Set<string>();\n const releaseHub = keep(\n client,\n () => host.hold(PoHubContract, {}),\n (ref) => {\n hub = ref;\n const stops = [\n ref.sessions.subscribe((sessions) => {\n if (sessions) handlers.onSessions(Object.values(sessions));\n }),\n ref.workspaces.subscribe((workspaces) => {\n if (workspaces) handlers.onWorkspaces(Object.values(workspaces));\n }),\n ref.pending.subscribe((notices) => {\n if (!notices) return;\n const current = new Set(notices.map((notice) => notice.id));\n for (const id of acknowledged) if (!current.has(id)) acknowledged.delete(id);\n for (const notice of notices) {\n if (acknowledged.has(notice.id)) continue;\n acknowledged.add(notice.id);\n handlers.onNotice(notice.sessionId, notice.frame);\n void ref.ackNotice({ id: notice.id }).catch(() => undefined);\n }\n }),\n ref.onStatus((status) => {\n if (updateRequired) return;\n if (status === 'live') handlers.onOpen();\n else if (status === 'loading' || status === 'gone') handlers.onClose();\n }),\n ];\n return () => {\n if (hub === ref) hub = undefined;\n for (const stop of stops) stop();\n };\n },\n );\n\n const channels = new Map<string, { ref: ChannelsRef | undefined; release: () => void }>();\n // The client closes its link after this; the hub's own close is folded into this one.\n const stopUpdateWatch = client.onConnectionStateChange(({ state }) => {\n if (state !== 'update_required' || updateRequired) return;\n updateRequired = true;\n handlers.onClose();\n handlers.onUpdateRequired?.();\n });\n const watchChannels = (sessionId: string) => {\n const entry: { ref: ChannelsRef | undefined; release: () => void } = { ref: undefined, release: () => undefined };\n entry.release = keep(\n client,\n () => host.hold(PoChannelsContract, { sessionId }),\n (ref) => {\n entry.ref = ref;\n let previous: Record<string, unknown> = {};\n const stop = ref.latest.subscribe((latest) => {\n if (!latest) return;\n for (const [type, payload] of Object.entries(latest))\n if (previous[type] !== payload) handlers.onChannel({ type, sessionId, payload });\n previous = latest;\n });\n return () => {\n if (entry.ref === ref) entry.ref = undefined;\n stop();\n };\n },\n );\n return entry;\n };\n\n return {\n watchSessions(sessionIds) {\n const wanted = new Set(sessionIds);\n for (const [sessionId, entry] of channels) {\n if (wanted.has(sessionId)) continue;\n channels.delete(sessionId);\n entry.release();\n }\n for (const sessionId of wanted) if (!channels.has(sessionId)) channels.set(sessionId, watchChannels(sessionId));\n },\n watchThread(sessionId, threadId) {\n return keep(\n client,\n () => host.hold(PoThreadContract, { sessionId, threadId }),\n (ref) =>\n ref.frame.subscribe((frame) => {\n if (frame) handlers.onThreadFrame(sessionId, threadId, frame);\n }),\n );\n },\n send(frame) {\n const { type, sessionId, payload } = frame as { type?: unknown; sessionId?: unknown; payload?: unknown };\n if (typeof type !== 'string' || typeof sessionId !== 'string') return;\n const watched = channels.get(sessionId)?.ref;\n if (watched !== undefined) {\n void watched.receive({ type, payload: payload as never }).catch(() => undefined);\n return;\n }\n // An unwatched session's channel is held just for this one frame.\n const ref = host.hold(PoChannelsContract, { sessionId });\n void ref\n .receive({ type, payload: payload as never })\n .catch(() => undefined)\n .finally(() => ref.release());\n },\n async invokePlugin(call) {\n if (!hub) throw new Error('The hub protocol is not connected.');\n return hub.invoke(call);\n },\n async readHome(request, signal) {\n if (!hub) throw new Error('The hub protocol is not connected.');\n signal?.throwIfAborted();\n const result = await hub.readHome(request);\n signal?.throwIfAborted();\n return result;\n },\n close() {\n stopUpdateWatch();\n for (const entry of channels.values()) entry.release();\n channels.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