@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
package/THIRD-PARTY-NOTICES.md
CHANGED
|
@@ -27,7 +27,7 @@ These are shippable alongside our own licence, but carry an obligation beyond
|
|
|
27
27
|
attribution: modifications to *their own source files* must remain under the same
|
|
28
28
|
licence and be made available. Using them as dependencies triggers nothing.
|
|
29
29
|
|
|
30
|
-
- `@utcp/sdk@1.
|
|
30
|
+
- `@utcp/sdk@1.2.0` — MPL-2.0
|
|
31
31
|
|
|
32
32
|
## Packages shipping no licence file
|
|
33
33
|
|
|
@@ -96,7 +96,7 @@ the declared licence; refer to the upstream project for the notice.
|
|
|
96
96
|
- **@types/unist@3.0.3** — MIT — see licence text #10 <https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/unist>
|
|
97
97
|
- **@ungap/structured-clone@1.3.3** — ISC — see licence text #11 <https://github.com/ungap/structured-clone#readme>
|
|
98
98
|
- **@upsetjs/venn.js@2.0.0** — MIT — see licence text #12 <https://github.com/upsetjs/venn.js>
|
|
99
|
-
- **@utcp/sdk@1.
|
|
99
|
+
- **@utcp/sdk@1.2.0** — MPL-2.0 — see licence text #13 <https://github.com/universal-tool-calling-protocol/typescript-utcp#readme>
|
|
100
100
|
- **@xmldom/xmldom@0.8.13** — MIT — see licence text #14 <https://github.com/xmldom/xmldom>
|
|
101
101
|
- **argparse@1.0.10** — MIT — see licence text #15 <https://github.com/nodeca/argparse#readme>
|
|
102
102
|
- **bail@2.0.2** — MIT — see licence text #16 <https://github.com/wooorm/bail#readme>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bevel-software/platform-core-frontend",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"description": "Open-source core UI of the Bevel platform (raw TS/TSX source): workspace explorer/viewer, branches & change requests, Library, secrets, tools, access control.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@iconify/react": "^6.0.2",
|
|
28
28
|
"@tailwindcss/typography": "^0.5.19",
|
|
29
|
-
"@utcp/sdk": "^1.
|
|
29
|
+
"@utcp/sdk": "^1.2.0",
|
|
30
30
|
"clsx": "^2.1.1",
|
|
31
31
|
"htmlparser2": "^12.0.0",
|
|
32
32
|
"jszip": "^3.10.1",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"tailwind-merge": "^3.5.0",
|
|
46
46
|
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz",
|
|
47
47
|
"yaml": "^2.9.0",
|
|
48
|
-
"@bevel-software/platform-shared": "0.
|
|
48
|
+
"@bevel-software/platform-shared": "0.19.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@testing-library/jest-dom": "^6.9.1",
|
|
@@ -20,6 +20,7 @@ import { useGitState } from '../modules/git/hooks/useGitState';
|
|
|
20
20
|
import { useAutoPullUpdates } from '../modules/git/hooks/useAutoPullUpdates';
|
|
21
21
|
import { EventBusProvider } from '../modules/workflow/state/EventBusProvider';
|
|
22
22
|
import { EventBusFocusBinder } from '../modules/workflow/state/EventBusFocusBinder';
|
|
23
|
+
import { ChangeRequestStaleBinder } from '../modules/workflow/state/ChangeRequestStaleBinder';
|
|
23
24
|
import { Toolbar } from '../modules/toolbar/components/Toolbar';
|
|
24
25
|
import { DemoBanner } from '../modules/layout/components/DemoBanner';
|
|
25
26
|
import { FileExplorer } from '../modules/workspace/components/FileExplorer';
|
|
@@ -36,7 +37,6 @@ import {
|
|
|
36
37
|
import { MaintenanceOverlay } from '../modules/layout/components/MaintenanceOverlay';
|
|
37
38
|
import { AdminProvider } from '../modules/admin/state/admin.context';
|
|
38
39
|
import { RolesCorruptedBanner } from '../modules/admin/components/RolesCorruptedBanner';
|
|
39
|
-
import { UpdateBanner } from '../modules/update-check/components/UpdateBanner';
|
|
40
40
|
import { ConnectToolsPage } from '../modules/secrets-vault/components/ConnectToolsPage';
|
|
41
41
|
import { SettingsLayout } from '../modules/settings/components/SettingsLayout';
|
|
42
42
|
import { DeploymentPage } from '../modules/settings/components/DeploymentPage';
|
|
@@ -46,10 +46,12 @@ import { ExternalAgentAccessPage } from '../modules/toolbar/components/ExternalA
|
|
|
46
46
|
import { AdminRolesPage } from '../modules/admin/components/AdminRolesPage';
|
|
47
47
|
import { UserAccountsPage } from '../modules/admin/components/UserAccountsPage';
|
|
48
48
|
import { DirectoryGroupsPage } from '../modules/admin/components/DirectoryGroupsPage';
|
|
49
|
+
import { ConnectionKeysPage } from '../modules/admin/components/ConnectionKeysPage';
|
|
49
50
|
import { ToolsExplorerPage } from '../modules/tools/ToolsExplorerPage';
|
|
50
51
|
import { LibraryRoutes } from '../modules/library/routes/LibraryRoutes';
|
|
51
52
|
import { RootLanding } from '../modules/onboarding/components/RootLanding';
|
|
52
53
|
import { ConnectAgentPill } from '../modules/onboarding/components/ConnectAgentPill';
|
|
54
|
+
import { PullRequestsForMe } from '../modules/git/components/PullRequestsForMe';
|
|
53
55
|
import { OpenChangeRequestDialog } from '../modules/pr/components/OpenChangeRequestDialog';
|
|
54
56
|
import { useMediaQuery } from '../modules/layout/hooks/useMediaQuery';
|
|
55
57
|
import { NARROW_QUERY } from '../modules/layout/breakpoints';
|
|
@@ -156,6 +158,7 @@ function AuthenticatedAppInner() {
|
|
|
156
158
|
return (
|
|
157
159
|
<WorkspaceContext.Provider value={workspaceState}>
|
|
158
160
|
<EventBusFocusBinder />
|
|
161
|
+
<ChangeRequestStaleBinder />
|
|
159
162
|
<GitContext.Provider value={gitState}>
|
|
160
163
|
<AutoUpdateContext.Provider value={autoUpdateState}>
|
|
161
164
|
<AdminProvider>
|
|
@@ -173,9 +176,6 @@ function AuthenticatedAppInner() {
|
|
|
173
176
|
const CORE_BANNERS: BannerDef[] = [
|
|
174
177
|
{ id: 'demo', order: 20, node: <DemoBanner /> },
|
|
175
178
|
{ id: 'roles-corrupted', order: 30, node: <RolesCorruptedBanner /> },
|
|
176
|
-
// Admins-only "a newer release exists" line — quiet, dismissible per
|
|
177
|
-
// version, below the louder condition banners above.
|
|
178
|
-
{ id: 'update-available', order: 35, node: <UpdateBanner /> },
|
|
179
179
|
];
|
|
180
180
|
|
|
181
181
|
// Core panes; merged (by `order`) with registry-contributed panes (the
|
|
@@ -231,9 +231,12 @@ const CORE_APPS: AppDef[] = [
|
|
|
231
231
|
* repo's two roots ARE the two apps — `KnowledgeBase/` paths get the pane
|
|
232
232
|
* workspace, default-branch `Plugins/` paths get the library. The catalog is
|
|
233
233
|
* never consulted for the surface, so a just-created skill routes correctly
|
|
234
|
-
* before any reload.
|
|
235
|
-
*
|
|
236
|
-
*
|
|
234
|
+
* before any reload. The shape rule is the WHOLE rule: a file under one of
|
|
235
|
+
* the library's roots opens in the library whatever it is — a manifest, an
|
|
236
|
+
* access.md, a stray upload — with the same viewer Knowledge uses rendered
|
|
237
|
+
* inside the library's frame (see `WorkspaceItemRoute`). Router state
|
|
238
|
+
* `rawFile` asks that route for the raw view; it never changes which app is
|
|
239
|
+
* on screen.
|
|
237
240
|
*
|
|
238
241
|
* While the library renders under a `/workspace` URL it CLAIMS the Skills &
|
|
239
242
|
* Tools app (see {@link AppClaimContext}), so the switcher and the toolbar's
|
|
@@ -242,8 +245,7 @@ const CORE_APPS: AppDef[] = [
|
|
|
242
245
|
function CoreSurfaces() {
|
|
243
246
|
const location = useLocation();
|
|
244
247
|
const claim = useContext(AppClaimContext);
|
|
245
|
-
const
|
|
246
|
-
const library = !rawRequested && isLibraryLocation(location.pathname);
|
|
248
|
+
const library = isLibraryLocation(location.pathname);
|
|
247
249
|
const claimsSkills = library && location.pathname.startsWith(KB_ROUTE_PREFIX);
|
|
248
250
|
useEffect(() => {
|
|
249
251
|
if (!claimsSkills) return;
|
|
@@ -289,6 +291,10 @@ function KnowledgeSurface() {
|
|
|
289
291
|
panes={panes}
|
|
290
292
|
onController={setController}
|
|
291
293
|
sidebarHeader={<ConnectAgentPill />}
|
|
294
|
+
// The change-request dock, pinned under the tree — and under the
|
|
295
|
+
// Library's nav, which passes the same one: the requests waiting on
|
|
296
|
+
// you are the same whichever app you are in.
|
|
297
|
+
sidebarFooter={<PullRequestsForMe />}
|
|
292
298
|
/>
|
|
293
299
|
);
|
|
294
300
|
}
|
|
@@ -415,6 +421,7 @@ export function ShellRoutes({ apps }: { apps: AppDef[] }) {
|
|
|
415
421
|
<Route path="/deployment" element={<DeploymentPage />} />
|
|
416
422
|
<Route path="/user-accounts" element={<UserAccountsPage />} />
|
|
417
423
|
<Route path="/directory-groups" element={<DirectoryGroupsPage />} />
|
|
424
|
+
<Route path="/connection-keys" element={<ConnectionKeysPage />} />
|
|
418
425
|
<Route path="/tools" element={<ToolsExplorerPage />} />
|
|
419
426
|
</Route>
|
|
420
427
|
{/* `/` consults the onboarding: a brand-new account's FIRST visit lands
|
|
@@ -19,9 +19,6 @@ vi.mock('../../modules/layout/components/DemoBanner', () => ({
|
|
|
19
19
|
vi.mock('../../modules/admin/components/RolesCorruptedBanner', () => ({
|
|
20
20
|
RolesCorruptedBanner: () => null,
|
|
21
21
|
}));
|
|
22
|
-
vi.mock('../../modules/update-check/components/UpdateBanner', () => ({
|
|
23
|
-
UpdateBanner: () => null,
|
|
24
|
-
}));
|
|
25
22
|
|
|
26
23
|
/**
|
|
27
24
|
* A stand-in app surface carrying the two gestures these tests need — the
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { describe, it, expect, vi, afterEach } from 'vitest';
|
|
2
|
+
import { PR_STALE_COALESCE_MS, PR_STALE_EVENT, subscribePrStale } from '../events';
|
|
3
|
+
|
|
4
|
+
afterEach(() => {
|
|
5
|
+
vi.useRealTimers();
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* One user action can raise the stale event more than once — the tab that
|
|
10
|
+
* applied a request announces it, and the bus binder announces the server's
|
|
11
|
+
* broadcast of the same merge a moment later. A listener acts once per burst.
|
|
12
|
+
*/
|
|
13
|
+
describe('subscribePrStale', () => {
|
|
14
|
+
it('runs the handler once for a burst of stale events, after the window', () => {
|
|
15
|
+
vi.useFakeTimers();
|
|
16
|
+
const handler = vi.fn();
|
|
17
|
+
const off = subscribePrStale(handler);
|
|
18
|
+
window.dispatchEvent(new Event(PR_STALE_EVENT));
|
|
19
|
+
window.dispatchEvent(new Event(PR_STALE_EVENT));
|
|
20
|
+
window.dispatchEvent(new Event(PR_STALE_EVENT));
|
|
21
|
+
expect(handler).not.toHaveBeenCalled();
|
|
22
|
+
vi.advanceTimersByTime(PR_STALE_COALESCE_MS);
|
|
23
|
+
expect(handler).toHaveBeenCalledTimes(1);
|
|
24
|
+
// A later event, past the window, is its own run.
|
|
25
|
+
window.dispatchEvent(new Event(PR_STALE_EVENT));
|
|
26
|
+
vi.advanceTimersByTime(PR_STALE_COALESCE_MS);
|
|
27
|
+
expect(handler).toHaveBeenCalledTimes(2);
|
|
28
|
+
off();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('drops a pending run when unsubscribed, so an unmounted listener never refetches', () => {
|
|
32
|
+
vi.useFakeTimers();
|
|
33
|
+
const handler = vi.fn();
|
|
34
|
+
const off = subscribePrStale(handler);
|
|
35
|
+
window.dispatchEvent(new Event(PR_STALE_EVENT));
|
|
36
|
+
off();
|
|
37
|
+
vi.advanceTimersByTime(PR_STALE_COALESCE_MS * 2);
|
|
38
|
+
expect(handler).not.toHaveBeenCalled();
|
|
39
|
+
window.dispatchEvent(new Event(PR_STALE_EVENT));
|
|
40
|
+
vi.advanceTimersByTime(PR_STALE_COALESCE_MS * 2);
|
|
41
|
+
expect(handler).not.toHaveBeenCalled();
|
|
42
|
+
});
|
|
43
|
+
});
|
package/src/core/bootstrap.ts
CHANGED
|
@@ -70,15 +70,23 @@ export async function loadServerConfig(): Promise<void> {
|
|
|
70
70
|
// The KB layout has defaults, so an absent or invalid one is not a boot
|
|
71
71
|
// failure either: the module keeps its defaults, which is exactly what an
|
|
72
72
|
// older server that omits the field is running with.
|
|
73
|
+
//
|
|
74
|
+
// The guide's file name is read the same way, one field at a time: a server
|
|
75
|
+
// from before it was configurable serves the three folders and no guide, and
|
|
76
|
+
// taking the whole layout as unusable over that would put a deployment that
|
|
77
|
+
// renamed its ROOTS back on the default folder names in the browser alone.
|
|
73
78
|
const layout = config.kbLayout;
|
|
74
79
|
if (
|
|
75
80
|
layout &&
|
|
76
81
|
typeof layout.knowledgeBaseDir === 'string' &&
|
|
77
82
|
typeof layout.skillsDir === 'string' &&
|
|
78
|
-
typeof layout.pluginsDir === 'string'
|
|
79
|
-
!validateKbLayout(layout)
|
|
83
|
+
typeof layout.pluginsDir === 'string'
|
|
80
84
|
) {
|
|
81
|
-
|
|
85
|
+
const proposed = {
|
|
86
|
+
...layout,
|
|
87
|
+
agentsFile: typeof layout.agentsFile === 'string' ? layout.agentsFile : undefined,
|
|
88
|
+
};
|
|
89
|
+
if (!validateKbLayout(proposed)) configureKbLayout(proposed);
|
|
82
90
|
}
|
|
83
91
|
|
|
84
92
|
/**
|
package/src/core/events.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Window-level custom-event names
|
|
3
|
-
*
|
|
4
|
-
* names without importing each
|
|
2
|
+
* Window-level custom-event names — and the one announcer that goes with one —
|
|
3
|
+
* shared across modules. Centralised here so core and registry-contributed
|
|
4
|
+
* (enterprise) modules agree on the same wire names without importing each
|
|
5
|
+
* other's components.
|
|
5
6
|
*/
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -13,6 +14,46 @@
|
|
|
13
14
|
*/
|
|
14
15
|
export const PR_STALE_EVENT = 'bevel:pr-stale';
|
|
15
16
|
|
|
17
|
+
/**
|
|
18
|
+
* How long a listener waits after a {@link PR_STALE_EVENT} before it acts, so
|
|
19
|
+
* that a burst of them is one refetch. One user action can raise several: the
|
|
20
|
+
* tab that applied a request announces it locally AND receives the server's
|
|
21
|
+
* broadcast of the same merge through the bus binder a moment later, and a
|
|
22
|
+
* folder delete announces once per proposal it retracted. Each of those used
|
|
23
|
+
* to start its own fresh list request.
|
|
24
|
+
*/
|
|
25
|
+
export const PR_STALE_COALESCE_MS = 100;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Subscribe `handler` to {@link PR_STALE_EVENT}, coalesced: events inside one
|
|
29
|
+
* {@link PR_STALE_COALESCE_MS} window run the handler once, after the window.
|
|
30
|
+
* Returns the unsubscribe, which also drops a run still pending — a listener
|
|
31
|
+
* that unmounted must not refetch into nothing.
|
|
32
|
+
*/
|
|
33
|
+
export function subscribePrStale(handler: () => void): () => void {
|
|
34
|
+
let pending: ReturnType<typeof setTimeout> | null = null;
|
|
35
|
+
const onStale = () => {
|
|
36
|
+
if (pending !== null) return;
|
|
37
|
+
pending = setTimeout(() => {
|
|
38
|
+
pending = null;
|
|
39
|
+
handler();
|
|
40
|
+
}, PR_STALE_COALESCE_MS);
|
|
41
|
+
};
|
|
42
|
+
window.addEventListener(PR_STALE_EVENT, onStale);
|
|
43
|
+
return () => {
|
|
44
|
+
window.removeEventListener(PR_STALE_EVENT, onStale);
|
|
45
|
+
if (pending !== null) clearTimeout(pending);
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The fallback window for a {@link PR_STALE_EVENT} that never came — the bus
|
|
51
|
+
* dropped the merge or rejection that would have triggered it. Change-request
|
|
52
|
+
* lists re-read the server on this cadence while the tab is visible, so a lost
|
|
53
|
+
* event leaves a request pending for at most this long, never until a reload.
|
|
54
|
+
*/
|
|
55
|
+
export const PR_STALE_FALLBACK_MS = 60_000;
|
|
56
|
+
|
|
16
57
|
/**
|
|
17
58
|
* CustomEvent carrying a `PullRequestSummary` the CLIENT just made true —
|
|
18
59
|
* a suggestion-routed upload committed these files to the caller's branch,
|
|
@@ -25,6 +66,17 @@ export const PR_STALE_EVENT = 'bevel:pr-stale';
|
|
|
25
66
|
*/
|
|
26
67
|
export const SUGGESTIONS_OPTIMISTIC_EVENT = 'bevel:suggestions-optimistic';
|
|
27
68
|
|
|
69
|
+
/**
|
|
70
|
+
* CustomEvent carrying `{ folder }` — a KB-repo-relative folder whose
|
|
71
|
+
* proposed files the client just took out of every open change request (a
|
|
72
|
+
* folder delete's "and its proposed changes"). The mirror of
|
|
73
|
+
* {@link SUGGESTIONS_OPTIMISTIC_EVENT}: `OpenChangeRequestsProvider` hides
|
|
74
|
+
* every request path under the folder at once, until a fetch that started
|
|
75
|
+
* after the event answers — so no suggestion row or change-request dot for the
|
|
76
|
+
* deleted folder outlives the delete while the list catches up.
|
|
77
|
+
*/
|
|
78
|
+
export const SUGGESTIONS_RETRACTED_EVENT = 'bevel:suggestions-retracted';
|
|
79
|
+
|
|
28
80
|
/**
|
|
29
81
|
* Custom event the chat-side `compare_files` tool-card dispatches to deep-link
|
|
30
82
|
* into the comparison panel. The FileViewer listens for this and forwards
|
|
@@ -39,3 +91,33 @@ export interface OpenComparisonDetail {
|
|
|
39
91
|
fromBranch: string;
|
|
40
92
|
toBranch: string;
|
|
41
93
|
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* A tool credential LANDED — a key stored or removed, an OAuth round-trip
|
|
97
|
+
* returned. Every surface that can write one (the tool page, "Connect your
|
|
98
|
+
* tools", the Secrets vault, the `.tool` editor's panel) announces it, and the
|
|
99
|
+
* Library reloads its catalog AND its plugin summaries in response: the cards,
|
|
100
|
+
* the plugin banner and the sidebar count all read "needs setup" off that
|
|
101
|
+
* catalog, so without the reload they keep describing the state from before
|
|
102
|
+
* the write until the reader reaches for the browser's own reload button.
|
|
103
|
+
*
|
|
104
|
+
* An event rather than a direct call because the writing surfaces do not all
|
|
105
|
+
* live under the Library's provider: `/connect` and `/secrets` are shell
|
|
106
|
+
* routes of their own, so there is nothing to reach for from inside them.
|
|
107
|
+
* Announcing regardless keeps ONE rule for every surface — with no listener
|
|
108
|
+
* the announcement is simply unheard, which is the right outcome for a
|
|
109
|
+
* provider that will refetch on its next mount anyway.
|
|
110
|
+
*/
|
|
111
|
+
export const TOOL_CREDENTIALS_STALE_EVENT = 'bevel:tool-credentials-stale';
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Announce a landed credential change.
|
|
115
|
+
*
|
|
116
|
+
* Call it ONLY once the write has SUCCEEDED. A failed save changed nothing,
|
|
117
|
+
* and a reload triggered by one would make every card and banner in the
|
|
118
|
+
* Library blink for no reason — worse, it would teach the reader that the
|
|
119
|
+
* blink means something happened.
|
|
120
|
+
*/
|
|
121
|
+
export function announceToolCredentialsChanged(): void {
|
|
122
|
+
window.dispatchEvent(new Event(TOOL_CREDENTIALS_STALE_EVENT));
|
|
123
|
+
}
|
package/src/core/registry.ts
CHANGED
|
@@ -75,7 +75,7 @@ export interface AdminMenuItemHelpers {
|
|
|
75
75
|
|
|
76
76
|
/**
|
|
77
77
|
* One row of the profile menu. Core rows (External agent access, Secrets,
|
|
78
|
-
* Browse available tools, Account,
|
|
78
|
+
* Browse available tools, Account, App roles, User accounts) are built
|
|
79
79
|
* into ProfileMenu and navigate to standalone routed pages; enterprise rows
|
|
80
80
|
* are contributed here. A row opens a dialog (`dialog` — mounted persistently
|
|
81
81
|
* by ProfileMenu, driven by an open flag, so existing dialog components need
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { initials, labelInitials } from '../email';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* One monogram rule for every people surface: the same person gets the same
|
|
6
|
+
* letters whether a surface holds their email, their name, or the
|
|
7
|
+
* `Name <email>` label the access rules spell.
|
|
8
|
+
*/
|
|
9
|
+
describe('initials', () => {
|
|
10
|
+
it('takes two initials from a two-word name, or from a first.last local part', () => {
|
|
11
|
+
expect(initials('Ali Vega')).toBe('AV');
|
|
12
|
+
expect(initials('ali.vega@x.io')).toBe('AV');
|
|
13
|
+
expect(initials('ali_vega@x.io')).toBe('AV');
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('takes the first two characters of a one-word name or local part', () => {
|
|
17
|
+
expect(initials('Ali')).toBe('AL');
|
|
18
|
+
expect(initials('ali@x.io')).toBe('AL');
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('reads the NAME of a `Name <email>` label — the address never lends a second word', () => {
|
|
22
|
+
expect(initials('Ali Vega <ali@x.io>')).toBe('AV');
|
|
23
|
+
expect(initials('Ali <ali.vega@x.io>')).toBe('AL');
|
|
24
|
+
// A label that is only an address falls back to it.
|
|
25
|
+
expect(initials('<ali.vega@x.io>')).toBe('AV');
|
|
26
|
+
// A display name is taken whole — an `@` inside it is not an address.
|
|
27
|
+
expect(initials('Ops @ Night <ops@x.io>')).toBe('O@');
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('answers ? for nothing', () => {
|
|
31
|
+
expect(initials('')).toBe('?');
|
|
32
|
+
expect(initials(' ')).toBe('?');
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
describe('labelInitials', () => {
|
|
37
|
+
it('reads a collective label as words — an @ in a group name is just a character', () => {
|
|
38
|
+
expect(labelInitials('Product Team')).toBe('PT');
|
|
39
|
+
expect(labelInitials('Engineering')).toBe('EN');
|
|
40
|
+
expect(labelInitials('ops@night')).toBe('OP');
|
|
41
|
+
expect(labelInitials('gtm-readers')).toBe('GR');
|
|
42
|
+
expect(labelInitials('')).toBe('?');
|
|
43
|
+
});
|
|
44
|
+
});
|
package/src/lib/email.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ONE email-validation rule for every access/admin surface (Manage Access,
|
|
3
|
-
*
|
|
3
|
+
* App roles, Groups). Mirrors the backend's `EMAIL_REGEX`
|
|
4
4
|
* (access-control.service.ts): no whitespace, no `<`/`>` (angle-bracket
|
|
5
5
|
* forms like `Name <a@b.c>` are a different grammar), and exactly one `@`.
|
|
6
6
|
*
|
|
@@ -23,3 +23,39 @@ export const GROUP_MEMBER_PREFIX = 'group:';
|
|
|
23
23
|
export function isGroupPrefixed(value: string): boolean {
|
|
24
24
|
return value.trim().toLowerCase().startsWith(GROUP_MEMBER_PREFIX);
|
|
25
25
|
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Avatar letters for a person, from their email, display name or a
|
|
29
|
+
* `Name <email>` label: two initials when the name (or the email's local
|
|
30
|
+
* part) has two words, otherwise its first two characters. THE one
|
|
31
|
+
* monogram rule — the same person must get the same letters on every
|
|
32
|
+
* people surface (App roles, Groups & Members, Manage access), so no
|
|
33
|
+
* surface keeps a local copy.
|
|
34
|
+
*/
|
|
35
|
+
export function initials(value: string): string {
|
|
36
|
+
const label = value.trim();
|
|
37
|
+
// `Name <email>`: the name is the person, the address only stands in when
|
|
38
|
+
// the label carries nothing else — never a second word beside a one-word name.
|
|
39
|
+
const angled = label.match(/^(.*?)\s*<([^<>]*)>$/);
|
|
40
|
+
const displayName = angled?.[1].trim() ?? '';
|
|
41
|
+
const cleaned = angled ? displayName || angled[2].trim() : label;
|
|
42
|
+
if (!cleaned) return '?';
|
|
43
|
+
// Only an ADDRESS is cut at `@`: a display name is taken whole, whatever
|
|
44
|
+
// characters it carries.
|
|
45
|
+
return labelInitials(displayName ? cleaned : cleaned.split('@')[0]);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Avatar letters for a LABEL that is not a person — a group, a role, a
|
|
50
|
+
* plugin: two initials from its first two words (split on whitespace,
|
|
51
|
+
* dots, dashes, underscores), else its first two characters. No address
|
|
52
|
+
* parsing: an `@` in a group name is just a character. `initials` ends
|
|
53
|
+
* here too, once it has decided which part of a person's label is the name.
|
|
54
|
+
*/
|
|
55
|
+
export function labelInitials(label: string): string {
|
|
56
|
+
const cleaned = label.trim();
|
|
57
|
+
if (!cleaned) return '?';
|
|
58
|
+
const parts = cleaned.split(/[.\s_-]+/).filter(Boolean);
|
|
59
|
+
if (parts.length >= 2) return (parts[0][0] + parts[1][0]).toUpperCase();
|
|
60
|
+
return cleaned.slice(0, 2).toUpperCase();
|
|
61
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
|
+
import { render, screen, within } from '@testing-library/react';
|
|
3
|
+
import userEvent from '@testing-library/user-event';
|
|
4
|
+
import type { FileTreeEntry } from '@bevel-software/platform-shared';
|
|
5
|
+
import type { AccessResponse } from '../api';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* PICKING SEVERAL PRINCIPALS IN A ROW.
|
|
9
|
+
*
|
|
10
|
+
* Customer feedback on the Manage access add row: after picking a group from
|
|
11
|
+
* the list you had to click back into the field to type the next one, and a
|
|
12
|
+
* group you had already picked was offered again as you typed. Two small
|
|
13
|
+
* things, both in the way of the common case — sharing with a few groups at
|
|
14
|
+
* once — and both fixed here: a pick puts the caret back in the field, and the
|
|
15
|
+
* list offers only what is not already a chip.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const api = vi.hoisted(() => ({
|
|
19
|
+
fetchFileAccess: vi.fn(),
|
|
20
|
+
grantAccess: vi.fn(),
|
|
21
|
+
revokeAccess: vi.fn(),
|
|
22
|
+
suggestPrincipals: vi.fn(),
|
|
23
|
+
}));
|
|
24
|
+
vi.mock('../api', async (importOriginal) => {
|
|
25
|
+
const actual = await importOriginal<typeof import('../api')>();
|
|
26
|
+
return { ...actual, ...api };
|
|
27
|
+
});
|
|
28
|
+
vi.mock('../../workspace/state/workspace.context', () => ({
|
|
29
|
+
useWorkspace: () => ({ workspaceId: 'ws-1', kbDirName: 'knowledge-base' }),
|
|
30
|
+
}));
|
|
31
|
+
vi.mock('../../auth/state/auth.context', () => ({
|
|
32
|
+
useAuth: () => ({ user: { email: 'me@x.com', name: 'Me' } }),
|
|
33
|
+
}));
|
|
34
|
+
|
|
35
|
+
import { ManageAccessDialog } from '../components/ManageAccessDialog';
|
|
36
|
+
|
|
37
|
+
const ENTRY: FileTreeEntry = {
|
|
38
|
+
name: 'Deal.md',
|
|
39
|
+
relativePath: 'knowledge-base/Sales/Deal.md',
|
|
40
|
+
type: 'file',
|
|
41
|
+
} as unknown as FileTreeEntry;
|
|
42
|
+
|
|
43
|
+
const EMPTY = {
|
|
44
|
+
canRead: true,
|
|
45
|
+
canWrite: true,
|
|
46
|
+
canDownload: true,
|
|
47
|
+
canOwner: true,
|
|
48
|
+
eligible: { roles: [], users: [] },
|
|
49
|
+
readers: { restricted: true, roles: [], users: [] },
|
|
50
|
+
owners: { roles: [], users: [] },
|
|
51
|
+
downloaders: { roles: [], users: [] },
|
|
52
|
+
sources: {},
|
|
53
|
+
} as unknown as AccessResponse;
|
|
54
|
+
|
|
55
|
+
const FIELD = 'Add people, groups, roles or plugins…';
|
|
56
|
+
|
|
57
|
+
/** The suggestion list (debounced, so awaited), located from an item that must be in it. */
|
|
58
|
+
async function listHolding(label: RegExp): Promise<HTMLElement> {
|
|
59
|
+
return (await screen.findByRole('button', { name: label })).parentElement as HTMLElement;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
beforeEach(() => {
|
|
63
|
+
vi.clearAllMocks();
|
|
64
|
+
api.fetchFileAccess.mockResolvedValue(EMPTY);
|
|
65
|
+
api.grantAccess.mockResolvedValue(EMPTY);
|
|
66
|
+
// The server answers every query with BOTH teams: it does not know what
|
|
67
|
+
// the dialog already holds as a chip, and it must not need to.
|
|
68
|
+
api.suggestPrincipals.mockResolvedValue({
|
|
69
|
+
roles: [],
|
|
70
|
+
groups: ['GTM Team', 'Sales Team'],
|
|
71
|
+
people: [{ name: 'Ana', email: 'ana@x.io' }],
|
|
72
|
+
peopleWithheld: false,
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
describe('ManageAccessDialog add row: picking several in a row', () => {
|
|
77
|
+
it('a pick from the list puts the caret back in the field', async () => {
|
|
78
|
+
const user = userEvent.setup();
|
|
79
|
+
render(<ManageAccessDialog entry={ENTRY} onClose={() => {}} />);
|
|
80
|
+
const field = await screen.findByPlaceholderText(FIELD);
|
|
81
|
+
|
|
82
|
+
await user.type(field, 'team');
|
|
83
|
+
await user.click(await screen.findByRole('button', { name: /GTM Team/ }));
|
|
84
|
+
|
|
85
|
+
// The chip is up, the query is cleared, and the NEXT name can be typed
|
|
86
|
+
// without clicking into the white space first.
|
|
87
|
+
expect(screen.getByRole('button', { name: 'Remove GTM Team' })).toBeInTheDocument();
|
|
88
|
+
expect(field).toHaveValue('');
|
|
89
|
+
expect(field).toHaveFocus();
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it('a principal already picked is not offered again, whatever the server returns', async () => {
|
|
93
|
+
const user = userEvent.setup();
|
|
94
|
+
render(<ManageAccessDialog entry={ENTRY} onClose={() => {}} />);
|
|
95
|
+
const field = await screen.findByPlaceholderText(FIELD);
|
|
96
|
+
|
|
97
|
+
await user.type(field, 'team');
|
|
98
|
+
await user.click(await screen.findByRole('button', { name: /GTM Team/ }));
|
|
99
|
+
await user.type(field, 'team');
|
|
100
|
+
|
|
101
|
+
const list = await listHolding(/Sales Team/);
|
|
102
|
+
expect(within(list).getByText('Sales Team')).toBeInTheDocument();
|
|
103
|
+
expect(within(list).getByText('Ana')).toBeInTheDocument();
|
|
104
|
+
expect(within(list).queryByText('GTM Team')).toBeNull();
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it('removing the chip offers the principal again', async () => {
|
|
108
|
+
const user = userEvent.setup();
|
|
109
|
+
render(<ManageAccessDialog entry={ENTRY} onClose={() => {}} />);
|
|
110
|
+
const field = await screen.findByPlaceholderText(FIELD);
|
|
111
|
+
|
|
112
|
+
await user.type(field, 'team');
|
|
113
|
+
await user.click(await screen.findByRole('button', { name: /GTM Team/ }));
|
|
114
|
+
await user.click(screen.getByRole('button', { name: 'Remove GTM Team' }));
|
|
115
|
+
|
|
116
|
+
await user.type(field, 'team');
|
|
117
|
+
const list = await listHolding(/Sales Team/);
|
|
118
|
+
expect(within(list).getByText('GTM Team')).toBeInTheDocument();
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
it('when everything the server offers is already picked, no list opens', async () => {
|
|
122
|
+
const user = userEvent.setup();
|
|
123
|
+
api.suggestPrincipals.mockResolvedValue({
|
|
124
|
+
roles: [],
|
|
125
|
+
groups: ['GTM Team'],
|
|
126
|
+
people: [],
|
|
127
|
+
peopleWithheld: false,
|
|
128
|
+
});
|
|
129
|
+
render(<ManageAccessDialog entry={ENTRY} onClose={() => {}} />);
|
|
130
|
+
const field = await screen.findByPlaceholderText(FIELD);
|
|
131
|
+
|
|
132
|
+
await user.type(field, 'gtm');
|
|
133
|
+
await user.click(await screen.findByRole('button', { name: /GTM Team/ }));
|
|
134
|
+
await user.type(field, 'gtm');
|
|
135
|
+
|
|
136
|
+
// The only match is the chip already in the field; an empty list would
|
|
137
|
+
// be a box with nothing in it.
|
|
138
|
+
expect(screen.queryByRole('button', { name: /^GT GTM Team/ })).toBeNull();
|
|
139
|
+
expect(screen.getAllByRole('button', { name: /GTM Team/ })).toHaveLength(1); // the chip's Remove
|
|
140
|
+
});
|
|
141
|
+
});
|