@bevel-software/platform-core-frontend 0.15.1 → 0.19.0
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/THIRD-PARTY-NOTICES.md +2 -2
- package/package.json +3 -3
- package/src/core/CoreAppShell.tsx +16 -9
- package/src/core/__tests__/AppChrome.test.tsx +0 -3
- package/src/core/__tests__/events.test.ts +43 -0
- package/src/core/bootstrap.ts +11 -3
- package/src/core/events.ts +85 -3
- package/src/core/registry.ts +1 -1
- package/src/lib/__tests__/email.test.ts +44 -0
- package/src/lib/email.ts +37 -1
- package/src/modules/access/__tests__/ManageAccessDialog.add-row-picking.test.tsx +141 -0
- package/src/modules/access/__tests__/ManageAccessDialog.chip-truncation.test.tsx +204 -0
- package/src/modules/access/__tests__/ManageAccessDialog.download-read.test.tsx +234 -0
- package/src/modules/access/__tests__/ManageAccessDialog.edited-row-visible.test.tsx +160 -0
- package/src/modules/access/__tests__/ManageAccessDialog.placement.test.tsx +2 -2
- package/src/modules/access/__tests__/ManageAccessDialog.proposal.test.tsx +166 -0
- package/src/modules/access/__tests__/ManageAccessDialog.restrict.test.tsx +510 -0
- package/src/modules/access/__tests__/ManageAccessDialog.row-menu-axes.test.tsx +299 -0
- package/src/modules/access/__tests__/ManageAccessDialog.row-menu-width.test.tsx +226 -0
- package/src/modules/access/__tests__/ManageAccessDialog.test.tsx +721 -126
- package/src/modules/access/__tests__/ManageAccessDialog.unknown-email.test.tsx +314 -0
- package/src/modules/access/__tests__/manage-access-affordance.test.ts +14 -0
- package/src/modules/access/__tests__/tailwindDeclarations.ts +210 -0
- package/src/modules/access/api.ts +140 -6
- package/src/modules/access/components/ManageAccessDialog.tsx +1299 -561
- package/src/modules/access/manage-access-affordance.ts +17 -0
- package/src/modules/admin/__tests__/AddMemberInput.test.tsx +297 -0
- package/src/modules/admin/__tests__/AdminRolesPage.capabilities.test.tsx +2 -2
- package/src/modules/admin/__tests__/AdminRolesPage.fixed-admin.test.tsx +189 -0
- package/src/modules/admin/__tests__/AdminRolesPage.suggest.test.tsx +1 -1
- package/src/modules/admin/__tests__/ConnectionKeysPage.test.tsx +266 -0
- package/src/modules/admin/__tests__/DirectoryGroupsPage.suggest.test.tsx +182 -0
- package/src/modules/admin/__tests__/DirectoryGroupsPage.test.tsx +165 -14
- package/src/modules/admin/__tests__/UserAccountsPage.test.tsx +401 -4
- package/src/modules/admin/__tests__/group-members-path.test.ts +27 -0
- package/src/modules/admin/components/AddMemberInput.tsx +268 -0
- package/src/modules/admin/components/AdminRolesPage.tsx +97 -132
- package/src/modules/admin/components/ConnectionKeysPage.tsx +269 -0
- package/src/modules/admin/components/DirectoryGroupsPage.tsx +91 -39
- package/src/modules/admin/components/UserAccountsPage.tsx +271 -37
- package/src/modules/admin/components/connection-keys-grouping.ts +43 -0
- package/src/modules/admin/components/group-members-path.ts +32 -0
- package/src/modules/admin/services/connection-keys.api.ts +47 -0
- package/src/modules/admin/services/roles.api.ts +12 -1
- package/src/modules/auth/__tests__/AccountPage.test.tsx +50 -2
- package/src/modules/auth/components/AccountPage.tsx +73 -54
- package/src/modules/auth/components/LoginScreen.tsx +1 -0
- package/src/modules/auth/services/account.api.ts +78 -4
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.access-rules.test.tsx +144 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.binary.test.tsx +422 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.brings-itself-up-to-date.test.tsx +431 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.fork-point.test.tsx +193 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.initial-file.test.tsx +142 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.moved.test.tsx +202 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.test.tsx +205 -13
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.unreadable.test.tsx +271 -0
- package/src/modules/change-requests/__tests__/FileChangeBoxes.test.tsx +208 -0
- package/src/modules/change-requests/__tests__/apply-outcome-for-every-viewer.test.tsx +286 -0
- package/src/modules/change-requests/__tests__/propose.concurrent.test.ts +273 -0
- package/src/modules/change-requests/__tests__/readFailure.test.ts +122 -0
- package/src/modules/change-requests/__tests__/useCrFileDiffs.test.tsx +238 -0
- package/src/modules/change-requests/__tests__/useFileOnBranch.test.tsx +56 -1
- package/src/modules/change-requests/__tests__/useForkPointFile.test.tsx +79 -0
- package/src/modules/change-requests/components/BranchFilePreview.tsx +357 -0
- package/src/modules/change-requests/components/ChangeBox.tsx +31 -2
- package/src/modules/change-requests/components/ChangeRequestDialog.tsx +862 -72
- package/src/modules/change-requests/components/CrFileTree.tsx +74 -58
- package/src/modules/change-requests/components/FileChangeBoxes.tsx +19 -15
- package/src/modules/change-requests/hooks/useApplyChangeRequest.ts +41 -7
- package/src/modules/change-requests/hooks/useCrFileDiffs.ts +181 -23
- package/src/modules/change-requests/hooks/useFileOnBranch.ts +70 -7
- package/src/modules/change-requests/hooks/useForkPointFile.ts +77 -0
- package/src/modules/change-requests/services/change-requests.api.ts +57 -1
- package/src/modules/change-requests/services/denied-file.api.ts +53 -0
- package/src/modules/change-requests/services/propose.api.ts +97 -8
- package/src/modules/change-requests/utils/approval.ts +15 -0
- package/src/modules/change-requests/utils/author.ts +32 -0
- package/src/modules/change-requests/utils/readFailure.ts +110 -0
- package/src/modules/git/__tests__/FileHistoryPanel.test.tsx +20 -0
- package/src/modules/git/components/FileHistoryPanel.tsx +5 -0
- package/src/modules/git/components/PullRequestsForMe.tsx +51 -24
- package/src/modules/git/services/__tests__/error-messages.test.ts +29 -0
- package/src/modules/git/services/error-messages.ts +12 -0
- package/src/modules/git/services/pr-prompts.ts +5 -5
- package/src/modules/layout/__tests__/HeaderAlignment.test.tsx +401 -0
- package/src/modules/layout/__tests__/SidebarFooterGrid.test.tsx +286 -0
- package/src/modules/layout/__tests__/SidebarFrameResponsive.test.tsx +61 -0
- package/src/modules/layout/components/AppLayout.tsx +2 -0
- package/src/modules/layout/components/MobileChatLayout.tsx +4 -1
- package/src/modules/layout/components/ResizableThreePaneLayout.tsx +4 -1
- package/src/modules/layout/components/SidebarFrame.tsx +108 -3
- package/src/modules/library/__tests__/AddToPluginDialog.test.tsx +171 -5
- package/src/modules/library/__tests__/DeleteToolDialog.test.tsx +356 -0
- package/src/modules/library/__tests__/IntegrationsSetupReminder.test.tsx +60 -0
- package/src/modules/library/__tests__/LibraryCard.test.tsx +91 -10
- package/src/modules/library/__tests__/LibraryRoutes.test.tsx +242 -107
- package/src/modules/library/__tests__/LibrarySidebarMenu.test.tsx +103 -98
- package/src/modules/library/__tests__/LinkSkillPanel.test.tsx +20 -5
- package/src/modules/library/__tests__/LockedPluginView.test.tsx +97 -7
- package/src/modules/library/__tests__/NewPluginDialog.test.tsx +13 -4
- package/src/modules/library/__tests__/PersonalAddDialog.test.tsx +79 -3
- package/src/modules/library/__tests__/PersonalPluginPage.test.tsx +201 -0
- package/src/modules/library/__tests__/PluginExtras.test.tsx +100 -9
- package/src/modules/library/__tests__/PluginJoinRequests.test.tsx +60 -1
- package/src/modules/library/__tests__/PluginPage.test.tsx +258 -6
- package/src/modules/library/__tests__/PluginsSidebar.contextmenu.test.tsx +16 -56
- package/src/modules/library/__tests__/PluginsSidebar.test.tsx +155 -152
- package/src/modules/library/__tests__/PluginsSidebarMenu.test.tsx +16 -0
- package/src/modules/library/__tests__/SharedViaPlugins.test.tsx +106 -0
- package/src/modules/library/__tests__/SkillPage.test.tsx +386 -80
- package/src/modules/library/__tests__/SkillsTree.test.tsx +293 -4
- package/src/modules/library/__tests__/ToolConnectionSection.test.tsx +582 -71
- package/src/modules/library/__tests__/ToolPage.test.tsx +87 -4
- package/src/modules/library/__tests__/WorkspaceItemRoute.test.tsx +173 -26
- package/src/modules/library/__tests__/auth-harness.tsx +9 -9
- package/src/modules/library/__tests__/card-row-menu.test.tsx +320 -0
- package/src/modules/library/__tests__/library-data.mapping.test.tsx +98 -0
- package/src/modules/library/__tests__/library-data.stale.test.tsx +121 -28
- package/src/modules/library/__tests__/library-data.test.ts +7 -0
- package/src/modules/library/__tests__/library-paths.test.ts +47 -4
- package/src/modules/library/__tests__/link-membership.test.ts +13 -4
- package/src/modules/library/__tests__/name-with-badges.test.tsx +273 -0
- package/src/modules/library/__tests__/newSkillMarkdown.test.ts +30 -0
- package/src/modules/library/__tests__/owner-pill.test.tsx +357 -0
- package/src/modules/library/__tests__/pending-tools.test.tsx +400 -0
- package/src/modules/library/__tests__/plugin-entries.test.ts +122 -0
- package/src/modules/library/__tests__/plugin-summary.test.ts +36 -1
- package/src/modules/library/__tests__/status.test.ts +82 -2
- package/src/modules/library/__tests__/tools.api.test.ts +44 -1
- package/src/modules/library/components/AccessRequestsBanner.tsx +85 -47
- package/src/modules/library/components/AddDialogTabs.tsx +103 -0
- package/src/modules/library/components/AddToPluginDialog.tsx +74 -18
- package/src/modules/library/components/IntegrationsSetupReminder.tsx +59 -0
- package/src/modules/library/components/ItemActionsMenu.tsx +288 -0
- package/src/modules/library/components/LibraryCard.tsx +146 -45
- package/src/modules/library/components/LibraryLayout.tsx +119 -256
- package/src/modules/library/components/LibraryPage.tsx +172 -39
- package/src/modules/library/components/LinkSkillPanel.tsx +1 -3
- package/src/modules/library/components/LockedPluginView.tsx +62 -34
- package/src/modules/library/components/NameWithBadges.tsx +164 -0
- package/src/modules/library/components/NewPluginDialog.tsx +16 -2
- package/src/modules/library/components/PageActions.tsx +11 -9
- package/src/modules/library/components/{PendingSkillReview.tsx → PendingItemReview.tsx} +14 -7
- package/src/modules/library/components/PersonalAddDialog.tsx +68 -18
- package/src/modules/library/components/PersonalPluginPage.tsx +121 -22
- package/src/modules/library/components/PluginExtras.tsx +140 -17
- package/src/modules/library/components/PluginIndexRow.tsx +47 -12
- package/src/modules/library/components/PluginPage.tsx +157 -41
- package/src/modules/library/components/PluginRows.tsx +286 -0
- package/src/modules/library/components/PluginsSidebar.tsx +239 -263
- package/src/modules/library/components/PluginsSidebarMenu.tsx +26 -1
- package/src/modules/library/components/ShareButton.tsx +17 -0
- package/src/modules/library/components/SkillsTree.tsx +141 -28
- package/src/modules/library/components/TeamRoute.tsx +15 -0
- package/src/modules/library/components/__tests__/upload-notices-once-per-page.test.tsx +144 -0
- package/src/modules/library/components/plugin-page-parts.tsx +103 -17
- package/src/modules/library/components/skill-page/SharedViaPlugins.tsx +6 -12
- package/src/modules/library/components/skill-page/SkillFilePane.tsx +5 -0
- package/src/modules/library/components/skill-page/SkillPage.tsx +274 -122
- package/src/modules/library/components/tool-page/DeleteToolDialog.tsx +218 -0
- package/src/modules/library/components/tool-page/ToolConnectionSection.tsx +79 -178
- package/src/modules/library/components/tool-page/ToolPage.tsx +106 -16
- package/src/modules/library/components/tool-page/ToolVarRow.tsx +42 -41
- package/src/modules/library/hooks/__tests__/useLibraryData.test.ts +98 -0
- package/src/modules/library/hooks/useLibraryData.ts +92 -19
- package/src/modules/library/routes/LibraryRoutes.tsx +14 -11
- package/src/modules/library/routes/WorkspaceItemRoute.tsx +77 -27
- package/src/modules/library/routes/library-paths.ts +26 -28
- package/src/modules/library/services/library.api.ts +38 -20
- package/src/modules/library/services/plugins.api.ts +69 -8
- package/src/modules/library/services/teams.api.ts +15 -0
- package/src/modules/library/services/tools.api.ts +78 -0
- package/src/modules/library/state/library-data.tsx +170 -32
- package/src/modules/library/utils/personal-plugin.ts +13 -15
- package/src/modules/library/utils/plugin-entries.ts +134 -0
- package/src/modules/library/utils/plugin-summary.ts +75 -9
- package/src/modules/library/utils/status.ts +135 -33
- package/src/modules/onboarding/__tests__/creator-welcome.test.tsx +8 -1
- package/src/modules/onboarding/__tests__/onboarding.test.tsx +853 -760
- package/src/modules/onboarding/agent-clients.ts +55 -23
- package/src/modules/onboarding/components/ConnectAgentPill.tsx +5 -1
- package/src/modules/onboarding/components/WelcomePage.tsx +98 -62
- package/src/modules/pr/services/pr-merge.api.ts +2 -1
- package/src/modules/review/components/MarkdownDiffViewer.tsx +53 -8
- package/src/modules/review/components/ReviewPanel.tsx +15 -17
- package/src/modules/review/components/__tests__/MarkdownDiffViewer.test.tsx +64 -0
- package/src/modules/review/components/__tests__/ReviewPanel.test.tsx +25 -1
- package/src/modules/secrets-vault/components/ConnectToolsPage.tsx +454 -117
- package/src/modules/secrets-vault/components/SecretsPage.tsx +48 -7
- package/src/modules/secrets-vault/components/ToolSecretsPanel.tsx +84 -5
- package/src/modules/secrets-vault/components/__tests__/ConnectToolsPage.test.tsx +425 -0
- package/src/modules/secrets-vault/components/__tests__/SecretsPage.test.tsx +417 -82
- package/src/modules/secrets-vault/components/__tests__/ToolSecretsPanel.test.tsx +105 -0
- package/src/modules/secrets-vault/components/__tests__/connect-lists-what-the-banner-counted.test.tsx +407 -0
- package/src/modules/secrets-vault/probe/SavedKeyProbeResult.tsx +98 -0
- package/src/modules/secrets-vault/probe/__tests__/probe-verdict.test.ts +160 -0
- package/src/modules/secrets-vault/probe/probe-verdict.ts +108 -0
- package/src/modules/secrets-vault/probe/useSavedKeyProbe.ts +228 -0
- package/src/modules/secrets-vault/services/connect.api.ts +36 -5
- package/src/modules/secrets-vault/utils/connect-status.ts +98 -0
- package/src/modules/settings/components/ClaudeConnectionCard.tsx +9 -24
- package/src/modules/settings/components/ClaudeConnectionFields.tsx +23 -0
- package/src/modules/settings/components/DeploymentPage.tsx +10 -30
- package/src/modules/settings/components/MarketplaceSection.tsx +152 -0
- package/src/modules/settings/components/__tests__/DeploymentPage.test.tsx +67 -4
- package/src/modules/settings/components/__tests__/MarketplaceSection.test.tsx +325 -0
- package/src/modules/settings/components/__tests__/SettingsLayout.test.tsx +5 -5
- package/src/modules/settings/services/github-facade.api.ts +23 -0
- package/src/modules/settings/settings-nav-items.tsx +10 -2
- package/src/modules/setup/__tests__/setup.oidc.test.tsx +172 -0
- package/src/modules/setup/__tests__/setup.probe-refusal.test.tsx +123 -0
- package/src/modules/setup/__tests__/setup.test.tsx +497 -4
- package/src/modules/setup/__tests__/useSetupStatus.test.tsx +130 -0
- package/src/modules/setup/components/SetupGate.tsx +16 -16
- package/src/modules/setup/components/SetupScreen.tsx +521 -43
- package/src/modules/setup/hooks/useSetupStatus.ts +93 -0
- package/src/modules/setup/services/setup.api.ts +140 -3
- package/src/modules/setup/utils/__tests__/root-folders.test.ts +72 -0
- package/src/modules/setup/utils/root-folders.ts +46 -0
- package/src/modules/toolbar/assets/claude-setup/01-add-manually.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/02-add-configuration.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/03-connect-account.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/04-pick-instance.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/05-plugins-add.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/06-add-marketplace.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/07-paste-url-sync.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/08-install-plugins.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/09-select-repository.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/10-connector-not-added.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/11-add-custom-connector.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/README.md +68 -0
- package/src/modules/toolbar/components/AgentInstructionsCard.tsx +296 -0
- package/src/modules/toolbar/components/ClaudeMarketplaceCarousel.tsx +107 -0
- package/src/modules/toolbar/components/ClaudeRegistrationSteps.tsx +127 -0
- package/src/modules/toolbar/components/CoworkSetupSteps.tsx +100 -0
- package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +177 -118
- package/src/modules/toolbar/components/ScreenshotStep.tsx +77 -0
- package/src/modules/toolbar/components/SetupCarousel.tsx +177 -0
- package/src/modules/toolbar/components/__tests__/AgentInstructionsCard.test.tsx +370 -0
- package/src/modules/toolbar/components/__tests__/ExternalAgentAccessPage.test.tsx +542 -42
- package/src/modules/toolbar/components/__tests__/Toolbar.test.tsx +2 -2
- package/src/modules/toolbar/components/__tests__/claude-setup-shots.test.ts +104 -0
- package/src/modules/toolbar/components/claude-connector-slide.tsx +38 -0
- package/src/modules/toolbar/components/claude-setup-shots.ts +167 -0
- package/src/modules/toolbar/components/deployment-address.ts +29 -0
- package/src/modules/toolbar/components/setup-step-parts.tsx +35 -0
- package/src/modules/toolbar/services/__tests__/agent-instructions.api.test.ts +89 -0
- package/src/modules/toolbar/services/agent-instructions.api.ts +167 -0
- package/src/modules/toolbar/services/external-api-keys.api.ts +6 -0
- package/src/modules/workflow/state/ChangeRequestStaleBinder.tsx +43 -0
- package/src/modules/workflow/state/EventBusProvider.tsx +122 -11
- package/src/modules/workflow/state/__tests__/EventBusProvider.storage.test.tsx +87 -0
- package/src/modules/workflow/state/__tests__/EventBusProvider.watch.test.tsx +223 -0
- package/src/modules/workflow/state/event-bus.context.ts +10 -0
- package/src/modules/workspace/__tests__/testFixtures.ts +5 -3
- package/src/modules/workspace/components/FileExplorer.tsx +1295 -191
- package/src/modules/workspace/components/FileRoute.tsx +353 -36
- package/src/modules/workspace/components/FileViewer.tsx +166 -45
- package/src/modules/workspace/components/KbDocumentShell.tsx +50 -6
- package/src/modules/workspace/components/KbPageHeader.tsx +120 -55
- package/src/modules/workspace/components/TreeActionConfirm.tsx +350 -0
- package/src/modules/workspace/components/__tests__/FileExplorer.test.tsx +2473 -129
- package/src/modules/workspace/components/__tests__/FileRoute.test.tsx +731 -18
- package/src/modules/workspace/components/__tests__/FileViewer.test.tsx +331 -12
- package/src/modules/workspace/components/__tests__/KbDocumentShell.test.tsx +39 -0
- package/src/modules/workspace/components/__tests__/KbPageHeader.test.tsx +33 -20
- package/src/modules/workspace/components/renderers/DocxRenderer.tsx +4 -5
- package/src/modules/workspace/components/renderers/DownloadFileButton.tsx +13 -4
- package/src/modules/workspace/components/renderers/EmailRenderer.tsx +4 -3
- package/src/modules/workspace/components/renderers/HtmlRenderer.tsx +8 -14
- package/src/modules/workspace/components/renderers/ImageRenderer.tsx +75 -16
- package/src/modules/workspace/components/renderers/KbImage.tsx +180 -0
- package/src/modules/workspace/components/renderers/KbMarkdownView.tsx +22 -6
- package/src/modules/workspace/components/renderers/MarkdownRenderer.tsx +48 -22
- package/src/modules/workspace/components/renderers/PdfRenderer.tsx +4 -5
- package/src/modules/workspace/components/renderers/PptxRenderer.tsx +4 -3
- package/src/modules/workspace/components/renderers/XlsxRenderer.tsx +4 -3
- package/src/modules/workspace/components/renderers/__tests__/DocxRenderer.test.tsx +12 -0
- package/src/modules/workspace/components/renderers/__tests__/DownloadFileButton.test.tsx +57 -9
- package/src/modules/workspace/components/renderers/__tests__/EmailRenderer.test.tsx +13 -1
- package/src/modules/workspace/components/renderers/__tests__/ImageRenderer.test.tsx +163 -0
- package/src/modules/workspace/components/renderers/__tests__/KbMarkdownView.test.tsx +237 -0
- package/src/modules/workspace/components/renderers/__tests__/MarkdownRenderer.test.tsx +108 -14
- package/src/modules/workspace/components/renderers/__tests__/PptxRenderer.test.tsx +14 -1
- package/src/modules/workspace/components/renderers/__tests__/XlsxRenderer.test.tsx +16 -1
- package/src/modules/workspace/components/renderers/__tests__/rendererSelection.test.tsx +66 -1
- package/src/modules/workspace/components/renderers/index.ts +53 -2
- package/src/modules/workspace/components/renderers/kbMarkdownPipeline.tsx +25 -4
- package/src/modules/workspace/components/renderers/rendererWorkspace.ts +40 -0
- package/src/modules/workspace/hooks/__tests__/useImageRevision.test.tsx +174 -0
- package/src/modules/workspace/hooks/__tests__/useOpenChangeRequests.test.tsx +179 -1
- package/src/modules/workspace/hooks/__tests__/useWorkspaceImageResolver.test.tsx +122 -0
- package/src/modules/workspace/hooks/__tests__/useWorkspaceState.test.tsx +892 -7
- package/src/modules/workspace/hooks/useImageRevision.ts +101 -0
- package/src/modules/workspace/hooks/useMergedWorkspaceTree.ts +22 -3
- package/src/modules/workspace/hooks/useWorkspaceImageResolver.ts +55 -0
- package/src/modules/workspace/hooks/useWorkspaceState.ts +424 -66
- package/src/modules/workspace/routing/__tests__/kb-routes.test.tsx +279 -3
- package/src/modules/workspace/routing/kb-routes.ts +206 -29
- package/src/modules/workspace/services/__tests__/workspace.api.test.ts +57 -1
- package/src/modules/workspace/services/workspace.api.ts +57 -4
- package/src/modules/workspace/state/__tests__/applied-request-clears-pending.test.tsx +343 -0
- package/src/modules/workspace/state/__tests__/upload-lands-where-it-was-dropped.test.tsx +158 -0
- package/src/modules/workspace/state/open-change-requests.tsx +100 -12
- package/src/modules/workspace/state/workspace.context.ts +125 -19
- package/src/modules/workspace/utils/__tests__/file-trace.test.ts +73 -0
- package/src/modules/workspace/utils/__tests__/fileTree.test.ts +220 -6
- package/src/modules/workspace/utils/__tests__/pasteLink.test.ts +76 -0
- package/src/modules/workspace/utils/__tests__/treeConfirm.test.ts +364 -0
- package/src/modules/workspace/utils/__tests__/uploadError.test.ts +35 -0
- package/src/modules/workspace/utils/file-trace.ts +50 -0
- package/src/modules/workspace/utils/fileTree.ts +112 -36
- package/src/modules/workspace/utils/frontmatter.ts +8 -4
- package/src/modules/workspace/utils/pasteLink.ts +90 -0
- package/src/modules/workspace/utils/treeConfirm.ts +338 -0
- package/src/modules/workspace/utils/uploadError.ts +29 -0
- package/src/shared/__tests__/marketplace-url.test.ts +6 -1
- package/src/shared/components/Button.tsx +16 -2
- package/src/shared/components/Dialog.tsx +27 -11
- package/src/shared/components/Menu.tsx +13 -1
- package/src/shared/components/PageShell.tsx +13 -8
- package/src/shared/components/__tests__/primitives.test.tsx +116 -2
- package/src/shared/components/__tests__/useFocusHandoff.test.tsx +192 -0
- package/src/shared/components/index.ts +2 -0
- package/src/shared/components/useDismissableMenu.ts +32 -10
- package/src/shared/components/useFocusHandoff.ts +51 -0
- package/src/shared/components/useLatestRef.ts +28 -0
- package/src/shared/markdown/Markdown.tsx +12 -3
- package/src/shared/markdown/__tests__/escapeSpacesInLinkDestinations.test.ts +39 -0
- package/src/shared/markdown/hrefs.ts +50 -0
- package/src/shared/marketplace-url.ts +33 -5
- package/src/shared/mcp/ChatGptInstallLink.tsx +3 -3
- package/src/shared/mcp/ConnectionInstructions.tsx +38 -27
- package/src/shared/mcp/__tests__/connect-snippets.test.ts +3 -3
- package/src/shared/mcp/connect-snippets.ts +14 -9
- package/src/shared/mcp/index.ts +1 -1
- package/src/shared/theme/__tests__/header-band.test.ts +197 -0
- package/src/shared/theme/header.ts +75 -0
- package/src/shared/theme/measure.ts +7 -4
- package/src/shared/theme/tokens.css +25 -0
- package/src/modules/library/__tests__/PluginsIndexPage.test.tsx +0 -363
- package/src/modules/library/__tests__/PluginsSidebar.locked.test.tsx +0 -97
- package/src/modules/library/components/PluginsIndexPage.tsx +0 -270
- package/src/modules/update-check/__tests__/UpdateBanner.test.tsx +0 -126
- package/src/modules/update-check/components/UpdateBanner.tsx +0 -92
- package/src/modules/update-check/services/update-check.api.ts +0 -24
|
@@ -1,17 +1,26 @@
|
|
|
1
|
-
import { useMemo, useState } from 'react';
|
|
1
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
2
2
|
import { useNavigate } from 'react-router-dom';
|
|
3
|
+
import { DEFAULT_BRANCH, type FileTreeEntry } from '@bevel-software/platform-shared';
|
|
3
4
|
import '../library.css';
|
|
4
5
|
import { useLibrary, type LibraryItem } from '../state/library-data';
|
|
5
6
|
import { urlForLibraryItem } from '../routes/library-paths';
|
|
6
7
|
import { useWorkspace } from '../../workspace/state/workspace.context';
|
|
7
|
-
import { emptyMessageFor, filterLibraryItems, type LibraryFilter } from '../utils/status';
|
|
8
|
+
import { EVERYONE_TEAM, emptyMessageFor, filterLibraryItems, type LibraryFilter } from '../utils/status';
|
|
9
|
+
import { pluginEntriesFor } from '../utils/plugin-entries';
|
|
10
|
+
import { personalPluginName } from '../utils/personal-plugin';
|
|
8
11
|
import { Banner, TextField } from '../../../shared/components';
|
|
12
|
+
import { cn } from '../../../lib/utils';
|
|
13
|
+
import { HEADER_BAND, PAGE_HEADER_TESTID } from '../../../shared/theme/header';
|
|
14
|
+
import { ManageAccessDialog } from '../../access/components/ManageAccessDialog';
|
|
15
|
+
import { offersManageAccess } from '../../access/manage-access-affordance';
|
|
9
16
|
import { PluginItemSections } from './plugin-page-parts';
|
|
10
|
-
import {
|
|
17
|
+
import { PluginRows } from './PluginRows';
|
|
18
|
+
import { ManagedPluginRequests } from './ManagedPluginRequests';
|
|
19
|
+
import { PendingItemReview } from './PendingItemReview';
|
|
11
20
|
|
|
12
21
|
/**
|
|
13
|
-
* The Library gallery — the
|
|
14
|
-
*
|
|
22
|
+
* The Library gallery — Everything (the root), Owned by me, and a team's
|
|
23
|
+
* page: plugins as rows, then skills and tools as cards, under one search.
|
|
15
24
|
*
|
|
16
25
|
* This is CONTENT only: the sidebar, the flex shell and the data live in
|
|
17
26
|
* `LibraryLayout` + `LibraryProvider` above it. The filter arrives as a prop
|
|
@@ -19,6 +28,12 @@ import { PendingSkillReview } from './PendingSkillReview';
|
|
|
19
28
|
* anywhere, so a deep link, the back button and the sidebar can never disagree
|
|
20
29
|
* about what is selected.
|
|
21
30
|
*
|
|
31
|
+
* Plugins head the page because they are where things live and who they are
|
|
32
|
+
* for; the all-plugins index that used to be the root is this band. A team's
|
|
33
|
+
* page is the same page sliced by the server's answer for that team — what
|
|
34
|
+
* being in the group lets a person use — and never by anything the items
|
|
35
|
+
* themselves claim.
|
|
36
|
+
*
|
|
22
37
|
* Two things it does not have, and won't:
|
|
23
38
|
*
|
|
24
39
|
* - the LOADOUT. It came from a retired mock; the prototype has no such
|
|
@@ -37,7 +52,9 @@ function headingFor(filter: LibraryFilter): string {
|
|
|
37
52
|
case 'owned':
|
|
38
53
|
return 'Owned by me';
|
|
39
54
|
case 'ungrouped':
|
|
40
|
-
return
|
|
55
|
+
return personalPluginName();
|
|
56
|
+
case 'team':
|
|
57
|
+
return filter.group;
|
|
41
58
|
case 'group':
|
|
42
59
|
return filter.plugin;
|
|
43
60
|
}
|
|
@@ -48,19 +65,65 @@ export function LibraryPage({ filter }: { filter: LibraryFilter }) {
|
|
|
48
65
|
const navigate = useNavigate();
|
|
49
66
|
const { kbDirName } = useWorkspace();
|
|
50
67
|
const [query, setQuery] = useState('');
|
|
51
|
-
/** The
|
|
68
|
+
/** The proposal — skill or tool — being reviewed, if the reader opened one. */
|
|
52
69
|
const [reviewing, setReviewing] = useState<LibraryItem | null>(null);
|
|
70
|
+
/**
|
|
71
|
+
* What the gallery's ONE access dialog is open on — the folder of whichever
|
|
72
|
+
* card or row the reader chose Share from. One instance for both bands,
|
|
73
|
+
* exactly as `SkillPage` keeps one for its title row and its request banner:
|
|
74
|
+
* two dialogs would be two copies of the same state, and only one of them
|
|
75
|
+
* can be open anyway.
|
|
76
|
+
*/
|
|
77
|
+
const [manageTarget, setManageTarget] = useState<FileTreeEntry | null>(null);
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* A repo-relative folder as the access dialog addresses it — the same entry
|
|
81
|
+
* the explorer's right-click hands over, and the same one the skill page
|
|
82
|
+
* builds for its Share. Null until the KB directory has resolved: a
|
|
83
|
+
* half-built path would manage the wrong folder, or the KB root, so a page
|
|
84
|
+
* that does not have it yet offers no Share at all.
|
|
85
|
+
*/
|
|
86
|
+
const folderTarget = useCallback(
|
|
87
|
+
(folder: string): FileTreeEntry | null => {
|
|
88
|
+
if (!kbDirName) return null;
|
|
89
|
+
const entry: FileTreeEntry = {
|
|
90
|
+
name: folder.split('/').pop() ?? folder,
|
|
91
|
+
relativePath: `${kbDirName}/${folder}`,
|
|
92
|
+
type: 'directory',
|
|
93
|
+
};
|
|
94
|
+
return offersManageAccess(entry) ? entry : null;
|
|
95
|
+
},
|
|
96
|
+
[kbDirName],
|
|
97
|
+
);
|
|
98
|
+
const shareFolder = useCallback(
|
|
99
|
+
(folder: string) => setManageTarget(folderTarget(folder)),
|
|
100
|
+
[folderTarget],
|
|
101
|
+
);
|
|
53
102
|
|
|
54
103
|
const visible = useMemo(
|
|
55
|
-
() => filterLibraryItems(data.items, filter, query),
|
|
56
|
-
[data.items, filter, query],
|
|
104
|
+
() => filterLibraryItems(data.items, filter, query, data.teams),
|
|
105
|
+
[data.items, filter, query, data.teams],
|
|
106
|
+
);
|
|
107
|
+
const personalLabel = personalPluginName();
|
|
108
|
+
const plugins = useMemo(
|
|
109
|
+
() => pluginEntriesFor(data.items, data.pluginSummaries, filter, data.teams, query, personalLabel),
|
|
110
|
+
[data.items, data.pluginSummaries, filter, data.teams, query, personalLabel],
|
|
57
111
|
);
|
|
112
|
+
const count = plugins.length + visible.length;
|
|
113
|
+
// A team the server LISTED NOTHING LIKE is not a team — a stale link, a
|
|
114
|
+
// renamed group — and the page says so instead of showing an empty slice
|
|
115
|
+
// as fact. Only once the list has arrived, and only when it arrived: a
|
|
116
|
+
// pending request has no list yet, and a failed one is "we could not
|
|
117
|
+
// ask", which is not "there is no such team".
|
|
118
|
+
const teamsSettled = filter.kind === 'team' && !data.teamsLoading && data.teamsError === null;
|
|
119
|
+
const unknownTeam = teamsSettled && !data.teams.some((t) => t.name === filter.group);
|
|
58
120
|
|
|
59
121
|
/**
|
|
60
122
|
* Both kinds open a PAGE now — the skill page landed alongside the tool one.
|
|
61
|
-
* A
|
|
62
|
-
*
|
|
63
|
-
* change request instead, which is the only thing there is to read
|
|
123
|
+
* A PROPOSAL is the exception, skill or tool alike: it has no page, because
|
|
124
|
+
* both pages read the default branch and the file is not on it yet. Its card
|
|
125
|
+
* opens the change request instead, which is the only thing there is to read
|
|
126
|
+
* — and the reason a Proposed card can never be opened AS the thing.
|
|
64
127
|
*/
|
|
65
128
|
function openItem(item: LibraryItem) {
|
|
66
129
|
if (item.pending) {
|
|
@@ -72,21 +135,44 @@ export function LibraryPage({ filter }: { filter: LibraryFilter }) {
|
|
|
72
135
|
|
|
73
136
|
return (
|
|
74
137
|
<>
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
138
|
+
{/* The title bar, on the band the sidebar's header row is also on. The
|
|
139
|
+
count and the org-wide note used to share a column with the heading
|
|
140
|
+
INSIDE this row, which made the row as tall as whatever prose it was
|
|
141
|
+
carrying — a height no other page could match. They read below it
|
|
142
|
+
now, where they always looked like they were. */}
|
|
143
|
+
<div data-testid={PAGE_HEADER_TESTID} className={cn(HEADER_BAND, 'gap-4')}>
|
|
144
|
+
<h1 className="min-w-0 truncate text-display font-semibold" title={headingFor(filter)}>
|
|
145
|
+
{headingFor(filter)}
|
|
146
|
+
</h1>
|
|
82
147
|
<TextField
|
|
83
|
-
className="ml-auto w-64"
|
|
84
|
-
placeholder="Search
|
|
85
|
-
aria-label="Search
|
|
148
|
+
className="ml-auto w-64 flex-none"
|
|
149
|
+
placeholder="Search"
|
|
150
|
+
aria-label="Search"
|
|
86
151
|
value={query}
|
|
87
152
|
onChange={(e) => setQuery(e.target.value)}
|
|
88
153
|
/>
|
|
89
154
|
</div>
|
|
155
|
+
<p className="mt-0.5 text-ui text-ink-muted">
|
|
156
|
+
{data.loading ? '…' : `${count} ${count === 1 ? 'item' : 'items'}`}
|
|
157
|
+
</p>
|
|
158
|
+
{/* Everyone is not a group but the organisation: say what the page
|
|
159
|
+
holds, because the name alone reads like one more team. Only
|
|
160
|
+
once the list has settled and names it — while it loads, or
|
|
161
|
+
when it failed, the state below is the whole story. */}
|
|
162
|
+
{filter.kind === 'team' && filter.group === EVERYONE_TEAM && teamsSettled && !unknownTeam && (
|
|
163
|
+
<p className="mt-2 max-w-prose text-ui text-ink-muted">
|
|
164
|
+
Org-wide: what every signed-in person and their agents can use, with no group or role needed.
|
|
165
|
+
</p>
|
|
166
|
+
)}
|
|
167
|
+
|
|
168
|
+
{/* Somebody asking to join one of the plugins is the news on the page
|
|
169
|
+
the Library opens on — the one place the ask is certain to be seen.
|
|
170
|
+
Renders nothing when nothing pends. */}
|
|
171
|
+
{filter.kind === 'all' && (
|
|
172
|
+
<div className="mt-5 empty:mt-0">
|
|
173
|
+
<ManagedPluginRequests />
|
|
174
|
+
</div>
|
|
175
|
+
)}
|
|
90
176
|
|
|
91
177
|
<div className="mt-5" />
|
|
92
178
|
|
|
@@ -99,36 +185,83 @@ export function LibraryPage({ filter }: { filter: LibraryFilter }) {
|
|
|
99
185
|
</Banner>
|
|
100
186
|
) : data.loading ? (
|
|
101
187
|
<div className="py-16 text-center text-ui text-ink-faint">Loading the library…</div>
|
|
102
|
-
) :
|
|
188
|
+
) : filter.kind === 'team' && data.teamsLoading ? (
|
|
189
|
+
<div className="py-16 text-center text-ui text-ink-faint">Loading teams…</div>
|
|
190
|
+
) : filter.kind === 'team' && data.teamsError ? (
|
|
191
|
+
<Banner role="alert" tone="danger">
|
|
192
|
+
{data.teamsError}
|
|
193
|
+
<button type="button" className="ml-3 font-semibold underline" onClick={data.reloadPlugins}>
|
|
194
|
+
Try again
|
|
195
|
+
</button>
|
|
196
|
+
</Banner>
|
|
197
|
+
) : unknownTeam ? (
|
|
103
198
|
<div className="py-16 text-center text-ui text-ink-faint">
|
|
104
|
-
{
|
|
199
|
+
{`There's no team called ${filter.kind === 'team' ? filter.group : ''}.`}
|
|
105
200
|
</div>
|
|
106
201
|
) : (
|
|
107
|
-
// Skills and tools, split — the same two bands a plugin page has.
|
|
108
|
-
// One undifferentiated grid made you read every card's body to learn
|
|
109
|
-
// what kind of thing it was; the heading does that now, once, for a
|
|
110
|
-
// whole band. A band with nothing in it is dropped rather than shown
|
|
111
|
-
// empty: this is a search result, not an inventory of what could be.
|
|
112
202
|
<div className="pb-14">
|
|
113
|
-
<
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
hideEmpty
|
|
118
|
-
emptySkills=""
|
|
203
|
+
<PluginRows
|
|
204
|
+
entries={plugins}
|
|
205
|
+
showCreate={filter.kind === 'all'}
|
|
206
|
+
onShare={kbDirName ? shareFolder : undefined}
|
|
119
207
|
/>
|
|
208
|
+
{visible.length === 0 && plugins.length === 0 ? (
|
|
209
|
+
<div className="py-16 text-center text-ui text-ink-faint">
|
|
210
|
+
{emptyMessageFor(filter, query)}
|
|
211
|
+
</div>
|
|
212
|
+
) : (
|
|
213
|
+
// Skills and tools, split — the same two bands a plugin page has.
|
|
214
|
+
// One undifferentiated grid made you read every card's body to learn
|
|
215
|
+
// what kind of thing it was; the heading does that now, once, for a
|
|
216
|
+
// whole band. A band with nothing in it is dropped rather than shown
|
|
217
|
+
// empty: this is a search result, not an inventory of what could be.
|
|
218
|
+
<PluginItemSections
|
|
219
|
+
skillItems={visible.filter((i) => i.kind === 'skill')}
|
|
220
|
+
toolItems={visible.filter((i) => i.kind === 'integration')}
|
|
221
|
+
onOpen={openItem}
|
|
222
|
+
// A skill's rules live on its own folder — the same folder the
|
|
223
|
+
// skill page's Share opens. Tools get none: access to a tool is
|
|
224
|
+
// decided at the plugin that carries it.
|
|
225
|
+
onShare={kbDirName ? (item) => shareFolder(item.path) : undefined}
|
|
226
|
+
hideEmpty
|
|
227
|
+
emptySkills=""
|
|
228
|
+
/>
|
|
229
|
+
)}
|
|
120
230
|
</div>
|
|
121
231
|
)}
|
|
122
232
|
|
|
233
|
+
{manageTarget && (
|
|
234
|
+
<ManageAccessDialog
|
|
235
|
+
// Keyed on the path, so retargeting at an ancestor remounts it
|
|
236
|
+
// against that folder — the explorer's arrangement exactly.
|
|
237
|
+
key={manageTarget.relativePath}
|
|
238
|
+
// The Library speaks the DEFAULT branch: the gallery lists what is
|
|
239
|
+
// on it, so the rules it shares are edited where it read them,
|
|
240
|
+
// whatever branch the ambient workspace happens to be on. Same
|
|
241
|
+
// choice the skill page's Share makes.
|
|
242
|
+
workspaceId={encodeURIComponent(DEFAULT_BRANCH)}
|
|
243
|
+
entry={manageTarget}
|
|
244
|
+
onManageAncestor={setManageTarget}
|
|
245
|
+
onClose={() => {
|
|
246
|
+
setManageTarget(null);
|
|
247
|
+
// Granting can change what the reader — or a plugin's members —
|
|
248
|
+
// can see, so both witnesses are re-read: the catalog and the
|
|
249
|
+
// plugin index.
|
|
250
|
+
data.reload();
|
|
251
|
+
data.reloadPlugins();
|
|
252
|
+
}}
|
|
253
|
+
/>
|
|
254
|
+
)}
|
|
255
|
+
|
|
123
256
|
{reviewing && (
|
|
124
|
-
<
|
|
257
|
+
<PendingItemReview
|
|
125
258
|
item={reviewing}
|
|
126
259
|
onClose={() => setReviewing(null)}
|
|
127
260
|
onResolved={() => {
|
|
128
261
|
setReviewing(null);
|
|
129
|
-
// The skill leaves the review shelf and
|
|
130
|
-
// same reload
|
|
131
|
-
// twice in the frame between them.
|
|
262
|
+
// The proposal — skill or tool alike — leaves the review shelf and
|
|
263
|
+
// joins the catalog by the same reload: one load answers both, so
|
|
264
|
+
// the card cannot appear twice in the frame between them.
|
|
132
265
|
data.reload();
|
|
133
266
|
}}
|
|
134
267
|
/>
|
|
@@ -41,9 +41,7 @@ export function LinkSkillPanel({
|
|
|
41
41
|
const candidates = useMemo(() => {
|
|
42
42
|
const q = query.trim().toLowerCase();
|
|
43
43
|
return items
|
|
44
|
-
|
|
45
|
-
// server refuses them too, this just keeps them out of the list.
|
|
46
|
-
.filter((i): i is LibraryItem => i.kind === 'skill' && !i.pending && i.lifecycle !== 'retired' && !isInPlugin(i, plugin))
|
|
44
|
+
.filter((i): i is LibraryItem => i.kind === 'skill' && !i.pending && !isInPlugin(i, plugin))
|
|
47
45
|
.filter((i) => !q || i.name.toLowerCase().includes(q) || i.description.toLowerCase().includes(q))
|
|
48
46
|
.sort((a, b) => a.name.localeCompare(b.name));
|
|
49
47
|
}, [items, plugin, query]);
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { cn } from '../../../lib/utils';
|
|
3
|
+
import { HEADER_BAND, PAGE_HEADER_TESTID } from '../../../shared/theme/header';
|
|
3
4
|
import { Badge, Button, Surface } from '../../../shared/components';
|
|
4
|
-
import {
|
|
5
|
-
import { ownersTextOf, primaryFolderOf } from '../utils/plugin-summary';
|
|
5
|
+
import { adminNamesOf, ownersTextOf, primaryFolderOf } from '../utils/plugin-summary';
|
|
6
6
|
import { AlreadyReadableError, requestPluginAccess, type PluginSummary } from '../services/plugins.api';
|
|
7
7
|
import { firstNames, joinNames } from '../utils/names';
|
|
8
8
|
import { useLibraryToast } from '../state/toast.context';
|
|
9
9
|
import { LockGlyph } from './LockGlyph';
|
|
10
|
+
import { PluginBreadcrumb } from './plugin-page-parts';
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* A plugin you cannot read, as a place you can still stand in.
|
|
@@ -22,6 +23,16 @@ import { LockGlyph } from './LockGlyph';
|
|
|
22
23
|
* It is the SAME frame as the member view — breadcrumb, h1, run-by lede — so
|
|
23
24
|
* the two never read as different products. Only the middle changes.
|
|
24
25
|
*
|
|
26
|
+
* ASKING HAS THREE STATES, and the button carries two of them. It reads
|
|
27
|
+
* "Requesting…" and refuses further clicks from the moment it is pressed
|
|
28
|
+
* until the server answers; the "Requested" card replaces it on that answer,
|
|
29
|
+
* which the server gives as soon as it has RECORDED the request rather than
|
|
30
|
+
* once the change request exists. If the git work that follows the answer
|
|
31
|
+
* fails, the next load has `requestFailure` set and no request standing, so
|
|
32
|
+
* the button is back with a sentence above it naming what went wrong —
|
|
33
|
+
* pressing it again continues the recorded request rather than opening a
|
|
34
|
+
* second one.
|
|
35
|
+
*
|
|
25
36
|
* `Manage access` is the escape hatch for a locked-out platform Admin. Admin
|
|
26
37
|
* rescue applies to WRITING `access.md`, not to reading the folder, so an Admin
|
|
27
38
|
* can genuinely be locked out of a plugin they are nevertheless the right person
|
|
@@ -50,6 +61,10 @@ export function LockedPluginView({ plugin, onRequested, onUnlocked, onManage }:
|
|
|
50
61
|
const adminsText = ownersTextOf(plugin);
|
|
51
62
|
const primaryFolder = primaryFolderOf(plugin);
|
|
52
63
|
const pending = plugin.hasRequested || requested;
|
|
64
|
+
// The server could not finish the last request. It says so only while there
|
|
65
|
+
// is no request standing — `hasRequested` and this are never both true —
|
|
66
|
+
// so the sentence always sits above a button the person can press again.
|
|
67
|
+
const failure = pending ? null : (plugin.requestFailure ?? null);
|
|
53
68
|
|
|
54
69
|
async function request() {
|
|
55
70
|
setRequesting(true);
|
|
@@ -79,18 +94,20 @@ export function LockedPluginView({ plugin, onRequested, onUnlocked, onManage }:
|
|
|
79
94
|
|
|
80
95
|
return (
|
|
81
96
|
<div className="pb-14">
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
97
|
+
{/* The same band every other page title bar is on, so a plugin you
|
|
98
|
+
cannot open still lines its heading up with the nav beside it — and
|
|
99
|
+
the page's FIRST row, with the breadcrumb on the band rather than
|
|
100
|
+
above it, for the same reason. `PluginBreadcrumb` is the one an
|
|
101
|
+
openable plugin page uses; a locked page is still a plugin page, and
|
|
102
|
+
two copies of one trail drift the first time either is touched. */}
|
|
103
|
+
<div data-testid={PAGE_HEADER_TESTID} className={cn(HEADER_BAND, 'gap-2.5')}>
|
|
104
|
+
<PluginBreadcrumb />
|
|
105
|
+
<h1
|
|
106
|
+
className="min-w-0 truncate text-display font-semibold"
|
|
107
|
+
title={plugin.displayName || plugin.name}
|
|
108
|
+
>
|
|
88
109
|
{plugin.displayName || plugin.name}
|
|
89
|
-
</
|
|
90
|
-
</nav>
|
|
91
|
-
|
|
92
|
-
<div className="mt-1.5 flex items-center gap-2.5">
|
|
93
|
-
<h1 className="text-display font-semibold">{plugin.displayName || plugin.name}</h1>
|
|
110
|
+
</h1>
|
|
94
111
|
<Badge tone="outline" size="sm">
|
|
95
112
|
<LockGlyph className="size-3 shrink-0" />
|
|
96
113
|
Locked
|
|
@@ -103,6 +120,22 @@ export function LockedPluginView({ plugin, onRequested, onUnlocked, onManage }:
|
|
|
103
120
|
for access; a name would tell you what is inside. */}
|
|
104
121
|
<p className="mt-1 text-ui text-ink-muted">{countsLine(plugin)}</p>
|
|
105
122
|
|
|
123
|
+
{/* The in-flight word for assistive tech, matching `LinkSkillPanel`.
|
|
124
|
+
The button says "Requesting…" too, but pressing it disables it and a
|
|
125
|
+
disabled button drops focus, so that label change is never read out.
|
|
126
|
+
The acknowledgement is the whole point of this ticket, and it has to
|
|
127
|
+
reach somebody who cannot see the label.
|
|
128
|
+
|
|
129
|
+
`pending`, not `requesting`, is what ends it. The success path never
|
|
130
|
+
clears `requesting` — deliberately, so the button cannot flicker back
|
|
131
|
+
to life between the answer and the swap to the Requested card — which
|
|
132
|
+
left this region presenting "Requesting access to …" for as long as
|
|
133
|
+
the page stayed up. A screen-reader user arriving at the region after
|
|
134
|
+
the card had rendered was told the request was still going. */}
|
|
135
|
+
<span role="status" aria-live="polite" aria-label="Request progress" className="sr-only">
|
|
136
|
+
{requesting && !pending ? `Requesting access to ${plugin.displayName || plugin.name}…` : ''}
|
|
137
|
+
</span>
|
|
138
|
+
|
|
106
139
|
<div className="mt-5">
|
|
107
140
|
{pending ? (
|
|
108
141
|
<Surface tone="sunken" radius="lg" elevation="none" padded className="max-w-lg">
|
|
@@ -111,9 +144,21 @@ export function LockedPluginView({ plugin, onRequested, onUnlocked, onManage }:
|
|
|
111
144
|
</p>
|
|
112
145
|
</Surface>
|
|
113
146
|
) : (
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
147
|
+
<>
|
|
148
|
+
{failure && (
|
|
149
|
+
<p className="mb-2.5 max-w-lg text-body text-ink-muted">
|
|
150
|
+
{`Your request to join ${plugin.displayName || plugin.name} could not be sent: ${failure}. Try again.`}
|
|
151
|
+
</p>
|
|
152
|
+
)}
|
|
153
|
+
{/* The label is the acknowledgement. Nothing else on the page can
|
|
154
|
+
say "we heard you" in the render that follows the click — the
|
|
155
|
+
server's answer is a round-trip away, and the whole reason the
|
|
156
|
+
click used to look like a freeze is that this button greyed out
|
|
157
|
+
and kept its word. */}
|
|
158
|
+
<Button variant="primary" disabled={requesting} onClick={() => void request()}>
|
|
159
|
+
{requesting ? 'Requesting…' : 'Subscribe to this plugin'}
|
|
160
|
+
</Button>
|
|
161
|
+
</>
|
|
117
162
|
)}
|
|
118
163
|
</div>
|
|
119
164
|
|
|
@@ -140,20 +185,3 @@ function countsLine(plugin: Pick<PluginSummary, 'skillCount' | 'toolCount'>): st
|
|
|
140
185
|
return `${skills} · ${tools}. Visible once you have access.`;
|
|
141
186
|
}
|
|
142
187
|
|
|
143
|
-
/**
|
|
144
|
-
* The people `ownersTextOf` names, as a list.
|
|
145
|
-
*
|
|
146
|
-
* Mirrors that helper's chain exactly — owners, else writers, else nobody — so
|
|
147
|
-
* the sentence and the count of subjects in it can never disagree. It is a
|
|
148
|
-
* separate function only because the toast needs the NAMES (to take first
|
|
149
|
-
* names) and the verb needs the COUNT, and prose gives back neither.
|
|
150
|
-
*/
|
|
151
|
-
function adminNamesOf(plugin: Pick<PluginSummary, 'owners' | 'writers'>): string[] {
|
|
152
|
-
const owners = [...plugin.owners.users.map((u) => u.name), ...plugin.owners.roles];
|
|
153
|
-
const named = owners.filter((s) => s.length > 0);
|
|
154
|
-
if (named.length > 0) return named;
|
|
155
|
-
return [...plugin.writers.users.map((u) => u.name), ...plugin.writers.roles].filter(
|
|
156
|
-
(s) => s.length > 0,
|
|
157
|
-
);
|
|
158
|
-
}
|
|
159
|
-
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { cn } from '../../../lib/utils';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* How much of the name survives when something else is sharing its line.
|
|
6
|
+
*
|
|
7
|
+
* The bug this exists for: a card's header row put a `truncate` name next to
|
|
8
|
+
* `shrink-0` badges, so the badges took whatever width they wanted and the
|
|
9
|
+
* name paid for all of it — a 236px card showed "di…" beside four pills that
|
|
10
|
+
* each said less than the word they had crowded out.
|
|
11
|
+
*
|
|
12
|
+
* `ch` rather than a pixel count, because the thing being protected is a
|
|
13
|
+
* number of CHARACTERS: the floor has to mean the same amount of readable
|
|
14
|
+
* name whatever size the row is set in, and a card's name (`lede`) and a page
|
|
15
|
+
* title (`display`) are not the same size. 12 is the ticket's number. It does
|
|
16
|
+
* not promise a whole name — no floor can, against a name of any length — it
|
|
17
|
+
* promises enough of one to tell the cards in a grid apart, which is the
|
|
18
|
+
* question a grid is actually scanned for.
|
|
19
|
+
*
|
|
20
|
+
* Exported so the tests can name it rather than re-typing the class.
|
|
21
|
+
*/
|
|
22
|
+
export const NAME_MIN_WIDTH = 'min-w-[12ch]';
|
|
23
|
+
|
|
24
|
+
export interface NameWithBadgesProps {
|
|
25
|
+
/**
|
|
26
|
+
* The full name, as text. It is always in the DOM in full — the truncation
|
|
27
|
+
* is `text-overflow`, so a screen reader reads the whole thing — and it is
|
|
28
|
+
* repeated in `title` for the sighted reader who cannot.
|
|
29
|
+
*/
|
|
30
|
+
name: string;
|
|
31
|
+
/**
|
|
32
|
+
* The chips that qualify the name — `Owner`, `Linked`, `MCP server`.
|
|
33
|
+
* ABSENT, not an empty fragment, when there are none: whether anything is
|
|
34
|
+
* competing with the name for the row is what decides whether the name is
|
|
35
|
+
* given a floor, and `<></>` cannot be told apart from three pills.
|
|
36
|
+
*/
|
|
37
|
+
badges?: ReactNode;
|
|
38
|
+
/**
|
|
39
|
+
* A mark that belongs to the name — a tool's logo.
|
|
40
|
+
*
|
|
41
|
+
* It does NOT earn the name a floor, and the distinction is the one this
|
|
42
|
+
* component got wrong first time round. A badge can be moved: when the
|
|
43
|
+
* floor and the badges stop fitting, the badges take a second line and give
|
|
44
|
+
* the whole row back to the name. A mark cannot — it is fixed width, it sits
|
|
45
|
+
* on the name's own line, and no floor can conjure the space it is holding.
|
|
46
|
+
* A floor granted for a mark is therefore a floor with nothing to take the
|
|
47
|
+
* space back FROM, which is an overflow with extra steps.
|
|
48
|
+
*/
|
|
49
|
+
leading?: ReactNode;
|
|
50
|
+
/**
|
|
51
|
+
* Whether the badges may take a second line. True everywhere the row is
|
|
52
|
+
* allowed to grow, which is every list and every card.
|
|
53
|
+
*
|
|
54
|
+
* `false` is for a row whose height is a contract the row does not own —
|
|
55
|
+
* the tool page's title bar is `HEADER_BAND`, exactly as tall as the
|
|
56
|
+
* sidebar's header row beside it, and a second line there does not make the
|
|
57
|
+
* band taller, it hangs out of the bottom of it. Such a caller owes the row
|
|
58
|
+
* an `overflow-hidden`: with nowhere to wrap to, the only other way out is
|
|
59
|
+
* across whatever is beside it.
|
|
60
|
+
*/
|
|
61
|
+
wrap?: boolean;
|
|
62
|
+
/** Typography for the name itself — the caller's `text-lede`/`text-display`. */
|
|
63
|
+
nameClassName?: string;
|
|
64
|
+
/**
|
|
65
|
+
* The gap between everything on the row. A prop because the page header
|
|
66
|
+
* sets its band on `gap-4` and a card sets its row on `gap-2`, and the gap
|
|
67
|
+
* between a name and its badges is not a different measurement from the gap
|
|
68
|
+
* between a logo and its name.
|
|
69
|
+
*/
|
|
70
|
+
gap?: string;
|
|
71
|
+
className?: string;
|
|
72
|
+
/**
|
|
73
|
+
* What the name element is. A page's title is an `h1`; a card's and a row's
|
|
74
|
+
* name is a `span`, because the card is already a button with an accessible
|
|
75
|
+
* name and a heading inside it would announce a second one.
|
|
76
|
+
*/
|
|
77
|
+
as?: 'span' | 'h1';
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* A name, and the things that share its line, laid out so the NAME wins.
|
|
82
|
+
*
|
|
83
|
+
* Two rules, and the second is the one that was missing:
|
|
84
|
+
*
|
|
85
|
+
* 1. The name truncates with an ellipsis and carries its full self in
|
|
86
|
+
* `title` — which the card already did.
|
|
87
|
+
* 2. Below a floor it stops giving way and the badges WRAP UNDER IT instead
|
|
88
|
+
* — which nothing did, and which is why a narrow card said "di…".
|
|
89
|
+
*
|
|
90
|
+
* The mechanics, because they are not guessable from the class list:
|
|
91
|
+
*
|
|
92
|
+
* The row is `flex-wrap`, and its children are FLAT — mark, name, badge
|
|
93
|
+
* group, all siblings. The flatness is load-bearing. Wrapping the mark and
|
|
94
|
+
* the name in an intermediate group reads better and does not work: that
|
|
95
|
+
* group would be a flex item with `min-width: auto`, whose content-based
|
|
96
|
+
* minimum is the full width of a `whitespace-nowrap` name, so the group would
|
|
97
|
+
* refuse to shrink and the name would never truncate at all. The usual cure,
|
|
98
|
+
* `min-w-0` on the group, throws away the floor in the same breath — a floor
|
|
99
|
+
* IS a minimum width. Flat, the floor sits directly on the name and there is
|
|
100
|
+
* no wrapper left to lie about it.
|
|
101
|
+
*
|
|
102
|
+
* `flex-1` gives the name a flex base size of 0, so what flexbox measures it
|
|
103
|
+
* at when deciding where to break the line is exactly the floor. The break
|
|
104
|
+
* therefore happens the moment the floor plus the badges no longer fit:
|
|
105
|
+
* badges to line two, name alone on line one with the whole width to
|
|
106
|
+
* truncate into.
|
|
107
|
+
*
|
|
108
|
+
* Which is why the floor is spent on BADGES and on nothing else. A floor is
|
|
109
|
+
* a claim on space that something else has to give back, and a badge is the
|
|
110
|
+
* only thing on this row that can: it takes a second line and the name gets
|
|
111
|
+
* the first one whole. A mark cannot move and a back link is not even in this
|
|
112
|
+
* component, so a floor granted for either is a minimum width with no matching
|
|
113
|
+
* concession — the row simply becomes wider than the box it is in. That is
|
|
114
|
+
* exactly what it did on the tool page's title bar, where the band is one row
|
|
115
|
+
* tall by contract: the `<h1>` wrapped under the logo, the row grew to 86px
|
|
116
|
+
* inside a 48px band, and the title rendered outside it at every phone width.
|
|
117
|
+
* A name with nothing beside it gets no floor for the same reason.
|
|
118
|
+
*
|
|
119
|
+
* `wrap={false}` is the other half of that lesson, for a row whose height is
|
|
120
|
+
* not its own to spend. It is belt to the braces above: with the floor tied
|
|
121
|
+
* to badges, a header that has none cannot break a line anyway — but the day
|
|
122
|
+
* somebody adds one, the band should clip rather than silently grow.
|
|
123
|
+
*/
|
|
124
|
+
export function NameWithBadges({
|
|
125
|
+
name,
|
|
126
|
+
badges,
|
|
127
|
+
leading,
|
|
128
|
+
nameClassName,
|
|
129
|
+
gap = 'gap-2',
|
|
130
|
+
wrap = true,
|
|
131
|
+
className,
|
|
132
|
+
as: NameTag = 'span',
|
|
133
|
+
}: NameWithBadgesProps) {
|
|
134
|
+
// The row follows its name, because what may legally contain what runs both
|
|
135
|
+
// ways. A card and a plugin row are `<button>`s, whose content model is
|
|
136
|
+
// phrasing — a `<div>` inside one is not markup — so the row is a `<span>`.
|
|
137
|
+
// A page title is an `<h1>`, which a `<span>` may not contain for the same
|
|
138
|
+
// rule read the other way round, so that row is a `<div>`.
|
|
139
|
+
const Row = NameTag === 'h1' ? 'div' : 'span';
|
|
140
|
+
return (
|
|
141
|
+
<Row className={cn('flex min-w-0 items-center', wrap ? 'flex-wrap' : 'flex-nowrap', gap, className)}>
|
|
142
|
+
{leading}
|
|
143
|
+
<NameTag
|
|
144
|
+
// Omitted rather than `title=""`: a tooltip that opens on nothing is
|
|
145
|
+
// a tooltip that opens on nothing. A name can be missing — the row
|
|
146
|
+
// still has to render whatever is beside it around the hole.
|
|
147
|
+
title={name || undefined}
|
|
148
|
+
className={cn('flex-1 truncate', badges && NAME_MIN_WIDTH, nameClassName)}
|
|
149
|
+
>
|
|
150
|
+
{name}
|
|
151
|
+
</NameTag>
|
|
152
|
+
{badges && (
|
|
153
|
+
// `shrink-0`, so a badge is never squeezed into an unreadable pill —
|
|
154
|
+
// the group moves as a unit instead. `max-w-full` is the one thing it
|
|
155
|
+
// may not do: on its own line a group wider than the row would paint
|
|
156
|
+
// over whatever is beside the row, so past that width the badges wrap
|
|
157
|
+
// among THEMSELVES rather than overflow.
|
|
158
|
+
<span className={cn('flex max-w-full shrink-0 flex-wrap items-center', gap)}>
|
|
159
|
+
{badges}
|
|
160
|
+
</span>
|
|
161
|
+
)}
|
|
162
|
+
</Row>
|
|
163
|
+
);
|
|
164
|
+
}
|
|
@@ -8,6 +8,12 @@ import { useLibraryToast } from '../state/toast.context';
|
|
|
8
8
|
export interface NewPluginDialogProps {
|
|
9
9
|
/** Names already taken — readable plugins AND locked ones. */
|
|
10
10
|
existing: string[];
|
|
11
|
+
/**
|
|
12
|
+
* The grouping folder below the plugins root to make the plugin in
|
|
13
|
+
* (`Teams`, `Teams/EU`) — where a person right-clicked in the Plugins tree.
|
|
14
|
+
* Empty or absent: the root. The dialog says where the plugin will go.
|
|
15
|
+
*/
|
|
16
|
+
parent?: string;
|
|
11
17
|
onClose(): void;
|
|
12
18
|
/** The catalog and the plugin index both have to hear about a new folder. */
|
|
13
19
|
onCreated(): void;
|
|
@@ -24,13 +30,15 @@ export interface NewPluginDialogProps {
|
|
|
24
30
|
* answering. So there is no access step in this dialog: by the time the
|
|
25
31
|
* response arrives, the plugin exists and it is yours.
|
|
26
32
|
*/
|
|
27
|
-
export function NewPluginDialog({ existing, onClose, onCreated }: NewPluginDialogProps) {
|
|
33
|
+
export function NewPluginDialog({ existing, parent = '', onClose, onCreated }: NewPluginDialogProps) {
|
|
28
34
|
const navigate = useNavigate();
|
|
29
35
|
const toast = useLibraryToast();
|
|
30
36
|
const [name, setName] = useState('');
|
|
31
37
|
const [busy, setBusy] = useState(false);
|
|
32
38
|
|
|
33
39
|
const trimmed = name.trim();
|
|
40
|
+
// The index's names are identities across the whole tree, so a clash with
|
|
41
|
+
// one is a clash anywhere; the server is still the judge of the folder.
|
|
34
42
|
const taken = existing.some((g) => g.toLowerCase() === trimmed.toLowerCase());
|
|
35
43
|
/**
|
|
36
44
|
* A plugin name becomes a folder name, so the characters a path cannot carry
|
|
@@ -52,7 +60,7 @@ export function NewPluginDialog({ existing, onClose, onCreated }: NewPluginDialo
|
|
|
52
60
|
try {
|
|
53
61
|
// Navigate with the SERVER's identity, not the typed name — the
|
|
54
62
|
// endpoint owns the identifier of what it created.
|
|
55
|
-
const { name } = await createPlugin(trimmed);
|
|
63
|
+
const { name } = await createPlugin(trimmed, parent);
|
|
56
64
|
onCreated();
|
|
57
65
|
onClose();
|
|
58
66
|
navigate(pathForPlugin(name));
|
|
@@ -85,6 +93,12 @@ export function NewPluginDialog({ existing, onClose, onCreated }: NewPluginDialo
|
|
|
85
93
|
>
|
|
86
94
|
<p className="text-ui text-ink-muted">
|
|
87
95
|
A plugin carries skills and tools for the people in it. You run the ones you create.
|
|
96
|
+
{parent && (
|
|
97
|
+
<>
|
|
98
|
+
{' '}
|
|
99
|
+
This one goes in <span className="font-mono text-detail text-ink">{parent}/</span>.
|
|
100
|
+
</>
|
|
101
|
+
)}
|
|
88
102
|
</p>
|
|
89
103
|
|
|
90
104
|
<TextField
|