@bevel-software/platform-core-frontend 0.14.0 → 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 +34 -26
- package/src/core/__tests__/AppChrome.test.tsx +0 -3
- package/src/core/__tests__/bootstrap.test.ts +33 -1
- package/src/core/__tests__/events.test.ts +43 -0
- package/src/core/bootstrap.ts +38 -1
- package/src/core/events.ts +85 -3
- package/src/core/registry.ts +1 -1
- package/src/lib/__tests__/api.test.ts +38 -0
- package/src/lib/__tests__/email.test.ts +44 -0
- package/src/lib/api.ts +19 -2
- package/src/lib/email.ts +37 -1
- package/src/lib/utils.ts +2 -0
- 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 +781 -76
- 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__/plugin-token.test.ts +21 -0
- package/src/modules/access/__tests__/tailwindDeclarations.ts +210 -0
- package/src/modules/access/api.ts +192 -10
- package/src/modules/access/components/ManageAccessDialog.tsx +1337 -570
- 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/__tests__/GitSyncFailedBanner.test.tsx +65 -1
- package/src/modules/git/components/FileHistoryPanel.tsx +5 -0
- package/src/modules/git/components/GitSyncFailedBanner.tsx +68 -5
- 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 +109 -4
- 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 +104 -99
- package/src/modules/library/__tests__/LinkSkillPanel.test.tsx +136 -0
- package/src/modules/library/__tests__/LockedPluginView.test.tsx +103 -7
- package/src/modules/library/__tests__/NewPluginDialog.test.tsx +18 -8
- 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 +115 -9
- package/src/modules/library/__tests__/PluginJoinRequests.test.tsx +60 -1
- package/src/modules/library/__tests__/PluginPage.test.tsx +453 -7
- package/src/modules/library/__tests__/PluginsSidebar.contextmenu.test.tsx +17 -57
- package/src/modules/library/__tests__/PluginsSidebar.test.tsx +161 -97
- 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 +391 -78
- package/src/modules/library/__tests__/SkillsTree.test.tsx +461 -0
- package/src/modules/library/__tests__/ToolConnectionSection.test.tsx +582 -71
- package/src/modules/library/__tests__/ToolPage.test.tsx +94 -4
- package/src/modules/library/__tests__/WorkspaceItemRoute.test.tsx +279 -21
- 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 +183 -0
- package/src/modules/library/__tests__/library-data.test.ts +7 -0
- package/src/modules/library/__tests__/library-paths.test.ts +75 -0
- package/src/modules/library/__tests__/link-membership.test.ts +129 -0
- 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 +67 -0
- 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/__tests__/useJoinRequests.test.tsx +46 -0
- 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 +107 -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 +149 -34
- package/src/modules/library/components/LibraryLayout.tsx +120 -247
- package/src/modules/library/components/LibraryPage.tsx +172 -39
- package/src/modules/library/components/LinkSkillPanel.tsx +169 -0
- package/src/modules/library/components/LockedPluginView.tsx +63 -35
- package/src/modules/library/components/NameWithBadges.tsx +164 -0
- package/src/modules/library/components/NewPluginDialog.tsx +19 -5
- package/src/modules/library/components/PageActions.tsx +31 -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 +123 -23
- package/src/modules/library/components/PluginExtras.tsx +143 -18
- package/src/modules/library/components/PluginIndexRow.tsx +47 -12
- package/src/modules/library/components/PluginPage.tsx +234 -38
- package/src/modules/library/components/PluginRows.tsx +286 -0
- package/src/modules/library/components/PluginsSidebar.tsx +271 -238
- package/src/modules/library/components/PluginsSidebarMenu.tsx +26 -1
- package/src/modules/library/components/RenamePluginDialog.tsx +136 -0
- package/src/modules/library/components/ShareButton.tsx +17 -0
- package/src/modules/library/components/SkillsTree.tsx +204 -0
- package/src/modules/library/components/StatusDot.tsx +1 -0
- 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 +132 -23
- package/src/modules/library/components/skill-page/SharedViaPlugins.tsx +212 -0
- package/src/modules/library/components/skill-page/SkillFilePane.tsx +5 -0
- package/src/modules/library/components/skill-page/SkillPage.tsx +337 -121
- 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 +116 -17
- 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/useJoinRequests.ts +48 -18
- 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 +229 -82
- package/src/modules/library/routes/library-paths.ts +46 -35
- package/src/modules/library/services/library.api.ts +89 -17
- package/src/modules/library/services/plugins.api.ts +161 -9
- 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 +268 -37
- 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 +102 -0
- package/src/modules/library/utils/status.ts +204 -35
- package/src/modules/onboarding/__tests__/creator-welcome.test.tsx +11 -3
- 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 +154 -0
- package/src/modules/settings/components/ClaudeConnectionFields.tsx +23 -0
- package/src/modules/settings/components/DeploymentPage.tsx +16 -22
- package/src/modules/settings/components/MarketplaceSection.tsx +152 -0
- package/src/modules/settings/components/__tests__/ClaudeConnectionCard.test.tsx +63 -0
- package/src/modules/settings/components/__tests__/DeploymentPage.test.tsx +74 -1
- 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 +66 -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 +615 -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 +711 -40
- package/src/modules/setup/hooks/useSetupStatus.ts +93 -0
- package/src/modules/setup/services/setup.api.ts +218 -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 +395 -124
- 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 +659 -36
- 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 +8 -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 +6 -3
- package/src/modules/workspace/components/FileExplorer.tsx +1527 -367
- package/src/modules/workspace/components/FileRoute.tsx +376 -22
- 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 +768 -16
- package/src/modules/workspace/components/__tests__/FileViewer.test.tsx +332 -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 +89 -0
- package/src/modules/workspace/hooks/useWorkspaceImageResolver.ts +55 -0
- package/src/modules/workspace/hooks/useWorkspaceState.ts +438 -66
- package/src/modules/workspace/routing/__tests__/kb-routes.test.tsx +279 -3
- package/src/modules/workspace/routing/kb-routes.ts +207 -30
- 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 +130 -16
- package/src/modules/workspace/utils/__tests__/file-trace.test.ts +73 -0
- package/src/modules/workspace/utils/__tests__/fileTree.test.ts +234 -5
- 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 +126 -52
- 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 +59 -0
- package/src/shared/components/Badge.tsx +3 -1
- package/src/shared/components/Banner.tsx +5 -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 +118 -0
- 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 +34 -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 -265
- 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,15 +245,20 @@ 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;
|
|
250
252
|
claim('skills-tools');
|
|
251
253
|
return () => claim(null);
|
|
252
254
|
}, [claimsSkills, claim]);
|
|
253
|
-
|
|
255
|
+
// Mounted here, once, above BOTH surfaces: the Knowledge tree, the tab
|
|
256
|
+
// strip, the viewer's banner AND the Library's Skills tree all ask the same
|
|
257
|
+
// question, and a tree rendered outside the provider would read the empty
|
|
258
|
+
// default and never show a proposed file.
|
|
259
|
+
return (
|
|
260
|
+
<OpenChangeRequestsProvider>{library ? <LibraryRoutes /> : <KnowledgeSurface />}</OpenChangeRequestsProvider>
|
|
261
|
+
);
|
|
254
262
|
}
|
|
255
263
|
|
|
256
264
|
/**
|
|
@@ -272,23 +280,22 @@ function KnowledgeSurface() {
|
|
|
272
280
|
),
|
|
273
281
|
[registry],
|
|
274
282
|
);
|
|
275
|
-
// Mounted here, once, because three separate subtrees ask the same question:
|
|
276
|
-
// the tree (per row), the tab strip (per tab) and the viewer's banner. A
|
|
277
|
-
// plain hook per consumer would give every tree row its own request.
|
|
278
283
|
return (
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
284
|
+
/* The connect-your-agent reminder rides Knowledge's sidebar too, and
|
|
285
|
+
the shell is where that is decided: `layout` is the app's generic
|
|
286
|
+
consistency layer and must not name a domain component, so the pill
|
|
287
|
+
is passed IN from the composition root. The Library passes the same
|
|
288
|
+
one from `LibraryLayout` — one pill, both surfaces, so a person who
|
|
289
|
+
skipped the welcome page and stayed in Knowledge still sees it. */
|
|
290
|
+
<AppLayout
|
|
291
|
+
panes={panes}
|
|
292
|
+
onController={setController}
|
|
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 />}
|
|
298
|
+
/>
|
|
292
299
|
);
|
|
293
300
|
}
|
|
294
301
|
|
|
@@ -414,6 +421,7 @@ export function ShellRoutes({ apps }: { apps: AppDef[] }) {
|
|
|
414
421
|
<Route path="/deployment" element={<DeploymentPage />} />
|
|
415
422
|
<Route path="/user-accounts" element={<UserAccountsPage />} />
|
|
416
423
|
<Route path="/directory-groups" element={<DirectoryGroupsPage />} />
|
|
424
|
+
<Route path="/connection-keys" element={<ConnectionKeysPage />} />
|
|
417
425
|
<Route path="/tools" element={<ToolsExplorerPage />} />
|
|
418
426
|
</Route>
|
|
419
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
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
configureBranchModel,
|
|
4
|
+
configureKbLayout,
|
|
5
|
+
DEFAULT_BRANCH,
|
|
6
|
+
DEFAULT_KB_LAYOUT,
|
|
7
|
+
PLUGINS_DIR,
|
|
8
|
+
SKILLS_DIR,
|
|
9
|
+
} from '@bevel-software/platform-shared';
|
|
3
10
|
import { loadServerConfig } from '../bootstrap';
|
|
4
11
|
import { mcpEndpointUrl } from '../../shared/mcp';
|
|
5
12
|
|
|
@@ -26,6 +33,7 @@ afterEach(() => {
|
|
|
26
33
|
// The model is module-global; restore what the shared test setup applied so
|
|
27
34
|
// a later suite is not left with whatever a case here configured.
|
|
28
35
|
configureBranchModel(CONFIGURED);
|
|
36
|
+
configureKbLayout({ ...DEFAULT_KB_LAYOUT });
|
|
29
37
|
});
|
|
30
38
|
|
|
31
39
|
const respond = (branchModel: unknown, rest: Record<string, unknown> = {}) =>
|
|
@@ -70,6 +78,30 @@ describe('loadServerConfig', () => {
|
|
|
70
78
|
* one the OAuth metadata publishes, and that is the one that decides
|
|
71
79
|
* whether a connector works.
|
|
72
80
|
*/
|
|
81
|
+
describe('the KB layout', () => {
|
|
82
|
+
it('applies the root names the server runs with', async () => {
|
|
83
|
+
respond(CONFIGURED, {
|
|
84
|
+
kbLayout: { knowledgeBaseDir: 'docs', skillsDir: 'skills', pluginsDir: 'plugins' },
|
|
85
|
+
});
|
|
86
|
+
await loadServerConfig();
|
|
87
|
+
expect(SKILLS_DIR).toBe('skills');
|
|
88
|
+
expect(PLUGINS_DIR).toBe('plugins');
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it('keeps the defaults when an older server sends none', async () => {
|
|
92
|
+
respond(CONFIGURED);
|
|
93
|
+
await loadServerConfig();
|
|
94
|
+
expect(SKILLS_DIR).toBe('Skills');
|
|
95
|
+
expect(PLUGINS_DIR).toBe('Plugins');
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it('keeps the defaults rather than applying a layout that cannot be valid', async () => {
|
|
99
|
+
respond(CONFIGURED, { kbLayout: { knowledgeBaseDir: 'x', skillsDir: 'x', pluginsDir: 'x' } });
|
|
100
|
+
await loadServerConfig();
|
|
101
|
+
expect(SKILLS_DIR).toBe('Skills');
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
|
|
73
105
|
describe('the MCP endpoint', () => {
|
|
74
106
|
it('applies what the server said', async () => {
|
|
75
107
|
respond(CONFIGURED, { mcpUrl: 'https://kb.acme.com/api/mcp' });
|
|
@@ -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
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
configureBranchModel,
|
|
3
|
+
configureKbLayout,
|
|
4
|
+
validateBranchModel,
|
|
5
|
+
validateKbLayout,
|
|
6
|
+
type KbLayout,
|
|
7
|
+
} from '@bevel-software/platform-shared';
|
|
2
8
|
// The pure module, NOT the `shared/mcp` barrel — the same reason `test-setup.ts`
|
|
3
9
|
// avoids it. This runs BEFORE React renders, and the barrel would drag the
|
|
4
10
|
// components and their icon imports into the boot path to set one string.
|
|
5
11
|
import { configureMcpUrl } from '../shared/mcp/connect-snippets';
|
|
12
|
+
import { configureMarketplaceGitUrl } from '../shared/marketplace-url';
|
|
6
13
|
|
|
7
14
|
/** What `GET /api/config` serves. Unauthenticated — see the route's comment. */
|
|
8
15
|
interface ServerConfig {
|
|
@@ -14,6 +21,13 @@ interface ServerConfig {
|
|
|
14
21
|
* is what every connect surface did before this existed.
|
|
15
22
|
*/
|
|
16
23
|
mcpUrl?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Optional for the same version-skew reason: a server that predates the
|
|
26
|
+
* field leaves the defaults in place, which is what it was running with.
|
|
27
|
+
*/
|
|
28
|
+
kbLayout?: KbLayout;
|
|
29
|
+
/** The per-user marketplace git remote; absent from an older server. */
|
|
30
|
+
marketplaceGitUrl?: string;
|
|
17
31
|
}
|
|
18
32
|
|
|
19
33
|
/**
|
|
@@ -53,6 +67,28 @@ export async function loadServerConfig(): Promise<void> {
|
|
|
53
67
|
const problem = validateBranchModel(config.branchModel);
|
|
54
68
|
if (!problem) configureBranchModel(config.branchModel);
|
|
55
69
|
|
|
70
|
+
// The KB layout has defaults, so an absent or invalid one is not a boot
|
|
71
|
+
// failure either: the module keeps its defaults, which is exactly what an
|
|
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.
|
|
78
|
+
const layout = config.kbLayout;
|
|
79
|
+
if (
|
|
80
|
+
layout &&
|
|
81
|
+
typeof layout.knowledgeBaseDir === 'string' &&
|
|
82
|
+
typeof layout.skillsDir === 'string' &&
|
|
83
|
+
typeof layout.pluginsDir === 'string'
|
|
84
|
+
) {
|
|
85
|
+
const proposed = {
|
|
86
|
+
...layout,
|
|
87
|
+
agentsFile: typeof layout.agentsFile === 'string' ? layout.agentsFile : undefined,
|
|
88
|
+
};
|
|
89
|
+
if (!validateKbLayout(proposed)) configureKbLayout(proposed);
|
|
90
|
+
}
|
|
91
|
+
|
|
56
92
|
/**
|
|
57
93
|
* Unconditional, and deliberately not guarded by the branch-model check
|
|
58
94
|
* above: an unconfigured deployment still has a real address, and the
|
|
@@ -61,6 +97,7 @@ export async function loadServerConfig(): Promise<void> {
|
|
|
61
97
|
* origin rather than taking down the boot for a snippet.
|
|
62
98
|
*/
|
|
63
99
|
configureMcpUrl(config.mcpUrl);
|
|
100
|
+
configureMarketplaceGitUrl(config.marketplaceGitUrl);
|
|
64
101
|
}
|
|
65
102
|
|
|
66
103
|
/**
|
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
|
|
@@ -93,3 +93,41 @@ describe('authFetch transport-failure signalling', () => {
|
|
|
93
93
|
expect(watcher.seen()).toBe(1);
|
|
94
94
|
});
|
|
95
95
|
});
|
|
96
|
+
|
|
97
|
+
describe('authFetch application-level responses', () => {
|
|
98
|
+
let watcher: ReturnType<typeof watchUnreachable>;
|
|
99
|
+
beforeEach(() => {
|
|
100
|
+
vi.restoreAllMocks();
|
|
101
|
+
watcher = watchUnreachable();
|
|
102
|
+
});
|
|
103
|
+
afterEach(() => {
|
|
104
|
+
watcher.stop();
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it('a 503 the endpoint marked as its own does not signal; an unmarked 503 and a 502 still do', async () => {
|
|
108
|
+
// `POST /api/sync` answers 503 when a branch could not be pulled and stamps
|
|
109
|
+
// the response; a reverse proxy answering for a dead backend never does.
|
|
110
|
+
const marked = (r: Response) => r.headers.get('x-hexis-sync') === 'result';
|
|
111
|
+
vi.spyOn(globalThis, 'fetch').mockResolvedValueOnce(
|
|
112
|
+
new Response('{}', { status: 503, headers: { 'x-hexis-sync': 'result' } }),
|
|
113
|
+
);
|
|
114
|
+
await authFetch('/api/sync', { method: 'POST' }, { isApplicationResponse: marked });
|
|
115
|
+
expect(watcher.seen()).toBe(0);
|
|
116
|
+
|
|
117
|
+
vi.spyOn(globalThis, 'fetch').mockResolvedValueOnce(new Response('<html>503</html>', { status: 503 }));
|
|
118
|
+
await authFetch('/api/sync', { method: 'POST' }, { isApplicationResponse: marked });
|
|
119
|
+
expect(watcher.seen()).toBe(1);
|
|
120
|
+
|
|
121
|
+
vi.spyOn(globalThis, 'fetch').mockResolvedValueOnce(new Response('', { status: 502 }));
|
|
122
|
+
await authFetch('/api/sync', { method: 'POST' }, { isApplicationResponse: marked });
|
|
123
|
+
expect(watcher.seen()).toBe(2);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it('a network failure on such a call still signals', async () => {
|
|
127
|
+
vi.spyOn(globalThis, 'fetch').mockRejectedValueOnce(new TypeError('Failed to fetch'));
|
|
128
|
+
await expect(
|
|
129
|
+
authFetch('/api/sync', { method: 'POST' }, { isApplicationResponse: () => true }),
|
|
130
|
+
).rejects.toThrow('Failed to fetch');
|
|
131
|
+
expect(watcher.seen()).toBe(1);
|
|
132
|
+
});
|
|
133
|
+
});
|
|
@@ -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/api.ts
CHANGED
|
@@ -52,11 +52,28 @@ export function clearToken(): void {
|
|
|
52
52
|
localStorage.removeItem(TOKEN_KEY);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
export interface AuthFetchOptions {
|
|
56
|
+
/**
|
|
57
|
+
* Recognise a response that carries one of the proxy-down statuses but is
|
|
58
|
+
* in fact the BACKEND answering — an ordinary result of this endpoint, not
|
|
59
|
+
* the proxy standing in for a dead upstream. `POST /api/sync` says 503 when
|
|
60
|
+
* a branch could not be pulled, and marks every response it writes with a
|
|
61
|
+
* header a proxy never sets; the caller checks for that marker here. A
|
|
62
|
+
* status alone is never enough: a proxy 503 looks identical by status.
|
|
63
|
+
* Network failures always signal, whatever this returns.
|
|
64
|
+
*/
|
|
65
|
+
isApplicationResponse?: (response: Response) => boolean;
|
|
66
|
+
}
|
|
67
|
+
|
|
55
68
|
/**
|
|
56
69
|
* Fetch wrapper that injects the Authorization header from localStorage.
|
|
57
70
|
* On 401 responses, clears the stored token.
|
|
58
71
|
*/
|
|
59
|
-
export async function authFetch(
|
|
72
|
+
export async function authFetch(
|
|
73
|
+
input: RequestInfo | URL,
|
|
74
|
+
init?: RequestInit,
|
|
75
|
+
opts: AuthFetchOptions = {},
|
|
76
|
+
): Promise<Response> {
|
|
60
77
|
const token = getToken();
|
|
61
78
|
const headers = new Headers(init?.headers);
|
|
62
79
|
if (token) headers.set('Authorization', `Bearer ${token}`);
|
|
@@ -73,7 +90,7 @@ export async function authFetch(input: RequestInfo | URL, init?: RequestInit): P
|
|
|
73
90
|
throw err;
|
|
74
91
|
}
|
|
75
92
|
|
|
76
|
-
if (PROXY_DOWN_STATUSES.has(response.status)) {
|
|
93
|
+
if (PROXY_DOWN_STATUSES.has(response.status) && !opts.isApplicationResponse?.(response)) {
|
|
77
94
|
signalUnreachable();
|
|
78
95
|
}
|
|
79
96
|
|
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
|
+
}
|