@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
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { Banner, Button, Dialog, TextField } from '../../../../shared/components';
|
|
3
|
+
import { deleteTool, getToolDependents, type ToolDependents } from '../../services/tools.api';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The "are you sure" a TOOL deletion deserves — and what makes it different
|
|
7
|
+
* from the plugin's is that a tool is something other things POINT AT. A
|
|
8
|
+
* plugin's contents go with it; a tool's dependents stay behind, broken: a
|
|
9
|
+
* skill whose `allowed-tools` names it, a plugin that carries it, and every
|
|
10
|
+
* credential stored under its name.
|
|
11
|
+
*
|
|
12
|
+
* So the dialog asks the backend first and says exactly what it found, before
|
|
13
|
+
* the confirm is worth reading. The counts are counts — never a value, never
|
|
14
|
+
* whose sign-in — because the point is to inform the owner, not to hand them
|
|
15
|
+
* other people's credentials.
|
|
16
|
+
*
|
|
17
|
+
* Who may open it is the caller's decision (plugin ownership); the backend
|
|
18
|
+
* enforces the same verdict for real, and its refusal is what this shows.
|
|
19
|
+
*
|
|
20
|
+
* And the confirm is the tool's NAME, typed. The plugin dialog is content of
|
|
21
|
+
* yours going with a folder of yours; this one also wipes credentials that are
|
|
22
|
+
* not the clicker's — other people's stored keys and sign-ins — so the hand
|
|
23
|
+
* that does it says the name first.
|
|
24
|
+
*/
|
|
25
|
+
export function DeleteToolDialog({
|
|
26
|
+
slug,
|
|
27
|
+
name,
|
|
28
|
+
onClose,
|
|
29
|
+
onDeleted,
|
|
30
|
+
}: {
|
|
31
|
+
slug: string;
|
|
32
|
+
/** The tool's name, for the title before the dependents arrive. */
|
|
33
|
+
name: string;
|
|
34
|
+
onClose(): void;
|
|
35
|
+
/** Fired after the delete lands, with the plugin the tool lived in. */
|
|
36
|
+
onDeleted(plugin: string): void;
|
|
37
|
+
}) {
|
|
38
|
+
const [dependents, setDependents] = useState<ToolDependents | null>(null);
|
|
39
|
+
const [loadError, setLoadError] = useState<string | null>(null);
|
|
40
|
+
const [busy, setBusy] = useState(false);
|
|
41
|
+
const [error, setError] = useState<string | null>(null);
|
|
42
|
+
const [typed, setTyped] = useState('');
|
|
43
|
+
const [shownFor, setShownFor] = useState(slug);
|
|
44
|
+
|
|
45
|
+
// A tool page can navigate to ANOTHER tool with this dialog still open, and
|
|
46
|
+
// the dependents read for the new slug does not resolve instantly. Clearing
|
|
47
|
+
// during the render that first sees the new slug — not in an effect, which
|
|
48
|
+
// runs after it — is what stops a confirmation typed for the old tool from
|
|
49
|
+
// arming Delete against the new one.
|
|
50
|
+
if (shownFor !== slug) {
|
|
51
|
+
setShownFor(slug);
|
|
52
|
+
setDependents(null);
|
|
53
|
+
setLoadError(null);
|
|
54
|
+
setError(null);
|
|
55
|
+
setTyped('');
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
let live = true;
|
|
60
|
+
getToolDependents(slug)
|
|
61
|
+
.then((d) => {
|
|
62
|
+
if (live) setDependents(d);
|
|
63
|
+
})
|
|
64
|
+
.catch((err: unknown) => {
|
|
65
|
+
// The one thing worse than a scary dialog is a confident one: if we
|
|
66
|
+
// could not read what depends on the tool, the delete is not offered.
|
|
67
|
+
if (live) setLoadError(err instanceof Error ? err.message : "Couldn't read what depends on this tool.");
|
|
68
|
+
});
|
|
69
|
+
return () => {
|
|
70
|
+
live = false;
|
|
71
|
+
};
|
|
72
|
+
}, [slug]);
|
|
73
|
+
|
|
74
|
+
async function remove() {
|
|
75
|
+
setBusy(true);
|
|
76
|
+
setError(null);
|
|
77
|
+
try {
|
|
78
|
+
const { plugin } = await deleteTool(slug);
|
|
79
|
+
onDeleted(plugin);
|
|
80
|
+
onClose();
|
|
81
|
+
} catch (err) {
|
|
82
|
+
// The backend's refusal names the rule (ownership, an external format,
|
|
83
|
+
// a refused push); a generic apology would hide the one thing worth
|
|
84
|
+
// reading.
|
|
85
|
+
setError(err instanceof Error ? err.message : "Couldn't delete the tool.");
|
|
86
|
+
setBusy(false);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// The name as the BACKEND spells it once it answers, so the thing typed is
|
|
91
|
+
// the thing deleted even if the page arrived with a stale label.
|
|
92
|
+
const confirmName = dependents?.name ?? name;
|
|
93
|
+
const ready = dependents !== null && loadError === null;
|
|
94
|
+
const confirmed = ready && typed.trim() === confirmName;
|
|
95
|
+
|
|
96
|
+
return (
|
|
97
|
+
<Dialog
|
|
98
|
+
open
|
|
99
|
+
onClose={onClose}
|
|
100
|
+
title={`Delete ${dependents?.name ?? name}?`}
|
|
101
|
+
size="md"
|
|
102
|
+
busy={busy}
|
|
103
|
+
footer={
|
|
104
|
+
<>
|
|
105
|
+
<Button variant="quiet" onClick={onClose} disabled={busy}>
|
|
106
|
+
Cancel
|
|
107
|
+
</Button>
|
|
108
|
+
<Button variant="danger" onClick={() => void remove()} disabled={busy || !confirmed}>
|
|
109
|
+
{busy ? 'Deleting…' : 'Delete tool'}
|
|
110
|
+
</Button>
|
|
111
|
+
</>
|
|
112
|
+
}
|
|
113
|
+
>
|
|
114
|
+
{loadError ? (
|
|
115
|
+
<Banner tone="danger" role="alert">
|
|
116
|
+
{loadError}
|
|
117
|
+
</Banner>
|
|
118
|
+
) : !dependents ? (
|
|
119
|
+
<p className="text-ui text-ink-muted">Checking what depends on this tool…</p>
|
|
120
|
+
) : (
|
|
121
|
+
<>
|
|
122
|
+
<p className="text-ui text-ink-muted">
|
|
123
|
+
{dependents.source === 'server'
|
|
124
|
+
? `This removes the ${dependents.name} server from ${dependents.plugin.displayName}'s configuration for everyone, and there is no undo — it survives only in git history.`
|
|
125
|
+
: `This deletes the ${dependents.name} tool from ${dependents.plugin.displayName} for everyone, and there is no undo — it survives only in git history.`}
|
|
126
|
+
</p>
|
|
127
|
+
<DependentList
|
|
128
|
+
// "You can see" is not modesty: the backend lists only the
|
|
129
|
+
// caller's readable skills, because naming one they cannot read
|
|
130
|
+
// would confirm it exists. An unqualified heading would present
|
|
131
|
+
// that subset as the whole truth.
|
|
132
|
+
label="Skills you can see that allow it"
|
|
133
|
+
items={dependents.skills.map((s) => s.name)}
|
|
134
|
+
// Said plainly, because it is the consequence people are most
|
|
135
|
+
// likely to be surprised by: the skills keep the name and break.
|
|
136
|
+
none="No skill you can see names it in its allowed tools."
|
|
137
|
+
tail="keep naming it in their allowed tools — those entries stop resolving."
|
|
138
|
+
tailOne="keeps naming it in its allowed tools — that entry stops resolving."
|
|
139
|
+
/>
|
|
140
|
+
<DependentList
|
|
141
|
+
label="Plugins that carry it"
|
|
142
|
+
items={dependents.plugins.map((p) => p.displayName)}
|
|
143
|
+
none="No other plugin carries it."
|
|
144
|
+
tail="lose it too."
|
|
145
|
+
tailOne="loses it too."
|
|
146
|
+
/>
|
|
147
|
+
<p className="mt-3 text-ui text-ink-muted">
|
|
148
|
+
{secretsLine(dependents.storedKeys, dependents.signIns)}
|
|
149
|
+
</p>
|
|
150
|
+
<label className="mt-4 block text-ui text-ink-muted" htmlFor={CONFIRM_FIELD_ID}>
|
|
151
|
+
{'Type '}
|
|
152
|
+
<span className="font-semibold text-ink">{confirmName}</span>
|
|
153
|
+
{' to confirm.'}
|
|
154
|
+
</label>
|
|
155
|
+
<TextField
|
|
156
|
+
id={CONFIRM_FIELD_ID}
|
|
157
|
+
className="mt-1.5"
|
|
158
|
+
value={typed}
|
|
159
|
+
autoComplete="off"
|
|
160
|
+
spellCheck={false}
|
|
161
|
+
disabled={busy}
|
|
162
|
+
onChange={(e) => setTyped(e.target.value)}
|
|
163
|
+
/>
|
|
164
|
+
</>
|
|
165
|
+
)}
|
|
166
|
+
{error && (
|
|
167
|
+
<Banner tone="danger" role="alert" className="mt-3">
|
|
168
|
+
{error}
|
|
169
|
+
</Banner>
|
|
170
|
+
)}
|
|
171
|
+
</Dialog>
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const CONFIRM_FIELD_ID = 'delete-tool-confirm';
|
|
176
|
+
|
|
177
|
+
/** One kind of dependent, named — or the honest "nothing" that saves a worry. */
|
|
178
|
+
function DependentList({
|
|
179
|
+
label,
|
|
180
|
+
items,
|
|
181
|
+
none,
|
|
182
|
+
tail,
|
|
183
|
+
tailOne,
|
|
184
|
+
}: {
|
|
185
|
+
label: string;
|
|
186
|
+
items: string[];
|
|
187
|
+
none: string;
|
|
188
|
+
tail: string;
|
|
189
|
+
tailOne: string;
|
|
190
|
+
}) {
|
|
191
|
+
return (
|
|
192
|
+
<div className="mt-3">
|
|
193
|
+
<p className="text-label font-semibold uppercase text-ink-faint">{label}</p>
|
|
194
|
+
{items.length === 0 ? (
|
|
195
|
+
<p className="text-ui text-ink-muted">{none}</p>
|
|
196
|
+
) : (
|
|
197
|
+
<p className="text-ui text-ink-muted">
|
|
198
|
+
<span className="font-semibold text-ink">{items.join(', ')}</span>{' '}
|
|
199
|
+
{items.length === 1 ? tailOne : tail}
|
|
200
|
+
</p>
|
|
201
|
+
)}
|
|
202
|
+
</div>
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* The credentials, as numbers. EVERY user's, not just the reader's — the whole
|
|
208
|
+
* reason the count comes from the backend is that a page can only see its own
|
|
209
|
+
* secrets, and "0" from a page that cannot see the others would be a lie.
|
|
210
|
+
*/
|
|
211
|
+
function secretsLine(keys: number, signIns: number): string {
|
|
212
|
+
const parts = [
|
|
213
|
+
keys > 0 ? `${keys} stored ${keys === 1 ? 'key' : 'keys'}` : null,
|
|
214
|
+
signIns > 0 ? `${signIns} ${signIns === 1 ? 'sign-in' : 'sign-ins'}` : null,
|
|
215
|
+
].filter(Boolean);
|
|
216
|
+
if (parts.length === 0) return 'Nothing is stored under its name.';
|
|
217
|
+
return `${parts.join(' and ')} stored under its name ${parts.length === 1 ? 'is' : 'are'} wiped.`;
|
|
218
|
+
}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import { useRef, useState } from 'react';
|
|
2
1
|
import { Link, useNavigate } from 'react-router-dom';
|
|
3
2
|
import { DEFAULT_BRANCH } from '@bevel-software/platform-shared';
|
|
4
3
|
import { Banner, Button, buttonClasses } from '../../../../shared/components';
|
|
4
|
+
import { announceToolCredentialsChanged } from '../../../../core/events';
|
|
5
5
|
import { useWorkspace } from '../../../workspace/state/workspace.context';
|
|
6
6
|
import { kbFileUrl } from '../../../workspace/routing/kb-routes';
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
type ProbeVerdict,
|
|
10
|
-
type ToolSecrets,
|
|
11
|
-
} from '../../../secrets-vault/services/tool-secrets.api';
|
|
7
|
+
import { useSavedKeyProbe } from '../../../secrets-vault/probe/useSavedKeyProbe';
|
|
8
|
+
import { type ToolSecrets } from '../../../secrets-vault/services/tool-secrets.api';
|
|
12
9
|
import { pathForTool } from '../../routes/library-paths';
|
|
13
10
|
import { toolStatus, toolVariableStatuses } from '../../utils/status';
|
|
14
11
|
import { ToolVarRow } from './ToolVarRow';
|
|
@@ -17,13 +14,23 @@ import { ToolVarRow } from './ToolVarRow';
|
|
|
17
14
|
* "Your connection" — what this tool still needs from you, and (if you own it)
|
|
18
15
|
* from you on everyone's behalf.
|
|
19
16
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
17
|
+
* A banner here names a CAUSE the rows cannot see; it never summarises them.
|
|
18
|
+
* There used to be a second one that did — "this tool needs 2 things before it
|
|
19
|
+
* works", then every missing label and status, sitting directly on top of rows
|
|
20
|
+
* that already carried those labels, those statuses and the buttons that fix
|
|
21
|
+
* them. What it really added was colour, so colour is what survived it: an
|
|
22
|
+
* unset row is drawn amber (see `ToolVarRow`'s `unset`), and the count is how
|
|
23
|
+
* many of them there are.
|
|
24
|
+
*
|
|
25
|
+
* The setup banner that remains passes that test, because `oauth-manual` is the
|
|
26
|
+
* one state the rows CANNOT explain on their own: the remote server wants a
|
|
27
|
+
* sign-in through an app the OWNER registers, so every row underneath is stuck
|
|
28
|
+
* through no fault of the person reading them. The banner names whose move it
|
|
29
|
+
* is — the owner's — and what the move is: declare the sign-in (the server
|
|
30
|
+
* editor on this page for an mcp.json server, the file itself for a `.tool`),
|
|
31
|
+
* then set its client secret. Once declared, only the secret remains and it
|
|
32
|
+
* says so. The rejected-credential banner passes it too: only a real call
|
|
33
|
+
* could know, so no row can.
|
|
27
34
|
*/
|
|
28
35
|
|
|
29
36
|
export interface ToolConnectionSectionProps {
|
|
@@ -50,53 +57,22 @@ export function ToolConnectionSection({
|
|
|
50
57
|
}: ToolConnectionSectionProps) {
|
|
51
58
|
const navigate = useNavigate();
|
|
52
59
|
const { kbDirName } = useWorkspace();
|
|
53
|
-
/** `{varName, n}` — bumping `n` opens that variable's editor from the banner. */
|
|
54
|
-
const [edit, setEdit] = useState<{ name: string; n: number }>({ name: '', n: 0 });
|
|
55
|
-
/**
|
|
56
|
-
* The revision of the probe in flight, or null. `checking` is DERIVED: an
|
|
57
|
-
* in-flight probe owns the Test button only while the definition it dials
|
|
58
|
-
* is still the one on screen, so a config edit mid-probe re-enables the
|
|
59
|
-
* button for the new definition immediately instead of waiting for the
|
|
60
|
-
* orphan to settle.
|
|
61
|
-
*/
|
|
62
|
-
const [inFlight, setInFlight] = useState<{ rev: number } | null>(null);
|
|
63
|
-
const checking = inFlight !== null && inFlight.rev === configRevision;
|
|
64
60
|
|
|
65
61
|
/**
|
|
66
|
-
*
|
|
67
|
-
* credential), held here rather than raised to the page's shared error
|
|
68
|
-
* banner. Page-level state outlived its subject twice over: another
|
|
69
|
-
* action's error could be cleared by a probe that happened to recover,
|
|
70
|
-
* and a probe of the PREVIOUS tool (this section is keyed by slug) could
|
|
71
|
-
* clear or raise it after unmount. Section state dies with the section,
|
|
72
|
-
* and the revision stamp makes it self-invalidating, exactly like the
|
|
73
|
-
* verdict: shown only while it describes the configuration on screen.
|
|
74
|
-
*/
|
|
75
|
-
const [probeError, setProbeError] = useState<{ rev: number; message: string } | null>(null);
|
|
76
|
-
const shownProbeError = probeError && probeError.rev === configRevision ? probeError.message : null;
|
|
77
|
-
/**
|
|
78
|
-
* The last probe's answer, and the ONLY place one exists.
|
|
62
|
+
* The probe, and the ONLY place its answer exists.
|
|
79
63
|
*
|
|
80
64
|
* Nothing persists a verdict, so this state IS the evidence behind the word
|
|
81
65
|
* "Connected" — which is why the claim can be trusted: it cannot outlive the
|
|
82
|
-
* page that watched the call succeed.
|
|
66
|
+
* page that watched the call succeed. Section state, not page state: a probe
|
|
67
|
+
* of the PREVIOUS tool (this section is keyed by slug) could otherwise raise
|
|
68
|
+
* or clear a page-level banner after unmount.
|
|
83
69
|
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
* effect that cleared on change would race the probe it is meant to protect,
|
|
87
|
-
* since a credential save starts a probe and a refetch at the same moment.
|
|
88
|
-
*/
|
|
89
|
-
const [probed, setProbed] = useState<{ rev: number; value: ProbeVerdict } | null>(null);
|
|
90
|
-
const verdict = probed && probed.rev === configRevision ? probed.value : null;
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Which probe is allowed to publish. Two saves in quick succession start two
|
|
94
|
-
* probes, and the first can answer last — so a result is applied only while
|
|
95
|
-
* it is still the newest one asked for. Without it the older credential's
|
|
96
|
-
* verdict wins by finishing late, which is the same stale-answer bug this
|
|
97
|
-
* whole feature exists to remove, one layer up.
|
|
70
|
+
* The revision is passed through as the hook's stamp, so an answer is read
|
|
71
|
+
* back only while it still describes the server definition on screen.
|
|
98
72
|
*/
|
|
99
|
-
const
|
|
73
|
+
const probe = useSavedKeyProbe(tool.slug, configRevision);
|
|
74
|
+
const { checking, verdict } = probe;
|
|
75
|
+
const shownProbeError = probe.result?.kind === 'unreachable' ? probe.result.message : null;
|
|
100
76
|
|
|
101
77
|
|
|
102
78
|
const setupKind = tool.setup?.kind ?? null;
|
|
@@ -113,59 +89,36 @@ export function ToolConnectionSection({
|
|
|
113
89
|
const isMcpJsonServer = tool.path.endsWith('/mcp.json');
|
|
114
90
|
|
|
115
91
|
/**
|
|
116
|
-
* The CONFIGURATION this tool is still missing,
|
|
92
|
+
* The CONFIGURATION this tool is still missing, by variable name.
|
|
117
93
|
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
* is the state of the TOOL; signing in is a step each PERSON takes, and the
|
|
124
|
-
* row is where personal steps live.
|
|
125
|
-
*/
|
|
126
|
-
const missing = toolVariableStatuses(tool).filter(
|
|
127
|
-
({ v, status }) => status.state !== 'ok' && !(v.oauth && v.adminConfigured),
|
|
128
|
-
);
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* The banner's one action — the first missing key the READER can enter.
|
|
94
|
+
* This list used to be prose in an amber banner above the rows — "needs 2
|
|
95
|
+
* things", then every label and status again — directly above rows already
|
|
96
|
+
* carrying the same labels, the same statuses and the buttons that fix
|
|
97
|
+
* them. The rows won: each one named here is drawn amber, and the count the
|
|
98
|
+
* banner gave is how many amber rows there are.
|
|
132
99
|
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
100
|
+
* Only configuration gaps qualify: keys nobody has entered, owner-side setup
|
|
101
|
+
* nobody has finished. A pending sign-in on a fully configured provider is
|
|
102
|
+
* deliberately NOT here — configuration is the state of the TOOL, while
|
|
103
|
+
* signing in is a step each PERSON takes, and its row already offers the
|
|
104
|
+
* Sign in button without needing to be flagged as unfinished setup.
|
|
138
105
|
*/
|
|
139
|
-
const
|
|
140
|
-
(
|
|
106
|
+
const unset = new Set(
|
|
107
|
+
toolVariableStatuses(tool)
|
|
108
|
+
.filter(({ v, status }) => status.state !== 'ok' && !(v.oauth && v.adminConfigured))
|
|
109
|
+
.map(({ v }) => v.name),
|
|
141
110
|
);
|
|
142
111
|
|
|
143
|
-
// The aria-label carries the variable so the banner's button and the row's
|
|
144
|
-
// never share an accessible name — same words to the eye, distinct to a
|
|
145
|
-
// screen reader and to the tests.
|
|
146
|
-
const bannerAction = actionable ? (
|
|
147
|
-
<Button
|
|
148
|
-
variant="primary"
|
|
149
|
-
size="sm"
|
|
150
|
-
aria-label={`${actionable.v.scope === 'user' ? 'Add key' : 'Set key'}: ${
|
|
151
|
-
actionable.v.label ?? actionable.v.name
|
|
152
|
-
}`}
|
|
153
|
-
onClick={() => setEdit((e) => ({ name: actionable.v.name, n: e.n + 1 }))}
|
|
154
|
-
>
|
|
155
|
-
{actionable.v.scope === 'user' ? 'Add key' : 'Set key'}
|
|
156
|
-
</Button>
|
|
157
|
-
) : null;
|
|
158
|
-
|
|
159
112
|
/**
|
|
160
113
|
* The health line, shown only once every variable is provided.
|
|
161
114
|
*
|
|
162
|
-
* While something is still missing, the amber
|
|
115
|
+
* While something is still missing, the amber rows below already name it,
|
|
163
116
|
* and a second line saying the connection is untested would be answering a
|
|
164
117
|
* question nobody has reached yet. Once nothing is missing, this is the only
|
|
165
118
|
* remaining question — and the one the badge used to answer by guessing.
|
|
166
119
|
*/
|
|
167
120
|
const health = toolStatus(tool, verdict);
|
|
168
|
-
// Every variable genuinely provided — NOT merely `
|
|
121
|
+
// Every variable genuinely provided — NOT merely `unset.size === 0`, which
|
|
169
122
|
// excludes a pending sign-in on a configured provider. A tool nobody has
|
|
170
123
|
// signed into yet has no credential to test, and saying so would put a health
|
|
171
124
|
// line above a row that already says "Needs your sign-in".
|
|
@@ -181,66 +134,26 @@ export function ToolConnectionSection({
|
|
|
181
134
|
!setupUnfinished && toolVariableStatuses(tool).every(({ status }) => status.state === 'ok');
|
|
182
135
|
|
|
183
136
|
/**
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
* `checking` lives here, beside the button it disables, so it is still true
|
|
187
|
-
* while the request is in flight — the reason a save no longer blanks the
|
|
188
|
-
* page (see `useToolPage`): a remount would drop both this flag and the
|
|
189
|
-
* verdict, leaving an enabled "Test connection" over a probe already running.
|
|
190
|
-
*/
|
|
191
|
-
async function runCheck() {
|
|
192
|
-
const mine = ++probeSeq.current;
|
|
193
|
-
const rev = configRevision;
|
|
194
|
-
setInFlight({ rev });
|
|
195
|
-
// A replacement probe makes the previous transport failure history the
|
|
196
|
-
// moment it starts — leaving the alert up while "Testing…" runs reads as
|
|
197
|
-
// the new attempt already having failed.
|
|
198
|
-
setProbeError(null);
|
|
199
|
-
try {
|
|
200
|
-
const value = await checkToolConnection(tool.slug);
|
|
201
|
-
// Newest-probe guard only: everything published is REVISION-STAMPED
|
|
202
|
-
// and compared at render, so a probe that raced a definition change
|
|
203
|
-
// stores state that simply never shows — no clock to synchronise, no
|
|
204
|
-
// ref to read mid-render.
|
|
205
|
-
if (probeSeq.current === mine) {
|
|
206
|
-
setProbed({ rev, value });
|
|
207
|
-
setProbeError(null);
|
|
208
|
-
}
|
|
209
|
-
} catch (err) {
|
|
210
|
-
// A rejected credential resolves with `status: 'failed'`; only a
|
|
211
|
-
// transport or access failure lands here, and that is not a verdict about
|
|
212
|
-
// the credential — so the badge keeps saying "untested" rather than
|
|
213
|
-
// inventing a result from our own network trouble.
|
|
214
|
-
// Inside the guard too: an older probe rejecting after a newer one has
|
|
215
|
-
// already answered would otherwise raise a transport error over a verdict
|
|
216
|
-
// that is currently correct.
|
|
217
|
-
if (probeSeq.current === mine) {
|
|
218
|
-
setProbed(null);
|
|
219
|
-
setProbeError({ rev, message: err instanceof Error ? err.message : "Couldn't test this connection." });
|
|
220
|
-
}
|
|
221
|
-
} finally {
|
|
222
|
-
// Only the newest probe releases the slot: an older one finishing late
|
|
223
|
-
// must not clear a newer probe's in-flight marker.
|
|
224
|
-
if (probeSeq.current === mine) setInFlight(null);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* A credential write LANDED (save or delete, from the banner's editor or a
|
|
230
|
-
* row). Everything a pending probe could still say is about a credential
|
|
137
|
+
* A credential write LANDED (save or delete, from a row's editor).
|
|
138
|
+
* Everything a pending probe could still say is about a credential
|
|
231
139
|
* that no longer exists in that form, so the write ORPHANS it outright —
|
|
232
140
|
* the sequence bump takes its voice (a delete starts no replacement probe,
|
|
233
141
|
* so nothing else would), the in-flight slot is released, and the old
|
|
234
142
|
* transport alert goes with them.
|
|
235
143
|
*/
|
|
236
144
|
function changed() {
|
|
237
|
-
|
|
238
|
-
setInFlight(null);
|
|
239
|
-
setProbeError(null);
|
|
240
|
-
// The VERDICT too: after a delete, “Connected” would otherwise keep
|
|
145
|
+
// The VERDICT goes too: after a delete, “Connected” would otherwise keep
|
|
241
146
|
// describing a credential that no longer exists while the refetch is
|
|
242
147
|
// still in flight.
|
|
243
|
-
|
|
148
|
+
probe.forget();
|
|
149
|
+
// And the rest of the Library, which derives "needs setup" from a catalog
|
|
150
|
+
// loaded before this write: the card, the plugin banner and the sidebar
|
|
151
|
+
// count all keep the old answer otherwise, and the reader meets it the
|
|
152
|
+
// moment they press back. Announced HERE, on the landing, rather than
|
|
153
|
+
// after the probe — what the catalog believes about a stored key does not
|
|
154
|
+
// depend on whether the provider likes it, and making the reload wait for
|
|
155
|
+
// a round-trip nobody is watching only widens the stale window.
|
|
156
|
+
announceToolCredentialsChanged();
|
|
244
157
|
onChanged();
|
|
245
158
|
}
|
|
246
159
|
|
|
@@ -249,11 +162,10 @@ export function ToolConnectionSection({
|
|
|
249
162
|
* the key it replaced, so drop it and test the new one straight away —
|
|
250
163
|
* while the user still has it to hand, which is when a wrong key is
|
|
251
164
|
* cheapest to fix. (The row calls `changed` too, which orphans the old
|
|
252
|
-
* probe; the fresh
|
|
165
|
+
* probe; the fresh probe claims the sequence for the new key.)
|
|
253
166
|
*/
|
|
254
167
|
function onSaved() {
|
|
255
|
-
|
|
256
|
-
void runCheck();
|
|
168
|
+
probe.probeSaved();
|
|
257
169
|
}
|
|
258
170
|
|
|
259
171
|
return (
|
|
@@ -275,15 +187,15 @@ export function ToolConnectionSection({
|
|
|
275
187
|
{settled && (
|
|
276
188
|
<Button
|
|
277
189
|
variant="quiet"
|
|
278
|
-
size="
|
|
190
|
+
size="sm"
|
|
279
191
|
disabled={checking}
|
|
280
|
-
onClick={() => void
|
|
192
|
+
onClick={() => void probe.run()}
|
|
281
193
|
aria-label={`Test connection: ${tool.name}`}
|
|
282
194
|
>
|
|
283
195
|
{checking ? 'Testing…' : 'Test connection'}
|
|
284
196
|
</Button>
|
|
285
197
|
)}
|
|
286
|
-
<Link to="/secrets" className={buttonClasses({ variant: 'quiet', size: '
|
|
198
|
+
<Link to="/secrets" className={buttonClasses({ variant: 'quiet', size: 'sm' })}>
|
|
287
199
|
Open Secrets
|
|
288
200
|
</Link>
|
|
289
201
|
</div>
|
|
@@ -295,6 +207,17 @@ export function ToolConnectionSection({
|
|
|
295
207
|
</Banner>
|
|
296
208
|
)}
|
|
297
209
|
|
|
210
|
+
{/* Why the word above says "Unverified" — the manual defines no health
|
|
211
|
+
check, so there was nothing to call. A quiet LINE, not a banner: the
|
|
212
|
+
key is saved, nothing is broken and nobody has to act, but a word
|
|
213
|
+
that hides its reason has only moved the question. The tooltip alone
|
|
214
|
+
is not enough — it is unreachable on touch and to a screen reader. */}
|
|
215
|
+
{settled && verdict?.status === 'unverifiable' && (
|
|
216
|
+
<p className="mb-2.5 text-detail text-ink-muted" data-testid="tool-health-unverified">
|
|
217
|
+
{health.hint}
|
|
218
|
+
</p>
|
|
219
|
+
)}
|
|
220
|
+
|
|
298
221
|
{setupUnfinished && (
|
|
299
222
|
<Banner tone="wait" role="status" className="mb-2.5">
|
|
300
223
|
{tool.canWrite && signInDeclared ? (
|
|
@@ -315,11 +238,11 @@ export function ToolConnectionSection({
|
|
|
315
238
|
{kbDirName && !isMcpJsonServer && (
|
|
316
239
|
<Button
|
|
317
240
|
variant="quiet"
|
|
318
|
-
size="
|
|
241
|
+
size="sm"
|
|
319
242
|
className="mt-1.5"
|
|
320
|
-
// `rawFile`
|
|
321
|
-
// the tool page's own canonical address, and the
|
|
322
|
-
// wants the
|
|
243
|
+
// `rawFile` asks the item route for the raw editor: this
|
|
244
|
+
// URL is the tool page's own canonical address, and the
|
|
245
|
+
// button wants the file behind it — still in this app.
|
|
323
246
|
onClick={() =>
|
|
324
247
|
navigate(kbFileUrl(DEFAULT_BRANCH, `${kbDirName}/${tool.path}`), {
|
|
325
248
|
state: { rawFile: true },
|
|
@@ -339,28 +262,6 @@ export function ToolConnectionSection({
|
|
|
339
262
|
</Banner>
|
|
340
263
|
)}
|
|
341
264
|
|
|
342
|
-
{/* Suppressed while the sign-in setup banner is up: that one names a
|
|
343
|
-
cause, this one would only re-list its symptoms. */}
|
|
344
|
-
{missing.length > 0 && !setupUnfinished && (
|
|
345
|
-
<Banner tone="wait" role="status" className="mb-2.5">
|
|
346
|
-
<div className="flex items-center gap-3">
|
|
347
|
-
<span className="min-w-0 flex-1">
|
|
348
|
-
<span className="font-semibold">
|
|
349
|
-
{missing.length === 1
|
|
350
|
-
? 'This tool is not connected yet.'
|
|
351
|
-
: `This tool needs ${missing.length} things before it works.`}
|
|
352
|
-
</span>{' '}
|
|
353
|
-
<span>
|
|
354
|
-
{missing
|
|
355
|
-
.map(({ v, status }) => `${v.label ?? v.name}: ${status.text}`)
|
|
356
|
-
.join(' · ')}
|
|
357
|
-
</span>
|
|
358
|
-
</span>
|
|
359
|
-
{bannerAction && <span className="shrink-0">{bannerAction}</span>}
|
|
360
|
-
</div>
|
|
361
|
-
</Banner>
|
|
362
|
-
)}
|
|
363
|
-
|
|
364
265
|
{/* The one health state that needs a person: the provider tested this
|
|
365
266
|
credential and refused it. Everything is configured, so no other
|
|
366
267
|
banner covers it, and the row below cannot know — only a real call
|
|
@@ -389,7 +290,7 @@ export function ToolConnectionSection({
|
|
|
389
290
|
canWrite={tool.canWrite}
|
|
390
291
|
setupKind={setupKind}
|
|
391
292
|
returnTo={pathForTool(tool.slug)}
|
|
392
|
-
|
|
293
|
+
unset={unset.has(variable.name)}
|
|
393
294
|
onChanged={changed}
|
|
394
295
|
// Test the moment a key is entered — while the user still has it
|
|
395
296
|
// to hand, which is when a typo is cheapest to fix. Waiting for
|