@bevel-software/platform-core-frontend 0.15.1 → 0.20.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 +20 -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__/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/DirectoryGroupsPage.tsx +91 -39
- package/src/modules/admin/components/UserAccountsPage.tsx +271 -37
- package/src/modules/admin/components/group-members-path.ts +32 -0
- package/src/modules/admin/services/roles.api.ts +12 -1
- package/src/modules/audit/__tests__/AuditLogPage.test.tsx +312 -0
- package/src/modules/audit/components/AuditEventsPanel.tsx +319 -0
- package/src/modules/audit/components/AuditLogPage.tsx +373 -0
- package/src/modules/audit/components/principal-grouping.ts +49 -0
- package/src/modules/audit/services/audit.api.ts +98 -0
- 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 +7 -6
- package/src/modules/settings/services/github-facade.api.ts +23 -0
- package/src/modules/settings/settings-nav-items.tsx +13 -3
- 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 +532 -43
- package/src/modules/setup/hooks/useSetupStatus.ts +93 -0
- package/src/modules/setup/services/setup.api.ts +141 -4
- 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 +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 +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 +172 -46
- 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 +2533 -129
- package/src/modules/workspace/components/__tests__/FileRoute.test.tsx +731 -18
- package/src/modules/workspace/components/__tests__/FileViewer.test.tsx +381 -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 +134 -1
- package/src/modules/workspace/services/workspace.api.ts +57 -4
- package/src/modules/workspace/state/__tests__/applied-request-clears-pending.test.tsx +343 -0
- package/src/modules/workspace/state/__tests__/upload-lands-where-it-was-dropped.test.tsx +158 -0
- package/src/modules/workspace/state/open-change-requests.tsx +100 -12
- package/src/modules/workspace/state/workspace.context.ts +125 -19
- package/src/modules/workspace/utils/__tests__/file-trace.test.ts +73 -0
- package/src/modules/workspace/utils/__tests__/fileTree.test.ts +220 -6
- package/src/modules/workspace/utils/__tests__/pasteLink.test.ts +76 -0
- package/src/modules/workspace/utils/__tests__/treeConfirm.test.ts +364 -0
- package/src/modules/workspace/utils/__tests__/uploadError.test.ts +35 -0
- package/src/modules/workspace/utils/file-trace.ts +50 -0
- package/src/modules/workspace/utils/fileTree.ts +112 -36
- package/src/modules/workspace/utils/frontmatter.ts +8 -4
- package/src/modules/workspace/utils/pasteLink.ts +90 -0
- package/src/modules/workspace/utils/treeConfirm.ts +338 -0
- package/src/modules/workspace/utils/uploadError.ts +29 -0
- package/src/shared/__tests__/marketplace-url.test.ts +6 -1
- package/src/shared/components/Button.tsx +16 -2
- package/src/shared/components/Dialog.tsx +27 -11
- package/src/shared/components/Menu.tsx +13 -1
- package/src/shared/components/PageShell.tsx +13 -8
- package/src/shared/components/__tests__/primitives.test.tsx +116 -2
- package/src/shared/components/__tests__/useFocusHandoff.test.tsx +192 -0
- package/src/shared/components/index.ts +2 -0
- package/src/shared/components/useDismissableMenu.ts +32 -10
- package/src/shared/components/useFocusHandoff.ts +51 -0
- package/src/shared/components/useLatestRef.ts +28 -0
- package/src/shared/markdown/Markdown.tsx +12 -3
- package/src/shared/markdown/__tests__/escapeSpacesInLinkDestinations.test.ts +39 -0
- package/src/shared/markdown/hrefs.ts +50 -0
- package/src/shared/marketplace-url.ts +33 -5
- package/src/shared/mcp/ChatGptInstallLink.tsx +3 -3
- package/src/shared/mcp/ConnectionInstructions.tsx +38 -27
- package/src/shared/mcp/__tests__/connect-snippets.test.ts +3 -3
- package/src/shared/mcp/connect-snippets.ts +14 -9
- package/src/shared/mcp/index.ts +1 -1
- package/src/shared/theme/__tests__/header-band.test.ts +197 -0
- package/src/shared/theme/header.ts +75 -0
- package/src/shared/theme/measure.ts +7 -4
- package/src/shared/theme/tokens.css +25 -0
- package/src/modules/library/__tests__/PluginsIndexPage.test.tsx +0 -363
- package/src/modules/library/__tests__/PluginsSidebar.locked.test.tsx +0 -97
- package/src/modules/library/components/PluginsIndexPage.tsx +0 -270
- package/src/modules/update-check/__tests__/UpdateBanner.test.tsx +0 -126
- package/src/modules/update-check/components/UpdateBanner.tsx +0 -92
- package/src/modules/update-check/services/update-check.api.ts +0 -24
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
import { useEffect, useRef, useState, type FormEvent } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
DEFAULT_KB_LAYOUT,
|
|
4
|
+
agentsFilePointerSentence,
|
|
5
|
+
type KbLayout,
|
|
6
|
+
} from '@bevel-software/platform-shared';
|
|
2
7
|
import { Banner, Button, Surface, TextField } from '../../../shared/components';
|
|
3
8
|
import { tokenUsernameForHost } from '../utils/git-host';
|
|
9
|
+
import { isRootFolderSuggestion, rootFolderState, type RootFolderState } from '../utils/root-folders';
|
|
4
10
|
import { copyToClipboard } from '../../../lib/clipboard';
|
|
11
|
+
import { MarketplaceSection } from '../../settings/components/MarketplaceSection';
|
|
5
12
|
import {
|
|
6
13
|
saveSettings,
|
|
7
14
|
syncNow,
|
|
8
15
|
syncOutcomeError,
|
|
9
16
|
testConnection,
|
|
17
|
+
KbInitFailed,
|
|
18
|
+
testOidc,
|
|
10
19
|
SettingsProblems,
|
|
11
20
|
type ConnectionTest,
|
|
21
|
+
type KbInitFailure,
|
|
12
22
|
type LastSync,
|
|
23
|
+
type OidcTest,
|
|
24
|
+
type OidcVerification,
|
|
13
25
|
type SettingStatus,
|
|
14
26
|
type SyncNowResult,
|
|
15
27
|
type SyncStatus,
|
|
@@ -98,23 +110,31 @@ const FIELDS: Record<
|
|
|
98
110
|
placeholder: 'A long random string',
|
|
99
111
|
advanced: true,
|
|
100
112
|
},
|
|
113
|
+
// The three roots are NOT under Advanced: a repository whose skills live in
|
|
114
|
+
// `skills/` connected fine, got an empty `Skills/` scaffolded beside it and
|
|
115
|
+
// imported nothing — a choice that has to be seen to be made.
|
|
101
116
|
knowledgeBaseDir: {
|
|
102
117
|
label: 'Knowledge folder',
|
|
103
118
|
help: 'The top-level folder in the repository that holds the knowledge. Change it only to read a repository laid out by someone else.',
|
|
104
119
|
placeholder: 'KnowledgeBase',
|
|
105
|
-
advanced: true,
|
|
106
120
|
},
|
|
107
121
|
skillsDir: {
|
|
108
122
|
label: 'Skills folder',
|
|
109
|
-
help: 'The top-level folder that holds shared skills. The three folder names must differ.',
|
|
123
|
+
help: 'The top-level folder that holds shared skills. The three folder names must differ. Case matters: skills and Skills are different folders.',
|
|
110
124
|
placeholder: 'Skills',
|
|
111
|
-
advanced: true,
|
|
112
125
|
},
|
|
113
126
|
pluginsDir: {
|
|
114
127
|
label: 'Plugins folder',
|
|
115
128
|
help: 'The top-level folder that holds plugins. The three folder names must differ.',
|
|
116
129
|
placeholder: 'Plugins',
|
|
117
|
-
|
|
130
|
+
},
|
|
131
|
+
// Beside the folders, and not under Advanced, for the same reason they are
|
|
132
|
+
// not: a repository that already has an `AGENTS.md` of its own loses it to
|
|
133
|
+
// the platform's on the first boot unless this is answered first.
|
|
134
|
+
agentsFile: {
|
|
135
|
+
label: 'Agent guide file',
|
|
136
|
+
help: 'The file the platform writes its own guide to, at the top of the repository. Change it if your repository already has an AGENTS.md you want to keep — that file then stays yours, and the platform never writes to it. Must end in .md.',
|
|
137
|
+
placeholder: 'AGENTS.md',
|
|
118
138
|
},
|
|
119
139
|
defaultBranch: {
|
|
120
140
|
label: 'Main branch',
|
|
@@ -158,6 +178,11 @@ const FIELDS: Record<
|
|
|
158
178
|
help: 'Only people with an address at these domains can sign in this way. Separate several with commas. Leave blank to allow any address: safe with a provider that only serves your organisation, risky with one that does not.',
|
|
159
179
|
placeholder: 'example.com',
|
|
160
180
|
},
|
|
181
|
+
auditRetentionDays: {
|
|
182
|
+
label: 'Keep events for',
|
|
183
|
+
help: 'How many days an agent’s recorded calls stay in the Audit log before they are removed. Leave it blank, or enter 0, to keep them forever. Applies without a restart.',
|
|
184
|
+
placeholder: 'forever',
|
|
185
|
+
},
|
|
161
186
|
};
|
|
162
187
|
|
|
163
188
|
/**
|
|
@@ -179,6 +204,50 @@ const REQUIRED_KEYS = ['kbRepoUrl', 'gitToken', 'defaultBranch', 'protectedBranc
|
|
|
179
204
|
*/
|
|
180
205
|
const CONNECTION_KEYS = ['kbRepoUrl', 'gitToken', 'gitUsername'];
|
|
181
206
|
|
|
207
|
+
/**
|
|
208
|
+
* The answers the sign-in check proves. Editing one invalidates its result on
|
|
209
|
+
* screen; the scopes, the button text and the allowed domains are not among
|
|
210
|
+
* them, and the server never re-checks a save that changes only those.
|
|
211
|
+
*/
|
|
212
|
+
const OIDC_KEYS = ['oidcIssuerUrl', 'oidcClientId', 'oidcClientSecret'];
|
|
213
|
+
|
|
214
|
+
/** How the configuration in effect is labelled, in both variants. */
|
|
215
|
+
const OIDC_VERIFICATION_LABEL: Record<OidcVerification, string> = {
|
|
216
|
+
verified: 'Verified',
|
|
217
|
+
unverified: 'Unverified — sign in once to confirm',
|
|
218
|
+
'not-configured': 'Not configured',
|
|
219
|
+
unrecordable: 'Not recorded — set SECRETS_ENC_KEY to keep verification',
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
/** The three root folder fields, checked against the repository's listing. */
|
|
223
|
+
const ROOT_FOLDER_KEYS = ['knowledgeBaseDir', 'skillsDir', 'pluginsDir'] as const;
|
|
224
|
+
const isRootFolderKey = (key: string): key is (typeof ROOT_FOLDER_KEYS)[number] =>
|
|
225
|
+
(ROOT_FOLDER_KEYS as readonly string[]).includes(key);
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* The knowledge-base LAYOUT fields — the three folders and the agent guide's
|
|
229
|
+
* file name — which render together, under the connection test whose listing
|
|
230
|
+
* the folders are checked against, rather than with the connection fields
|
|
231
|
+
* above it.
|
|
232
|
+
*/
|
|
233
|
+
const LAYOUT_KEYS: readonly (keyof KbLayout)[] = [...ROOT_FOLDER_KEYS, 'agentsFile'];
|
|
234
|
+
const isLayoutKey = (key: string): boolean => (LAYOUT_KEYS as readonly string[]).includes(key);
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* The consent that rides along with a renamed guide: keep the platform's
|
|
238
|
+
* one-sentence pointer in the customer's own `AGENTS.md`. Not a text field, so
|
|
239
|
+
* it has no {@link FIELDS} entry and is drawn by hand under the name it
|
|
240
|
+
* belongs to.
|
|
241
|
+
*/
|
|
242
|
+
const AGENTS_LINK_KEY = 'agentsFileLink';
|
|
243
|
+
|
|
244
|
+
/** How a near-miss folder differs from the configured name, as the warning words it. */
|
|
245
|
+
const VARIANT_DIFFERENCE: Record<Extract<RootFolderState, { kind: 'variant' }>['difference'], string> = {
|
|
246
|
+
case: 'differs only by case',
|
|
247
|
+
'trailing-s': 'differs only by a trailing s',
|
|
248
|
+
'case-and-trailing-s': 'differs by case and a trailing s',
|
|
249
|
+
};
|
|
250
|
+
|
|
182
251
|
/** The blocks, in the order they are worked through. */
|
|
183
252
|
const SECTIONS: { id: SettingStatus['section']; title: string; blurb: string }[] = [
|
|
184
253
|
{
|
|
@@ -193,11 +262,26 @@ const SECTIONS: { id: SettingStatus['section']; title: string; blurb: string }[]
|
|
|
193
262
|
blurb:
|
|
194
263
|
'Optional, and you can add it later. Lets people sign in with the account they already have instead of a password.',
|
|
195
264
|
},
|
|
265
|
+
{
|
|
266
|
+
id: 'audit',
|
|
267
|
+
title: 'Audit log',
|
|
268
|
+
blurb:
|
|
269
|
+
'The Audit log records which tools, skills and capabilities each connected agent uses. Choose how long those records are kept; unset, they are kept forever.',
|
|
270
|
+
},
|
|
196
271
|
];
|
|
197
272
|
|
|
198
273
|
interface Props {
|
|
199
274
|
settings: SettingStatus[];
|
|
200
|
-
/**
|
|
275
|
+
/**
|
|
276
|
+
* Re-read the status after a save, so the gate can let the app through.
|
|
277
|
+
*
|
|
278
|
+
* The host must let only its LATEST read land (`SetupGate` and
|
|
279
|
+
* `DeploymentPage` both read through `useSetupStatus`, which does): each
|
|
280
|
+
* fresh `kbInit` replaces the failure on
|
|
281
|
+
* screen, so an earlier read answering late — the refresh after a failed
|
|
282
|
+
* save, landing after a retry that succeeded — would otherwise put the
|
|
283
|
+
* cleared failure back.
|
|
284
|
+
*/
|
|
201
285
|
onSaved(): void;
|
|
202
286
|
/**
|
|
203
287
|
* Where the screen is standing. `setup` (the default) is the first-run
|
|
@@ -213,6 +297,14 @@ interface Props {
|
|
|
213
297
|
* calls, and what the last call did. Absent on a build without the module.
|
|
214
298
|
*/
|
|
215
299
|
sync?: SyncStatus;
|
|
300
|
+
/**
|
|
301
|
+
* A standing knowledge-base initialization failure, from the status
|
|
302
|
+
* endpoint — so the banner is there when the screen is opened, not only
|
|
303
|
+
* right after the save that failed.
|
|
304
|
+
*/
|
|
305
|
+
kbInit?: KbInitFailure;
|
|
306
|
+
/** Whether the single sign-on configuration in effect is proven. Absent from an older server. */
|
|
307
|
+
oidcVerification?: OidcVerification;
|
|
216
308
|
}
|
|
217
309
|
|
|
218
310
|
/**
|
|
@@ -231,8 +323,43 @@ interface Props {
|
|
|
231
323
|
* silently outranking the infrastructure config someone is reviewing in a
|
|
232
324
|
* repo, which is the same rule the server enforces.
|
|
233
325
|
*/
|
|
234
|
-
|
|
326
|
+
/** Two reports of the same initialization failure (a status read builds a new object each time). */
|
|
327
|
+
function sameFailure(a: KbInitFailure, b: KbInitFailure): boolean {
|
|
328
|
+
return a.kind === b.kind && a.cause === b.cause;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
export function SetupScreen({ settings, onSaved, variant = 'setup', sync, kbInit, oidcVerification }: Props) {
|
|
235
332
|
const [draft, setDraft] = useState<Record<string, string>>({});
|
|
333
|
+
/**
|
|
334
|
+
* The initialization failure on screen: the status endpoint's, until a save
|
|
335
|
+
* or a retry from this screen answers more recently. A fresh status read
|
|
336
|
+
* (a new `kbInit` from the host) takes over again — adjusted during render
|
|
337
|
+
* rather than in an effect, so the stale banner never paints. That a fresh
|
|
338
|
+
* prop really is the latest read is the host's promise (see `onSaved`), and
|
|
339
|
+
* each retry or save that clears the failure here also asks for that read.
|
|
340
|
+
*/
|
|
341
|
+
const [initFailure, setInitFailure] = useState<KbInitFailure | null>(kbInit ?? null);
|
|
342
|
+
const [seenKbInit, setSeenKbInit] = useState(kbInit);
|
|
343
|
+
/**
|
|
344
|
+
* The failure a save or retry from THIS screen has just seen cleared, until a
|
|
345
|
+
* status read agrees. A read that went out before the retry — the refresh
|
|
346
|
+
* after the failed save — can still answer after it, reporting that same
|
|
347
|
+
* failure as standing; this screen knows better, so the stale copy is not
|
|
348
|
+
* shown. The guard lifts on the first read without a failure, and never
|
|
349
|
+
* hides a DIFFERENT failure: that is news, whenever it arrives.
|
|
350
|
+
*/
|
|
351
|
+
const [clearedFailure, setClearedFailure] = useState<KbInitFailure | null>(null);
|
|
352
|
+
if (kbInit !== seenKbInit) {
|
|
353
|
+
setSeenKbInit(kbInit);
|
|
354
|
+
if (!kbInit) {
|
|
355
|
+
setClearedFailure(null);
|
|
356
|
+
setInitFailure(null);
|
|
357
|
+
} else if (!(clearedFailure && sameFailure(kbInit, clearedFailure))) {
|
|
358
|
+
setClearedFailure(null);
|
|
359
|
+
setInitFailure(kbInit);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
const [retrying, setRetrying] = useState(false);
|
|
236
363
|
const [syncing, setSyncing] = useState(false);
|
|
237
364
|
/** What the last "Sync now" from THIS page came back with (a failure to ask is `error`). */
|
|
238
365
|
const [syncResult, setSyncResult] = useState<SyncNowResult | null>(null);
|
|
@@ -255,6 +382,25 @@ export function SetupScreen({ settings, onSaved, variant = 'setup', sync }: Prop
|
|
|
255
382
|
* shown as if it were about the new ones.
|
|
256
383
|
*/
|
|
257
384
|
const connectionEpoch = useRef(0);
|
|
385
|
+
const [oidcTest, setOidcTest] = useState<OidcTest | null>(null);
|
|
386
|
+
const [oidcTesting, setOidcTesting] = useState(false);
|
|
387
|
+
/** The same staleness guard as {@link connectionEpoch}, for the sign-in answers. */
|
|
388
|
+
const oidcEpoch = useRef(0);
|
|
389
|
+
/**
|
|
390
|
+
* A verification state newer than the one the host last passed in — what a
|
|
391
|
+
* save or a test just answered. Dropped for good the moment the host passes
|
|
392
|
+
* in anything new (its own refresh supersedes it, even one that comes back
|
|
393
|
+
* to the value it replaced) and when a sign-in field is edited.
|
|
394
|
+
*/
|
|
395
|
+
const [latest, setLatest] = useState<OidcVerification | null>(null);
|
|
396
|
+
const [hostVerification, setHostVerification] = useState(oidcVerification);
|
|
397
|
+
if (hostVerification !== oidcVerification) {
|
|
398
|
+
// Adjusting state to a changed prop during render, rather than in an
|
|
399
|
+
// effect: React re-renders at once, before anything stale is painted.
|
|
400
|
+
setHostVerification(oidcVerification);
|
|
401
|
+
setLatest(null);
|
|
402
|
+
}
|
|
403
|
+
const verification = latest ?? oidcVerification;
|
|
258
404
|
|
|
259
405
|
/**
|
|
260
406
|
* What a field would save as, given a set of typed answers: what is in them,
|
|
@@ -283,6 +429,25 @@ export function SetupScreen({ settings, onSaved, variant = 'setup', sync }: Prop
|
|
|
283
429
|
return typed !== (settings.find((s) => s.key === key)?.value ?? '').trim();
|
|
284
430
|
};
|
|
285
431
|
|
|
432
|
+
/**
|
|
433
|
+
* Something typed that a save would actually store. The retry sends an EMPTY
|
|
434
|
+
* save — pressed now, it would re-run against the stored values while a
|
|
435
|
+
* corrected token sits unsaved in the form — so it waits, and Save (which
|
|
436
|
+
* retries too) is the way to try with the new values. Judged like the
|
|
437
|
+
* connection gate above — an edit put back changes nothing — and a token
|
|
438
|
+
* username that is just what an address answers (the one typed, or the one
|
|
439
|
+
* stored) is not an edit of its own: typing the address fills it in, and once
|
|
440
|
+
* the address is put back or cleared, nothing the admin did is left unsaved.
|
|
441
|
+
*/
|
|
442
|
+
const answeredUsernames = [draft.kbRepoUrl, settings.find((s) => s.key === 'kbRepoUrl')?.value].map(
|
|
443
|
+
(address) => (address ? tokenUsernameForHost(address)?.username : undefined),
|
|
444
|
+
);
|
|
445
|
+
const draftChanged = Object.keys(draft).some(
|
|
446
|
+
(key) =>
|
|
447
|
+
!(key === 'gitUsername' && answeredUsernames.includes(draft.gitUsername)) &&
|
|
448
|
+
connectionKeyChanged(key),
|
|
449
|
+
);
|
|
450
|
+
|
|
286
451
|
/**
|
|
287
452
|
* Whether THIS save has to stand behind the repository connection.
|
|
288
453
|
*
|
|
@@ -311,6 +476,8 @@ export function SetupScreen({ settings, onSaved, variant = 'setup', sync }: Prop
|
|
|
311
476
|
* reader has already changed.
|
|
312
477
|
*/
|
|
313
478
|
const connectionRejected = mustProveConnection && test?.ok === false;
|
|
479
|
+
/** Of those, the host let the token read but not write — a different fix. */
|
|
480
|
+
const connectionReadOnly = connectionRejected && test?.outcome === 'read-only';
|
|
314
481
|
|
|
315
482
|
function set(key: string, value: string) {
|
|
316
483
|
setDraft((d) => {
|
|
@@ -333,6 +500,12 @@ export function SetupScreen({ settings, onSaved, variant = 'setup', sync }: Prop
|
|
|
333
500
|
delete next[key];
|
|
334
501
|
return next;
|
|
335
502
|
});
|
|
503
|
+
if (OIDC_KEYS.includes(key)) {
|
|
504
|
+
oidcEpoch.current++;
|
|
505
|
+
setOidcTest(null);
|
|
506
|
+
// A test's "Verified" was about the values before this edit.
|
|
507
|
+
setLatest(null);
|
|
508
|
+
}
|
|
336
509
|
if (CONNECTION_KEYS.includes(key)) {
|
|
337
510
|
// Any in-flight test is now asking about values that are gone; the epoch
|
|
338
511
|
// bump makes its answer land as stale rather than as evidence.
|
|
@@ -433,6 +606,94 @@ export function SetupScreen({ settings, onSaved, variant = 'setup', sync }: Prop
|
|
|
433
606
|
}
|
|
434
607
|
}
|
|
435
608
|
|
|
609
|
+
/**
|
|
610
|
+
* "Test sign-in configuration": the check a save runs, on the values typed
|
|
611
|
+
* (the server falls back to those in effect). Nothing is saved.
|
|
612
|
+
*/
|
|
613
|
+
async function runOidcTest() {
|
|
614
|
+
setOidcTesting(true);
|
|
615
|
+
setError(null);
|
|
616
|
+
const epoch = oidcEpoch.current;
|
|
617
|
+
const fields = Object.fromEntries(Object.entries(draft).filter(([key]) => OIDC_KEYS.includes(key)));
|
|
618
|
+
try {
|
|
619
|
+
const result = await testOidc(fields);
|
|
620
|
+
if (epoch !== oidcEpoch.current) return;
|
|
621
|
+
setOidcTest(result);
|
|
622
|
+
if (result.oidcVerification) setLatest(result.oidcVerification);
|
|
623
|
+
} catch (err) {
|
|
624
|
+
if (epoch === oidcEpoch.current) {
|
|
625
|
+
setOidcTest({ ok: false, error: err instanceof Error ? err.message : 'Could not test the sign-in configuration.' });
|
|
626
|
+
}
|
|
627
|
+
} finally {
|
|
628
|
+
setOidcTesting(false);
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
/** What a sign-in test came back with, in words. */
|
|
633
|
+
function describeOidcTest(result: OidcTest): string {
|
|
634
|
+
switch (result.outcome) {
|
|
635
|
+
case 'verified':
|
|
636
|
+
return 'Verified. The provider accepted the application ID and secret.';
|
|
637
|
+
case 'issuer-verified':
|
|
638
|
+
return 'The provider address is a sign-in provider. Enter the application ID and secret to check them too.';
|
|
639
|
+
default:
|
|
640
|
+
return result.error ?? 'The sign-in configuration could not be checked.';
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
/**
|
|
645
|
+
* The test button, its answer and the verification label: beside the
|
|
646
|
+
* provider fields, or on its own when every one of them is set by the
|
|
647
|
+
* environment.
|
|
648
|
+
*/
|
|
649
|
+
function renderOidcPanel() {
|
|
650
|
+
return (
|
|
651
|
+
<Surface tone="sunken" radius="md" className="p-4">
|
|
652
|
+
{verification && (
|
|
653
|
+
<p className="mb-3 text-detail text-ink-muted">
|
|
654
|
+
Status:{' '}
|
|
655
|
+
<span
|
|
656
|
+
data-testid="oidc-verification"
|
|
657
|
+
className={`font-medium ${
|
|
658
|
+
verification === 'verified'
|
|
659
|
+
? 'text-ok'
|
|
660
|
+
: verification === 'unverified'
|
|
661
|
+
? 'text-wait'
|
|
662
|
+
: 'text-ink-faint'
|
|
663
|
+
}`}
|
|
664
|
+
>
|
|
665
|
+
{OIDC_VERIFICATION_LABEL[verification]}
|
|
666
|
+
</span>
|
|
667
|
+
</p>
|
|
668
|
+
)}
|
|
669
|
+
<div className="flex flex-wrap items-center gap-3">
|
|
670
|
+
<Button
|
|
671
|
+
type="button"
|
|
672
|
+
variant="outline"
|
|
673
|
+
size="sm"
|
|
674
|
+
onClick={() => void runOidcTest()}
|
|
675
|
+
disabled={oidcTesting || saving}
|
|
676
|
+
>
|
|
677
|
+
{oidcTesting ? 'Checking…' : 'Test sign-in configuration'}
|
|
678
|
+
</Button>
|
|
679
|
+
<span className="text-meta text-ink-faint">
|
|
680
|
+
Checks the provider address, then the application ID and secret, with the provider.
|
|
681
|
+
</span>
|
|
682
|
+
</div>
|
|
683
|
+
{oidcTest && (
|
|
684
|
+
<p
|
|
685
|
+
role="status"
|
|
686
|
+
className={`mt-3 text-detail ${
|
|
687
|
+
oidcTest.ok ? 'text-ok' : oidcTest.outcome === 'unverified' ? 'text-wait' : 'text-danger'
|
|
688
|
+
}`}
|
|
689
|
+
>
|
|
690
|
+
{describeOidcTest(oidcTest)}
|
|
691
|
+
</p>
|
|
692
|
+
)}
|
|
693
|
+
</Surface>
|
|
694
|
+
);
|
|
695
|
+
}
|
|
696
|
+
|
|
436
697
|
async function runSync() {
|
|
437
698
|
setSyncing(true);
|
|
438
699
|
setSyncResult(null);
|
|
@@ -515,9 +776,48 @@ export function SetupScreen({ settings, onSaved, variant = 'setup', sync }: Prop
|
|
|
515
776
|
);
|
|
516
777
|
}
|
|
517
778
|
|
|
779
|
+
/**
|
|
780
|
+
* Re-run the knowledge-base initialization. No endpoint of its own: any save
|
|
781
|
+
* while the failure stands re-runs the phase, and an EMPTY one changes no
|
|
782
|
+
* setting — so nothing has to be typed again, and the server's one-save-at-a-
|
|
783
|
+
* time chain covers this exactly as it covers the form.
|
|
784
|
+
*/
|
|
785
|
+
async function retryInitialization() {
|
|
786
|
+
if (retrying || saving || draftChanged) return;
|
|
787
|
+
setRetrying(true);
|
|
788
|
+
setError(null);
|
|
789
|
+
try {
|
|
790
|
+
const result = await saveSettings({});
|
|
791
|
+
setClearedFailure(initFailure);
|
|
792
|
+
setInitFailure(null);
|
|
793
|
+
if (result.awaitingRestart) {
|
|
794
|
+
setNeedsRestart(true);
|
|
795
|
+
// As after a save: the settings page still wants fresh status, or its
|
|
796
|
+
// host keeps the failure this retry just cleared.
|
|
797
|
+
if (variant === 'settings') onSaved();
|
|
798
|
+
return;
|
|
799
|
+
}
|
|
800
|
+
if (result.complete && variant === 'setup') {
|
|
801
|
+
// The same full reload the completing save does, for the same reason:
|
|
802
|
+
// the browser's branch model predates the app it is about to open.
|
|
803
|
+
window.location.reload();
|
|
804
|
+
return;
|
|
805
|
+
}
|
|
806
|
+
onSaved();
|
|
807
|
+
} catch (err) {
|
|
808
|
+
if (err instanceof KbInitFailed) {
|
|
809
|
+
setClearedFailure(null);
|
|
810
|
+
setInitFailure(err.kbInit);
|
|
811
|
+
} else setError(err instanceof Error ? err.message : 'Could not retry the initialization.');
|
|
812
|
+
} finally {
|
|
813
|
+
setRetrying(false);
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
|
|
518
817
|
async function submit(e: FormEvent) {
|
|
519
818
|
e.preventDefault();
|
|
520
|
-
|
|
819
|
+
// A save during a sign-in check would clear the draft the check is about.
|
|
820
|
+
if (saving || retrying || oidcTesting) return;
|
|
521
821
|
setSaving(true);
|
|
522
822
|
setError(null);
|
|
523
823
|
setProblems({});
|
|
@@ -554,11 +854,15 @@ export function SetupScreen({ settings, onSaved, variant = 'setup', sync }: Prop
|
|
|
554
854
|
setTesting(true);
|
|
555
855
|
await probe();
|
|
556
856
|
setTesting(false);
|
|
857
|
+
// Includes a probe the server REFUSED (a 4xx comes back as a
|
|
858
|
+
// rejection, not a throw) — that is an answer about these values.
|
|
557
859
|
if (proven && !proven.ok) {
|
|
558
860
|
setError(
|
|
559
|
-
|
|
560
|
-
? 'Not saved.
|
|
561
|
-
:
|
|
861
|
+
proven.outcome === 'read-only'
|
|
862
|
+
? 'Not saved. The token can read the repository but cannot write to it — grant it write access and test again.'
|
|
863
|
+
: variant === 'setup'
|
|
864
|
+
? 'Not saved. Nothing behind this screen works until the repository answers, and it did not — fix the connection above and test it again.'
|
|
865
|
+
: 'Not saved. The repository did not answer with those details — fix the connection above and test it again.',
|
|
562
866
|
);
|
|
563
867
|
return;
|
|
564
868
|
}
|
|
@@ -571,13 +875,19 @@ export function SetupScreen({ settings, onSaved, variant = 'setup', sync }: Prop
|
|
|
571
875
|
// above fills the same fields from the same answer.
|
|
572
876
|
if (
|
|
573
877
|
!probed &&
|
|
878
|
+
// No address, nothing to look a branch up in.
|
|
879
|
+
!!resolvedIn(payload, 'kbRepoUrl') &&
|
|
574
880
|
(!resolvedIn(payload, 'defaultBranch') || !resolvedIn(payload, 'protectedBranches'))
|
|
575
881
|
) {
|
|
576
882
|
await probe();
|
|
577
883
|
}
|
|
578
884
|
const result = await saveSettings(payload);
|
|
885
|
+
// A save while a failure stands re-ran the initialization, and it held.
|
|
886
|
+
setClearedFailure(initFailure);
|
|
887
|
+
setInitFailure(null);
|
|
579
888
|
setRestartRequired(result.restartRequired);
|
|
580
889
|
setDraft({});
|
|
890
|
+
if (result.oidcVerification) setLatest(result.oidcVerification);
|
|
581
891
|
// A save can succeed and STILL leave the deployment unusable: a blank
|
|
582
892
|
// field means "leave it alone", not "this is wrong", so the server
|
|
583
893
|
// accepts a batch that answers only some of what it needs. Saying so is
|
|
@@ -611,8 +921,24 @@ export function SetupScreen({ settings, onSaved, variant = 'setup', sync }: Prop
|
|
|
611
921
|
}
|
|
612
922
|
onSaved();
|
|
613
923
|
} catch (err) {
|
|
614
|
-
if (err instanceof SettingsProblems)
|
|
615
|
-
|
|
924
|
+
if (err instanceof SettingsProblems) {
|
|
925
|
+
setProblems(err.problems);
|
|
926
|
+
// A problem about a field this form does not render — the server's
|
|
927
|
+
// connection check blaming a token the environment supplies, say —
|
|
928
|
+
// would otherwise vanish, leaving a save that failed silently.
|
|
929
|
+
const unshown = Object.entries(err.problems).filter(
|
|
930
|
+
([key]) => !editable.some((s) => s.key === key),
|
|
931
|
+
);
|
|
932
|
+
if (unshown.length > 0) setError(unshown.map(([, message]) => message).join(' '));
|
|
933
|
+
} else if (err instanceof KbInitFailed) {
|
|
934
|
+
// The values ARE stored — only the initialization failed. The form
|
|
935
|
+
// shows what was saved, and the banner says what to fix and retries
|
|
936
|
+
// without asking for any of it again.
|
|
937
|
+
setClearedFailure(null);
|
|
938
|
+
setInitFailure(err.kbInit);
|
|
939
|
+
setDraft({});
|
|
940
|
+
onSaved();
|
|
941
|
+
} else setError(err instanceof Error ? err.message : 'Could not save these settings.');
|
|
616
942
|
} finally {
|
|
617
943
|
setSaving(false);
|
|
618
944
|
// The page scrolls now, and every message lands at the top of it while
|
|
@@ -631,11 +957,93 @@ export function SetupScreen({ settings, onSaved, variant = 'setup', sync }: Prop
|
|
|
631
957
|
*/
|
|
632
958
|
const remoteBranches = test?.ok ? (test.branches ?? []) : [];
|
|
633
959
|
|
|
960
|
+
/**
|
|
961
|
+
* The top-level folders the connection test found, or null when there is
|
|
962
|
+
* nothing to judge the root fields against: no test yet, a failed one, a
|
|
963
|
+
* listing that did not come back — or an EMPTY repository, whose one message
|
|
964
|
+
* already says everything will be set up, and three "will be created" notes
|
|
965
|
+
* beneath it would only repeat that.
|
|
966
|
+
*/
|
|
967
|
+
const remoteRootFolders =
|
|
968
|
+
test?.ok && !test.empty && Array.isArray(test.rootFolders) ? test.rootFolders : null;
|
|
969
|
+
|
|
970
|
+
/**
|
|
971
|
+
* What the repository holds for one root field, as it would save now. Judged
|
|
972
|
+
* live against the listing — the listing describes the repository, not the
|
|
973
|
+
* field, so correcting the name to the one suggested says "found" at once.
|
|
974
|
+
* Never a problem that blocks the save: an admin may mean to create the
|
|
975
|
+
* folder, or to rename the old one later.
|
|
976
|
+
*/
|
|
977
|
+
function renderRootFolderState(key: keyof KbLayout) {
|
|
978
|
+
if (!remoteRootFolders) return null;
|
|
979
|
+
const name = resolved(key) || DEFAULT_KB_LAYOUT[key];
|
|
980
|
+
const state = rootFolderState(name, remoteRootFolders);
|
|
981
|
+
const folder = (value: string) => <code className="font-mono">{value}</code>;
|
|
982
|
+
return (
|
|
983
|
+
<p id={`${key}-repo-state`} className={`mt-1 text-meta ${state.kind === 'variant' ? 'text-wait' : 'text-ok'}`}>
|
|
984
|
+
{state.kind === 'found' && <>{folder(name)} found in the repository.</>}
|
|
985
|
+
{state.kind === 'missing' && (
|
|
986
|
+
<>{folder(name)} is not in the repository yet — it will be created.</>
|
|
987
|
+
)}
|
|
988
|
+
{state.kind === 'variant' && (
|
|
989
|
+
<>
|
|
990
|
+
Not found — the repository has {folder(state.candidate)} (
|
|
991
|
+
{VARIANT_DIFFERENCE[state.difference]}): set
|
|
992
|
+
this field to {folder(state.candidate)} or rename the folder.
|
|
993
|
+
</>
|
|
994
|
+
)}
|
|
995
|
+
</p>
|
|
996
|
+
);
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
/**
|
|
1000
|
+
* Under the guide's name, once it is no longer `AGENTS.md`: the exact
|
|
1001
|
+
* sentence the platform would add to the customer's own `AGENTS.md`, and the
|
|
1002
|
+
* consent to keep it there.
|
|
1003
|
+
*
|
|
1004
|
+
* Shown ONLY while the name differs, because that is the only time there is
|
|
1005
|
+
* anything to point at — under the default name the guide IS `AGENTS.md`.
|
|
1006
|
+
* The sentence is rendered by the same helper the server appends with, so
|
|
1007
|
+
* what the admin reads here is what lands in their file, character for
|
|
1008
|
+
* character.
|
|
1009
|
+
*/
|
|
1010
|
+
function renderAgentsFileLink() {
|
|
1011
|
+
const name = resolved('agentsFile') || DEFAULT_KB_LAYOUT.agentsFile;
|
|
1012
|
+
if (name === DEFAULT_KB_LAYOUT.agentsFile) return null;
|
|
1013
|
+
// Unset means on: the server reads an unanswered setting the same way.
|
|
1014
|
+
const on = (draft[AGENTS_LINK_KEY] ?? settings.find((s) => s.key === AGENTS_LINK_KEY)?.value ?? 'true') !== 'false';
|
|
1015
|
+
return (
|
|
1016
|
+
<div className="mt-2 space-y-2" data-testid="agents-file-link">
|
|
1017
|
+
<label className="flex cursor-pointer select-none items-start gap-2 text-detail text-ink">
|
|
1018
|
+
<input
|
|
1019
|
+
type="checkbox"
|
|
1020
|
+
className="mt-0.5"
|
|
1021
|
+
checked={on}
|
|
1022
|
+
onChange={(e) => set(AGENTS_LINK_KEY, e.target.checked ? 'true' : 'false')}
|
|
1023
|
+
/>
|
|
1024
|
+
<span>Keep a pointer to {name} in your own AGENTS.md</span>
|
|
1025
|
+
</label>
|
|
1026
|
+
<CopyValue value={agentsFilePointerSentence(name)} label="Copy the pointer sentence" />
|
|
1027
|
+
<p className="text-meta text-ink-faint">
|
|
1028
|
+
While this is ticked, every start looks for “{name}” in your AGENTS.md and adds the
|
|
1029
|
+
sentence at the end when it is not there — in your own words counts too. Nothing is added
|
|
1030
|
+
if you have no AGENTS.md, and no file is ever created for it. Untick it to stop.
|
|
1031
|
+
</p>
|
|
1032
|
+
</div>
|
|
1033
|
+
);
|
|
1034
|
+
}
|
|
1035
|
+
|
|
634
1036
|
function renderField(setting: SettingStatus) {
|
|
635
1037
|
const copy = FIELDS[setting.key];
|
|
636
1038
|
if (!copy) return null;
|
|
637
1039
|
const isBranchField = setting.key === 'defaultBranch' || setting.key === 'protectedBranches';
|
|
638
|
-
const
|
|
1040
|
+
const isFolderField = isRootFolderKey(setting.key);
|
|
1041
|
+
const suggestions = isBranchField
|
|
1042
|
+
? remoteBranches
|
|
1043
|
+
: isFolderField
|
|
1044
|
+
? (remoteRootFolders ?? []).filter(isRootFolderSuggestion)
|
|
1045
|
+
: [];
|
|
1046
|
+
const listId = suggestions.length > 0 ? `${setting.key}-options` : undefined;
|
|
639
1047
|
return (
|
|
640
1048
|
<div key={setting.key}>
|
|
641
1049
|
<label className="block space-y-1.5">
|
|
@@ -657,12 +1065,14 @@ export function SetupScreen({ settings, onSaved, variant = 'setup', sync }: Prop
|
|
|
657
1065
|
</label>
|
|
658
1066
|
{listId && (
|
|
659
1067
|
<datalist id={listId}>
|
|
660
|
-
{
|
|
1068
|
+
{suggestions.map((b) => (
|
|
661
1069
|
<option key={b} value={b} />
|
|
662
1070
|
))}
|
|
663
1071
|
</datalist>
|
|
664
1072
|
)}
|
|
665
1073
|
<p className="mt-1 text-meta text-ink-faint">{copy.help}</p>
|
|
1074
|
+
{isRootFolderKey(setting.key) && renderRootFolderState(setting.key)}
|
|
1075
|
+
{setting.key === 'agentsFile' && renderAgentsFileLink()}
|
|
666
1076
|
{setting.key === 'kbSyncSecret' && renderSyncPanel()}
|
|
667
1077
|
{/* Only AFTER setup: on first run there is nothing yet to lose, so
|
|
668
1078
|
the caution would be noise. Once a deployment is live, this field
|
|
@@ -705,6 +1115,31 @@ export function SetupScreen({ settings, onSaved, variant = 'setup', sync }: Prop
|
|
|
705
1115
|
)}
|
|
706
1116
|
|
|
707
1117
|
<div ref={noticeRef}>
|
|
1118
|
+
{/* Saved, but the knowledge base behind the gate was never set up.
|
|
1119
|
+
The cause is the server's classified sentence — what to fix, not
|
|
1120
|
+
what git said — and the retry needs nothing re-entered. */}
|
|
1121
|
+
{initFailure && (
|
|
1122
|
+
<Banner tone="danger" role="alert" className="mt-6" data-testid="kb-init-failure">
|
|
1123
|
+
<p className="font-semibold">Saved, but the knowledge base could not be initialized</p>
|
|
1124
|
+
<p className="mt-1">{initFailure.cause}</p>
|
|
1125
|
+
{draftChanged && (
|
|
1126
|
+
<p className="mt-1">
|
|
1127
|
+
The form has unsaved changes — saving them retries the initialization with them.
|
|
1128
|
+
</p>
|
|
1129
|
+
)}
|
|
1130
|
+
<Button
|
|
1131
|
+
type="button"
|
|
1132
|
+
variant="outline"
|
|
1133
|
+
size="sm"
|
|
1134
|
+
className="mt-3"
|
|
1135
|
+
onClick={() => void retryInitialization()}
|
|
1136
|
+
disabled={retrying || saving || testing || draftChanged}
|
|
1137
|
+
>
|
|
1138
|
+
{retrying ? 'Initializing…' : 'Retry initialization'}
|
|
1139
|
+
</Button>
|
|
1140
|
+
</Banner>
|
|
1141
|
+
)}
|
|
1142
|
+
|
|
708
1143
|
{error && (
|
|
709
1144
|
<Banner tone="danger" role="alert" className="mt-6">
|
|
710
1145
|
{error}
|
|
@@ -741,7 +1176,10 @@ export function SetupScreen({ settings, onSaved, variant = 'setup', sync }: Prop
|
|
|
741
1176
|
</Banner>
|
|
742
1177
|
)}
|
|
743
1178
|
|
|
744
|
-
|
|
1179
|
+
{/* Named so its submit button can sit outside it, below the
|
|
1180
|
+
Marketplace section: the button is the last thing on the page, but
|
|
1181
|
+
Marketplace is deliberately not part of this form (see below). */}
|
|
1182
|
+
<form id="setup-settings-form" onSubmit={submit} className="mt-8 space-y-10">
|
|
745
1183
|
{SECTIONS.map((section) => {
|
|
746
1184
|
const fields = editable.filter((s) => s.section === section.id);
|
|
747
1185
|
// A section whose every field comes from the environment has
|
|
@@ -776,7 +1214,21 @@ export function SetupScreen({ settings, onSaved, variant = 'setup', sync }: Prop
|
|
|
776
1214
|
</p>
|
|
777
1215
|
)}
|
|
778
1216
|
</div>
|
|
779
|
-
{fields
|
|
1217
|
+
{fields
|
|
1218
|
+
.filter(
|
|
1219
|
+
(f) =>
|
|
1220
|
+
!FIELDS[f.key]?.advanced &&
|
|
1221
|
+
!isLayoutKey(f.key) &&
|
|
1222
|
+
(section.id !== 'sign-in' || OIDC_KEYS.includes(f.key)),
|
|
1223
|
+
)
|
|
1224
|
+
.map((f) => renderField(f))}
|
|
1225
|
+
|
|
1226
|
+
{/* Directly under the three answers it proves. */}
|
|
1227
|
+
{section.id === 'sign-in' && renderOidcPanel()}
|
|
1228
|
+
{section.id === 'sign-in' &&
|
|
1229
|
+
fields
|
|
1230
|
+
.filter((f) => !FIELDS[f.key]?.advanced && !OIDC_KEYS.includes(f.key))
|
|
1231
|
+
.map((f) => renderField(f))}
|
|
780
1232
|
|
|
781
1233
|
{/* Immediately under the two fields it proves, and above the
|
|
782
1234
|
Advanced block it fills in — the middle of the sequence
|
|
@@ -795,13 +1247,13 @@ export function SetupScreen({ settings, onSaved, variant = 'setup', sync }: Prop
|
|
|
795
1247
|
// Also while SAVING: a save may be asking the remote
|
|
796
1248
|
// itself, and a second test racing it would overwrite
|
|
797
1249
|
// both the result and the versions derived from it.
|
|
798
|
-
disabled={testing || saving}
|
|
1250
|
+
disabled={testing || saving || retrying}
|
|
799
1251
|
>
|
|
800
1252
|
{testing ? 'Checking…' : 'Test connection'}
|
|
801
1253
|
</Button>
|
|
802
1254
|
<span className="text-meta text-ink-faint">
|
|
803
|
-
Checks the address and token against the host,
|
|
804
|
-
|
|
1255
|
+
Checks the address and token against the host, looks for the folders below,
|
|
1256
|
+
and fills in the versions.
|
|
805
1257
|
</span>
|
|
806
1258
|
</div>
|
|
807
1259
|
{test && (
|
|
@@ -821,6 +1273,13 @@ export function SetupScreen({ settings, onSaved, variant = 'setup', sync }: Prop
|
|
|
821
1273
|
</Surface>
|
|
822
1274
|
)}
|
|
823
1275
|
|
|
1276
|
+
{/* The layout: the three root folders and the agent guide's
|
|
1277
|
+
file name, in the main section, directly under the test
|
|
1278
|
+
whose listing the folders are checked against — the
|
|
1279
|
+
connection fields above it stay next to the button that
|
|
1280
|
+
proves them. */}
|
|
1281
|
+
{fields.filter((f) => isLayoutKey(f.key)).map((f) => renderField(f))}
|
|
1282
|
+
|
|
824
1283
|
{/* Everything a normal setup never touches, out of the way but
|
|
825
1284
|
not hidden: a self-hosted git server does need the token
|
|
826
1285
|
username, and a provider with unusual scopes does need
|
|
@@ -882,33 +1341,63 @@ export function SetupScreen({ settings, onSaved, variant = 'setup', sync }: Prop
|
|
|
882
1341
|
</Surface>
|
|
883
1342
|
)}
|
|
884
1343
|
|
|
885
|
-
{/*
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
// Described by the refusal, so a reader who lands on a button
|
|
896
|
-
// that will not move is told why rather than left guessing.
|
|
897
|
-
aria-describedby={connectionRejected ? 'connection-refusal' : undefined}
|
|
898
|
-
>
|
|
899
|
-
{saving ? 'Saving…' : 'Save and continue'}
|
|
900
|
-
</Button>
|
|
901
|
-
{connectionRejected && (
|
|
902
|
-
// Not a live region: the test panel above already announced the
|
|
903
|
-
// host's own words, and the save banner announces a blocked
|
|
904
|
-
// attempt. This is the label for a button that will not move.
|
|
905
|
-
<span id="connection-refusal" className="text-meta text-danger">
|
|
906
|
-
The repository turned that connection down. Fix it above and test again.
|
|
907
|
-
</span>
|
|
1344
|
+
{/* Every sign-in setting from the environment: the section above
|
|
1345
|
+
does not render, but whether that configuration works is still
|
|
1346
|
+
the admin's to see and to test. */}
|
|
1347
|
+
{editable.every((s) => s.section !== 'sign-in') &&
|
|
1348
|
+
verification &&
|
|
1349
|
+
verification !== 'not-configured' && (
|
|
1350
|
+
<Surface as="section" tone="surface" radius="lg" elevation="card" className="p-6 space-y-4">
|
|
1351
|
+
<h2 className="text-title font-semibold text-ink">Single sign-on</h2>
|
|
1352
|
+
{renderOidcPanel()}
|
|
1353
|
+
</Surface>
|
|
908
1354
|
)}
|
|
909
|
-
</div>
|
|
910
1355
|
</form>
|
|
911
1356
|
|
|
1357
|
+
{/* Outside the form: nothing in it is saved by "Save and continue",
|
|
1358
|
+
and on first run it is optional — the gate never waits on it. The
|
|
1359
|
+
same section in both variants, so first run and Deployment
|
|
1360
|
+
settings cannot drift. */}
|
|
1361
|
+
<MarketplaceSection variant={variant} />
|
|
1362
|
+
|
|
1363
|
+
{/* The submit button lives HERE, after Marketplace, though it belongs
|
|
1364
|
+
to the form above — `form=` is what lets those two facts hold at
|
|
1365
|
+
once. It is the last thing on the page because a reader should
|
|
1366
|
+
meet every section, Marketplace included, before the control that
|
|
1367
|
+
leaves the screen; when it sat above Marketplace, the page looked
|
|
1368
|
+
finished while a section was still below it.
|
|
1369
|
+
|
|
1370
|
+
A rejected connection stops here rather than at the far side of
|
|
1371
|
+
it. Saving these answers would finish setup — the server checks
|
|
1372
|
+
that they are present, not that they work — and open the app onto
|
|
1373
|
+
a repository it cannot reach, which reads as a broken product
|
|
1374
|
+
rather than a wrong token. */}
|
|
1375
|
+
<div className="mt-10 flex flex-wrap items-center justify-end gap-3">
|
|
1376
|
+
{connectionRejected && (
|
|
1377
|
+
// Before the button in the DOM so the reason is read first, and
|
|
1378
|
+
// so `justify-end` leaves the button itself at the right edge.
|
|
1379
|
+
// Not a live region: the test panel above already announced the
|
|
1380
|
+
// host's own words, and the save banner announces a blocked
|
|
1381
|
+
// attempt. This is the label for a button that will not move.
|
|
1382
|
+
<span id="connection-refusal" className="text-meta text-danger">
|
|
1383
|
+
{connectionReadOnly
|
|
1384
|
+
? 'That token can read the repository but cannot write to it. Grant write access and test again.'
|
|
1385
|
+
: 'The repository turned that connection down. Fix it above and test again.'}
|
|
1386
|
+
</span>
|
|
1387
|
+
)}
|
|
1388
|
+
<Button
|
|
1389
|
+
type="submit"
|
|
1390
|
+
form="setup-settings-form"
|
|
1391
|
+
variant="primary"
|
|
1392
|
+
disabled={saving || testing || retrying || oidcTesting || connectionRejected}
|
|
1393
|
+
// Described by the refusal, so a reader who lands on a button
|
|
1394
|
+
// that will not move is told why rather than left guessing.
|
|
1395
|
+
aria-describedby={connectionRejected ? 'connection-refusal' : undefined}
|
|
1396
|
+
>
|
|
1397
|
+
{saving ? 'Saving…' : 'Save and continue'}
|
|
1398
|
+
</Button>
|
|
1399
|
+
</div>
|
|
1400
|
+
|
|
912
1401
|
{fromEnv.length > 0 && (
|
|
913
1402
|
<Surface tone="sunken" radius="md" className="mt-10 p-4">
|
|
914
1403
|
<h2 className="text-label font-semibold uppercase text-ink-faint">
|