@bevel-software/platform-core-frontend 0.14.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD-PARTY-NOTICES.md +2 -2
- package/package.json +3 -3
- package/src/core/CoreAppShell.tsx +34 -26
- package/src/core/__tests__/AppChrome.test.tsx +0 -3
- package/src/core/__tests__/bootstrap.test.ts +33 -1
- package/src/core/__tests__/events.test.ts +43 -0
- package/src/core/bootstrap.ts +38 -1
- package/src/core/events.ts +85 -3
- package/src/core/registry.ts +1 -1
- package/src/lib/__tests__/api.test.ts +38 -0
- package/src/lib/__tests__/email.test.ts +44 -0
- package/src/lib/api.ts +19 -2
- package/src/lib/email.ts +37 -1
- package/src/lib/utils.ts +2 -0
- package/src/modules/access/__tests__/ManageAccessDialog.add-row-picking.test.tsx +141 -0
- package/src/modules/access/__tests__/ManageAccessDialog.chip-truncation.test.tsx +204 -0
- package/src/modules/access/__tests__/ManageAccessDialog.download-read.test.tsx +234 -0
- package/src/modules/access/__tests__/ManageAccessDialog.edited-row-visible.test.tsx +160 -0
- package/src/modules/access/__tests__/ManageAccessDialog.placement.test.tsx +2 -2
- package/src/modules/access/__tests__/ManageAccessDialog.proposal.test.tsx +166 -0
- package/src/modules/access/__tests__/ManageAccessDialog.restrict.test.tsx +510 -0
- package/src/modules/access/__tests__/ManageAccessDialog.row-menu-axes.test.tsx +299 -0
- package/src/modules/access/__tests__/ManageAccessDialog.row-menu-width.test.tsx +226 -0
- package/src/modules/access/__tests__/ManageAccessDialog.test.tsx +781 -76
- package/src/modules/access/__tests__/ManageAccessDialog.unknown-email.test.tsx +314 -0
- package/src/modules/access/__tests__/manage-access-affordance.test.ts +14 -0
- package/src/modules/access/__tests__/plugin-token.test.ts +21 -0
- package/src/modules/access/__tests__/tailwindDeclarations.ts +210 -0
- package/src/modules/access/api.ts +192 -10
- package/src/modules/access/components/ManageAccessDialog.tsx +1337 -570
- package/src/modules/access/manage-access-affordance.ts +17 -0
- package/src/modules/admin/__tests__/AddMemberInput.test.tsx +297 -0
- package/src/modules/admin/__tests__/AdminRolesPage.capabilities.test.tsx +2 -2
- package/src/modules/admin/__tests__/AdminRolesPage.fixed-admin.test.tsx +189 -0
- package/src/modules/admin/__tests__/AdminRolesPage.suggest.test.tsx +1 -1
- package/src/modules/admin/__tests__/ConnectionKeysPage.test.tsx +266 -0
- package/src/modules/admin/__tests__/DirectoryGroupsPage.suggest.test.tsx +182 -0
- package/src/modules/admin/__tests__/DirectoryGroupsPage.test.tsx +165 -14
- package/src/modules/admin/__tests__/UserAccountsPage.test.tsx +401 -4
- package/src/modules/admin/__tests__/group-members-path.test.ts +27 -0
- package/src/modules/admin/components/AddMemberInput.tsx +268 -0
- package/src/modules/admin/components/AdminRolesPage.tsx +97 -132
- package/src/modules/admin/components/ConnectionKeysPage.tsx +269 -0
- package/src/modules/admin/components/DirectoryGroupsPage.tsx +91 -39
- package/src/modules/admin/components/UserAccountsPage.tsx +271 -37
- package/src/modules/admin/components/connection-keys-grouping.ts +43 -0
- package/src/modules/admin/components/group-members-path.ts +32 -0
- package/src/modules/admin/services/connection-keys.api.ts +47 -0
- package/src/modules/admin/services/roles.api.ts +12 -1
- package/src/modules/auth/__tests__/AccountPage.test.tsx +50 -2
- package/src/modules/auth/components/AccountPage.tsx +73 -54
- package/src/modules/auth/components/LoginScreen.tsx +1 -0
- package/src/modules/auth/services/account.api.ts +78 -4
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.access-rules.test.tsx +144 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.binary.test.tsx +422 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.brings-itself-up-to-date.test.tsx +431 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.fork-point.test.tsx +193 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.initial-file.test.tsx +142 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.moved.test.tsx +202 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.test.tsx +205 -13
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.unreadable.test.tsx +271 -0
- package/src/modules/change-requests/__tests__/FileChangeBoxes.test.tsx +208 -0
- package/src/modules/change-requests/__tests__/apply-outcome-for-every-viewer.test.tsx +286 -0
- package/src/modules/change-requests/__tests__/propose.concurrent.test.ts +273 -0
- package/src/modules/change-requests/__tests__/readFailure.test.ts +122 -0
- package/src/modules/change-requests/__tests__/useCrFileDiffs.test.tsx +238 -0
- package/src/modules/change-requests/__tests__/useFileOnBranch.test.tsx +56 -1
- package/src/modules/change-requests/__tests__/useForkPointFile.test.tsx +79 -0
- package/src/modules/change-requests/components/BranchFilePreview.tsx +357 -0
- package/src/modules/change-requests/components/ChangeBox.tsx +31 -2
- package/src/modules/change-requests/components/ChangeRequestDialog.tsx +862 -72
- package/src/modules/change-requests/components/CrFileTree.tsx +74 -58
- package/src/modules/change-requests/components/FileChangeBoxes.tsx +19 -15
- package/src/modules/change-requests/hooks/useApplyChangeRequest.ts +41 -7
- package/src/modules/change-requests/hooks/useCrFileDiffs.ts +181 -23
- package/src/modules/change-requests/hooks/useFileOnBranch.ts +70 -7
- package/src/modules/change-requests/hooks/useForkPointFile.ts +77 -0
- package/src/modules/change-requests/services/change-requests.api.ts +57 -1
- package/src/modules/change-requests/services/denied-file.api.ts +53 -0
- package/src/modules/change-requests/services/propose.api.ts +97 -8
- package/src/modules/change-requests/utils/approval.ts +15 -0
- package/src/modules/change-requests/utils/author.ts +32 -0
- package/src/modules/change-requests/utils/readFailure.ts +110 -0
- package/src/modules/git/__tests__/FileHistoryPanel.test.tsx +20 -0
- package/src/modules/git/__tests__/GitSyncFailedBanner.test.tsx +65 -1
- package/src/modules/git/components/FileHistoryPanel.tsx +5 -0
- package/src/modules/git/components/GitSyncFailedBanner.tsx +68 -5
- package/src/modules/git/components/PullRequestsForMe.tsx +51 -24
- package/src/modules/git/services/__tests__/error-messages.test.ts +29 -0
- package/src/modules/git/services/error-messages.ts +12 -0
- package/src/modules/git/services/pr-prompts.ts +5 -5
- package/src/modules/layout/__tests__/HeaderAlignment.test.tsx +401 -0
- package/src/modules/layout/__tests__/SidebarFooterGrid.test.tsx +286 -0
- package/src/modules/layout/__tests__/SidebarFrameResponsive.test.tsx +61 -0
- package/src/modules/layout/components/AppLayout.tsx +2 -0
- package/src/modules/layout/components/MobileChatLayout.tsx +4 -1
- package/src/modules/layout/components/ResizableThreePaneLayout.tsx +4 -1
- package/src/modules/layout/components/SidebarFrame.tsx +109 -4
- package/src/modules/library/__tests__/AddToPluginDialog.test.tsx +171 -5
- package/src/modules/library/__tests__/DeleteToolDialog.test.tsx +356 -0
- package/src/modules/library/__tests__/IntegrationsSetupReminder.test.tsx +60 -0
- package/src/modules/library/__tests__/LibraryCard.test.tsx +91 -10
- package/src/modules/library/__tests__/LibraryRoutes.test.tsx +242 -107
- package/src/modules/library/__tests__/LibrarySidebarMenu.test.tsx +104 -99
- package/src/modules/library/__tests__/LinkSkillPanel.test.tsx +136 -0
- package/src/modules/library/__tests__/LockedPluginView.test.tsx +103 -7
- package/src/modules/library/__tests__/NewPluginDialog.test.tsx +18 -8
- package/src/modules/library/__tests__/PersonalAddDialog.test.tsx +79 -3
- package/src/modules/library/__tests__/PersonalPluginPage.test.tsx +201 -0
- package/src/modules/library/__tests__/PluginExtras.test.tsx +115 -9
- package/src/modules/library/__tests__/PluginJoinRequests.test.tsx +60 -1
- package/src/modules/library/__tests__/PluginPage.test.tsx +453 -7
- package/src/modules/library/__tests__/PluginsSidebar.contextmenu.test.tsx +17 -57
- package/src/modules/library/__tests__/PluginsSidebar.test.tsx +161 -97
- package/src/modules/library/__tests__/PluginsSidebarMenu.test.tsx +16 -0
- package/src/modules/library/__tests__/SharedViaPlugins.test.tsx +106 -0
- package/src/modules/library/__tests__/SkillPage.test.tsx +391 -78
- package/src/modules/library/__tests__/SkillsTree.test.tsx +461 -0
- package/src/modules/library/__tests__/ToolConnectionSection.test.tsx +582 -71
- package/src/modules/library/__tests__/ToolPage.test.tsx +94 -4
- package/src/modules/library/__tests__/WorkspaceItemRoute.test.tsx +279 -21
- package/src/modules/library/__tests__/auth-harness.tsx +9 -9
- package/src/modules/library/__tests__/card-row-menu.test.tsx +320 -0
- package/src/modules/library/__tests__/library-data.mapping.test.tsx +98 -0
- package/src/modules/library/__tests__/library-data.stale.test.tsx +183 -0
- package/src/modules/library/__tests__/library-data.test.ts +7 -0
- package/src/modules/library/__tests__/library-paths.test.ts +75 -0
- package/src/modules/library/__tests__/link-membership.test.ts +129 -0
- package/src/modules/library/__tests__/name-with-badges.test.tsx +273 -0
- package/src/modules/library/__tests__/newSkillMarkdown.test.ts +30 -0
- package/src/modules/library/__tests__/owner-pill.test.tsx +357 -0
- package/src/modules/library/__tests__/pending-tools.test.tsx +400 -0
- package/src/modules/library/__tests__/plugin-entries.test.ts +122 -0
- package/src/modules/library/__tests__/plugin-summary.test.ts +67 -0
- package/src/modules/library/__tests__/status.test.ts +82 -2
- package/src/modules/library/__tests__/tools.api.test.ts +44 -1
- package/src/modules/library/__tests__/useJoinRequests.test.tsx +46 -0
- package/src/modules/library/components/AccessRequestsBanner.tsx +85 -47
- package/src/modules/library/components/AddDialogTabs.tsx +103 -0
- package/src/modules/library/components/AddToPluginDialog.tsx +107 -18
- package/src/modules/library/components/IntegrationsSetupReminder.tsx +59 -0
- package/src/modules/library/components/ItemActionsMenu.tsx +288 -0
- package/src/modules/library/components/LibraryCard.tsx +149 -34
- package/src/modules/library/components/LibraryLayout.tsx +120 -247
- package/src/modules/library/components/LibraryPage.tsx +172 -39
- package/src/modules/library/components/LinkSkillPanel.tsx +169 -0
- package/src/modules/library/components/LockedPluginView.tsx +63 -35
- package/src/modules/library/components/NameWithBadges.tsx +164 -0
- package/src/modules/library/components/NewPluginDialog.tsx +19 -5
- package/src/modules/library/components/PageActions.tsx +31 -9
- package/src/modules/library/components/{PendingSkillReview.tsx → PendingItemReview.tsx} +14 -7
- package/src/modules/library/components/PersonalAddDialog.tsx +68 -18
- package/src/modules/library/components/PersonalPluginPage.tsx +123 -23
- package/src/modules/library/components/PluginExtras.tsx +143 -18
- package/src/modules/library/components/PluginIndexRow.tsx +47 -12
- package/src/modules/library/components/PluginPage.tsx +234 -38
- package/src/modules/library/components/PluginRows.tsx +286 -0
- package/src/modules/library/components/PluginsSidebar.tsx +271 -238
- package/src/modules/library/components/PluginsSidebarMenu.tsx +26 -1
- package/src/modules/library/components/RenamePluginDialog.tsx +136 -0
- package/src/modules/library/components/ShareButton.tsx +17 -0
- package/src/modules/library/components/SkillsTree.tsx +204 -0
- package/src/modules/library/components/StatusDot.tsx +1 -0
- package/src/modules/library/components/TeamRoute.tsx +15 -0
- package/src/modules/library/components/__tests__/upload-notices-once-per-page.test.tsx +144 -0
- package/src/modules/library/components/plugin-page-parts.tsx +132 -23
- package/src/modules/library/components/skill-page/SharedViaPlugins.tsx +212 -0
- package/src/modules/library/components/skill-page/SkillFilePane.tsx +5 -0
- package/src/modules/library/components/skill-page/SkillPage.tsx +337 -121
- package/src/modules/library/components/tool-page/DeleteToolDialog.tsx +218 -0
- package/src/modules/library/components/tool-page/ToolConnectionSection.tsx +79 -178
- package/src/modules/library/components/tool-page/ToolPage.tsx +116 -17
- package/src/modules/library/components/tool-page/ToolVarRow.tsx +42 -41
- package/src/modules/library/hooks/__tests__/useLibraryData.test.ts +98 -0
- package/src/modules/library/hooks/useJoinRequests.ts +48 -18
- package/src/modules/library/hooks/useLibraryData.ts +92 -19
- package/src/modules/library/routes/LibraryRoutes.tsx +14 -11
- package/src/modules/library/routes/WorkspaceItemRoute.tsx +229 -82
- package/src/modules/library/routes/library-paths.ts +46 -35
- package/src/modules/library/services/library.api.ts +89 -17
- package/src/modules/library/services/plugins.api.ts +161 -9
- package/src/modules/library/services/teams.api.ts +15 -0
- package/src/modules/library/services/tools.api.ts +78 -0
- package/src/modules/library/state/library-data.tsx +268 -37
- package/src/modules/library/utils/personal-plugin.ts +13 -15
- package/src/modules/library/utils/plugin-entries.ts +134 -0
- package/src/modules/library/utils/plugin-summary.ts +102 -0
- package/src/modules/library/utils/status.ts +204 -35
- package/src/modules/onboarding/__tests__/creator-welcome.test.tsx +11 -3
- package/src/modules/onboarding/__tests__/onboarding.test.tsx +853 -760
- package/src/modules/onboarding/agent-clients.ts +55 -23
- package/src/modules/onboarding/components/ConnectAgentPill.tsx +5 -1
- package/src/modules/onboarding/components/WelcomePage.tsx +98 -62
- package/src/modules/pr/services/pr-merge.api.ts +2 -1
- package/src/modules/review/components/MarkdownDiffViewer.tsx +53 -8
- package/src/modules/review/components/ReviewPanel.tsx +15 -17
- package/src/modules/review/components/__tests__/MarkdownDiffViewer.test.tsx +64 -0
- package/src/modules/review/components/__tests__/ReviewPanel.test.tsx +25 -1
- package/src/modules/secrets-vault/components/ConnectToolsPage.tsx +454 -117
- package/src/modules/secrets-vault/components/SecretsPage.tsx +48 -7
- package/src/modules/secrets-vault/components/ToolSecretsPanel.tsx +84 -5
- package/src/modules/secrets-vault/components/__tests__/ConnectToolsPage.test.tsx +425 -0
- package/src/modules/secrets-vault/components/__tests__/SecretsPage.test.tsx +417 -82
- package/src/modules/secrets-vault/components/__tests__/ToolSecretsPanel.test.tsx +105 -0
- package/src/modules/secrets-vault/components/__tests__/connect-lists-what-the-banner-counted.test.tsx +407 -0
- package/src/modules/secrets-vault/probe/SavedKeyProbeResult.tsx +98 -0
- package/src/modules/secrets-vault/probe/__tests__/probe-verdict.test.ts +160 -0
- package/src/modules/secrets-vault/probe/probe-verdict.ts +108 -0
- package/src/modules/secrets-vault/probe/useSavedKeyProbe.ts +228 -0
- package/src/modules/secrets-vault/services/connect.api.ts +36 -5
- package/src/modules/secrets-vault/utils/connect-status.ts +98 -0
- package/src/modules/settings/components/ClaudeConnectionCard.tsx +154 -0
- package/src/modules/settings/components/ClaudeConnectionFields.tsx +23 -0
- package/src/modules/settings/components/DeploymentPage.tsx +16 -22
- package/src/modules/settings/components/MarketplaceSection.tsx +152 -0
- package/src/modules/settings/components/__tests__/ClaudeConnectionCard.test.tsx +63 -0
- package/src/modules/settings/components/__tests__/DeploymentPage.test.tsx +74 -1
- package/src/modules/settings/components/__tests__/MarketplaceSection.test.tsx +325 -0
- package/src/modules/settings/components/__tests__/SettingsLayout.test.tsx +5 -5
- package/src/modules/settings/services/github-facade.api.ts +66 -0
- package/src/modules/settings/settings-nav-items.tsx +10 -2
- package/src/modules/setup/__tests__/setup.oidc.test.tsx +172 -0
- package/src/modules/setup/__tests__/setup.probe-refusal.test.tsx +123 -0
- package/src/modules/setup/__tests__/setup.test.tsx +615 -4
- package/src/modules/setup/__tests__/useSetupStatus.test.tsx +130 -0
- package/src/modules/setup/components/SetupGate.tsx +16 -16
- package/src/modules/setup/components/SetupScreen.tsx +711 -40
- package/src/modules/setup/hooks/useSetupStatus.ts +93 -0
- package/src/modules/setup/services/setup.api.ts +218 -3
- package/src/modules/setup/utils/__tests__/root-folders.test.ts +72 -0
- package/src/modules/setup/utils/root-folders.ts +46 -0
- package/src/modules/toolbar/assets/claude-setup/01-add-manually.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/02-add-configuration.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/03-connect-account.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/04-pick-instance.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/05-plugins-add.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/06-add-marketplace.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/07-paste-url-sync.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/08-install-plugins.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/09-select-repository.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/10-connector-not-added.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/11-add-custom-connector.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/README.md +68 -0
- package/src/modules/toolbar/components/AgentInstructionsCard.tsx +296 -0
- package/src/modules/toolbar/components/ClaudeMarketplaceCarousel.tsx +107 -0
- package/src/modules/toolbar/components/ClaudeRegistrationSteps.tsx +127 -0
- package/src/modules/toolbar/components/CoworkSetupSteps.tsx +100 -0
- package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +395 -124
- package/src/modules/toolbar/components/ScreenshotStep.tsx +77 -0
- package/src/modules/toolbar/components/SetupCarousel.tsx +177 -0
- package/src/modules/toolbar/components/__tests__/AgentInstructionsCard.test.tsx +370 -0
- package/src/modules/toolbar/components/__tests__/ExternalAgentAccessPage.test.tsx +659 -36
- package/src/modules/toolbar/components/__tests__/Toolbar.test.tsx +2 -2
- package/src/modules/toolbar/components/__tests__/claude-setup-shots.test.ts +104 -0
- package/src/modules/toolbar/components/claude-connector-slide.tsx +38 -0
- package/src/modules/toolbar/components/claude-setup-shots.ts +167 -0
- package/src/modules/toolbar/components/deployment-address.ts +29 -0
- package/src/modules/toolbar/components/setup-step-parts.tsx +35 -0
- package/src/modules/toolbar/services/__tests__/agent-instructions.api.test.ts +89 -0
- package/src/modules/toolbar/services/agent-instructions.api.ts +167 -0
- package/src/modules/toolbar/services/external-api-keys.api.ts +8 -0
- package/src/modules/workflow/state/ChangeRequestStaleBinder.tsx +43 -0
- package/src/modules/workflow/state/EventBusProvider.tsx +122 -11
- package/src/modules/workflow/state/__tests__/EventBusProvider.storage.test.tsx +87 -0
- package/src/modules/workflow/state/__tests__/EventBusProvider.watch.test.tsx +223 -0
- package/src/modules/workflow/state/event-bus.context.ts +10 -0
- package/src/modules/workspace/__tests__/testFixtures.ts +6 -3
- package/src/modules/workspace/components/FileExplorer.tsx +1527 -367
- package/src/modules/workspace/components/FileRoute.tsx +376 -22
- package/src/modules/workspace/components/FileViewer.tsx +166 -45
- package/src/modules/workspace/components/KbDocumentShell.tsx +50 -6
- package/src/modules/workspace/components/KbPageHeader.tsx +120 -55
- package/src/modules/workspace/components/TreeActionConfirm.tsx +350 -0
- package/src/modules/workspace/components/__tests__/FileExplorer.test.tsx +2473 -129
- package/src/modules/workspace/components/__tests__/FileRoute.test.tsx +768 -16
- package/src/modules/workspace/components/__tests__/FileViewer.test.tsx +332 -12
- package/src/modules/workspace/components/__tests__/KbDocumentShell.test.tsx +39 -0
- package/src/modules/workspace/components/__tests__/KbPageHeader.test.tsx +33 -20
- package/src/modules/workspace/components/renderers/DocxRenderer.tsx +4 -5
- package/src/modules/workspace/components/renderers/DownloadFileButton.tsx +13 -4
- package/src/modules/workspace/components/renderers/EmailRenderer.tsx +4 -3
- package/src/modules/workspace/components/renderers/HtmlRenderer.tsx +8 -14
- package/src/modules/workspace/components/renderers/ImageRenderer.tsx +75 -16
- package/src/modules/workspace/components/renderers/KbImage.tsx +180 -0
- package/src/modules/workspace/components/renderers/KbMarkdownView.tsx +22 -6
- package/src/modules/workspace/components/renderers/MarkdownRenderer.tsx +48 -22
- package/src/modules/workspace/components/renderers/PdfRenderer.tsx +4 -5
- package/src/modules/workspace/components/renderers/PptxRenderer.tsx +4 -3
- package/src/modules/workspace/components/renderers/XlsxRenderer.tsx +4 -3
- package/src/modules/workspace/components/renderers/__tests__/DocxRenderer.test.tsx +12 -0
- package/src/modules/workspace/components/renderers/__tests__/DownloadFileButton.test.tsx +57 -9
- package/src/modules/workspace/components/renderers/__tests__/EmailRenderer.test.tsx +13 -1
- package/src/modules/workspace/components/renderers/__tests__/ImageRenderer.test.tsx +163 -0
- package/src/modules/workspace/components/renderers/__tests__/KbMarkdownView.test.tsx +237 -0
- package/src/modules/workspace/components/renderers/__tests__/MarkdownRenderer.test.tsx +108 -14
- package/src/modules/workspace/components/renderers/__tests__/PptxRenderer.test.tsx +14 -1
- package/src/modules/workspace/components/renderers/__tests__/XlsxRenderer.test.tsx +16 -1
- package/src/modules/workspace/components/renderers/__tests__/rendererSelection.test.tsx +66 -1
- package/src/modules/workspace/components/renderers/index.ts +53 -2
- package/src/modules/workspace/components/renderers/kbMarkdownPipeline.tsx +25 -4
- package/src/modules/workspace/components/renderers/rendererWorkspace.ts +40 -0
- package/src/modules/workspace/hooks/__tests__/useImageRevision.test.tsx +174 -0
- package/src/modules/workspace/hooks/__tests__/useOpenChangeRequests.test.tsx +179 -1
- package/src/modules/workspace/hooks/__tests__/useWorkspaceImageResolver.test.tsx +122 -0
- package/src/modules/workspace/hooks/__tests__/useWorkspaceState.test.tsx +892 -7
- package/src/modules/workspace/hooks/useImageRevision.ts +101 -0
- package/src/modules/workspace/hooks/useMergedWorkspaceTree.ts +89 -0
- package/src/modules/workspace/hooks/useWorkspaceImageResolver.ts +55 -0
- package/src/modules/workspace/hooks/useWorkspaceState.ts +438 -66
- package/src/modules/workspace/routing/__tests__/kb-routes.test.tsx +279 -3
- package/src/modules/workspace/routing/kb-routes.ts +207 -30
- package/src/modules/workspace/services/__tests__/workspace.api.test.ts +57 -1
- package/src/modules/workspace/services/workspace.api.ts +57 -4
- package/src/modules/workspace/state/__tests__/applied-request-clears-pending.test.tsx +343 -0
- package/src/modules/workspace/state/__tests__/upload-lands-where-it-was-dropped.test.tsx +158 -0
- package/src/modules/workspace/state/open-change-requests.tsx +100 -12
- package/src/modules/workspace/state/workspace.context.ts +130 -16
- package/src/modules/workspace/utils/__tests__/file-trace.test.ts +73 -0
- package/src/modules/workspace/utils/__tests__/fileTree.test.ts +234 -5
- package/src/modules/workspace/utils/__tests__/pasteLink.test.ts +76 -0
- package/src/modules/workspace/utils/__tests__/treeConfirm.test.ts +364 -0
- package/src/modules/workspace/utils/__tests__/uploadError.test.ts +35 -0
- package/src/modules/workspace/utils/file-trace.ts +50 -0
- package/src/modules/workspace/utils/fileTree.ts +126 -52
- package/src/modules/workspace/utils/frontmatter.ts +8 -4
- package/src/modules/workspace/utils/pasteLink.ts +90 -0
- package/src/modules/workspace/utils/treeConfirm.ts +338 -0
- package/src/modules/workspace/utils/uploadError.ts +29 -0
- package/src/shared/__tests__/marketplace-url.test.ts +59 -0
- package/src/shared/components/Badge.tsx +3 -1
- package/src/shared/components/Banner.tsx +5 -1
- package/src/shared/components/Button.tsx +16 -2
- package/src/shared/components/Dialog.tsx +27 -11
- package/src/shared/components/Menu.tsx +13 -1
- package/src/shared/components/PageShell.tsx +13 -8
- package/src/shared/components/__tests__/primitives.test.tsx +116 -2
- package/src/shared/components/__tests__/useFocusHandoff.test.tsx +192 -0
- package/src/shared/components/index.ts +2 -0
- package/src/shared/components/useDismissableMenu.ts +32 -10
- package/src/shared/components/useFocusHandoff.ts +51 -0
- package/src/shared/components/useLatestRef.ts +28 -0
- package/src/shared/markdown/Markdown.tsx +12 -3
- package/src/shared/markdown/__tests__/escapeSpacesInLinkDestinations.test.ts +39 -0
- package/src/shared/markdown/hrefs.ts +50 -0
- package/src/shared/marketplace-url.ts +118 -0
- package/src/shared/mcp/ChatGptInstallLink.tsx +3 -3
- package/src/shared/mcp/ConnectionInstructions.tsx +38 -27
- package/src/shared/mcp/__tests__/connect-snippets.test.ts +3 -3
- package/src/shared/mcp/connect-snippets.ts +14 -9
- package/src/shared/mcp/index.ts +1 -1
- package/src/shared/theme/__tests__/header-band.test.ts +197 -0
- package/src/shared/theme/header.ts +75 -0
- package/src/shared/theme/measure.ts +7 -4
- package/src/shared/theme/tokens.css +34 -0
- package/src/modules/library/__tests__/PluginsIndexPage.test.tsx +0 -363
- package/src/modules/library/__tests__/PluginsSidebar.locked.test.tsx +0 -97
- package/src/modules/library/components/PluginsIndexPage.tsx +0 -265
- package/src/modules/update-check/__tests__/UpdateBanner.test.tsx +0 -126
- package/src/modules/update-check/components/UpdateBanner.tsx +0 -92
- package/src/modules/update-check/services/update-check.api.ts +0 -24
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { formatRelativeTime } from '../../../lib/utils';
|
|
2
|
+
import type { ProbeVerdict } from '../services/tool-secrets.api';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The WORDS a probe's answer is said in — one set, for every surface that
|
|
6
|
+
* saves a key.
|
|
7
|
+
*
|
|
8
|
+
* Three surfaces store tool credentials (the tool page, "Connect your tools",
|
|
9
|
+
* the vault) and all three now probe afterwards. They must not describe the
|
|
10
|
+
* same verdict differently: a person who saves a wrong key on the Connect page
|
|
11
|
+
* and then opens the tool page to fix it would otherwise meet two sentences
|
|
12
|
+
* about one provider's single rejection and have to work out whether they are
|
|
13
|
+
* the same problem. So the vocabulary lives here and the renderings import it,
|
|
14
|
+
* rather than each surface writing its own.
|
|
15
|
+
*
|
|
16
|
+
* The rule the words follow is the Library's: a claim may only be as strong as
|
|
17
|
+
* the evidence behind it. `Connected` is earned by a call the provider
|
|
18
|
+
* answered. `Not working` is the provider's own verdict, quoted. `Unverified`
|
|
19
|
+
* is the honest word for everything else — there is nothing to call, or the
|
|
20
|
+
* call could not reach one.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/** Earned by a passing probe, and by nothing else. */
|
|
24
|
+
export const CONNECTED_TEXT = 'Connected';
|
|
25
|
+
|
|
26
|
+
/** The provider refused the credential. */
|
|
27
|
+
export const REJECTED_TEXT = 'Not working';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* We do not know. Note this is NOT an error state: the key is saved, nothing
|
|
31
|
+
* needs a person, and painting every untestable integration amber would teach
|
|
32
|
+
* people that amber means nothing.
|
|
33
|
+
*/
|
|
34
|
+
export const UNVERIFIED_TEXT = 'Unverified';
|
|
35
|
+
|
|
36
|
+
/** When a rejection arrives without the provider's own words. */
|
|
37
|
+
export const REJECTED_FALLBACK = 'The provider rejected this credential.';
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* When `unverifiable` arrives without a reason. The backend names one in every
|
|
41
|
+
* case it knows (`This tool doesn't offer a way to test its connection.` for a
|
|
42
|
+
* manual with no health check), so this stands in only for a verdict that
|
|
43
|
+
* dropped its detail on the way.
|
|
44
|
+
*/
|
|
45
|
+
export const UNVERIFIED_FALLBACK = "This tool doesn't offer a way to test its connection.";
|
|
46
|
+
|
|
47
|
+
/** The probe could not be RUN — transport, access. Never a verdict about the key. */
|
|
48
|
+
export const PROBE_UNREACHABLE = "Couldn't test this connection.";
|
|
49
|
+
|
|
50
|
+
/** A saved key whose check could not run: stored, and still unknown. */
|
|
51
|
+
export const PROBE_UNREACHABLE_LEAD = 'Saved, but not tested.';
|
|
52
|
+
|
|
53
|
+
/** `err` gets a person's attention; `ok` stays quiet. Same two the Library uses. */
|
|
54
|
+
export type ProbeTone = 'ok' | 'err';
|
|
55
|
+
|
|
56
|
+
export interface ProbeWords {
|
|
57
|
+
tone: ProbeTone;
|
|
58
|
+
/** The state, in one or two words. */
|
|
59
|
+
text: string;
|
|
60
|
+
/** The single line behind the word: what the provider said, or why we can't say. */
|
|
61
|
+
hint: string;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* One verdict, in the words every surface says it in.
|
|
66
|
+
*
|
|
67
|
+
* `hint` is never empty — a word with nothing behind it is the assumption this
|
|
68
|
+
* whole feature exists to remove, so even `Connected` carries when it was
|
|
69
|
+
* checked.
|
|
70
|
+
*
|
|
71
|
+
* Deliberately takes the verdict ALONE. It cannot see the secret that was
|
|
72
|
+
* submitted, so no rendering built on it can leak one; the only free text it
|
|
73
|
+
* passes through is `detail`, which the server composes from the provider's
|
|
74
|
+
* status line.
|
|
75
|
+
*/
|
|
76
|
+
export function probeWords(verdict: ProbeVerdict): ProbeWords {
|
|
77
|
+
if (verdict.status === 'ok') {
|
|
78
|
+
// The app's one relative-time formatter, not a local dialect of it. A
|
|
79
|
+
// verdict with no usable timestamp still just happened — it cannot outlive
|
|
80
|
+
// the component holding it — so "just now" is the honest fallback.
|
|
81
|
+
return {
|
|
82
|
+
tone: 'ok',
|
|
83
|
+
text: CONNECTED_TEXT,
|
|
84
|
+
hint: `Checked ${formatRelativeTime(verdict.checkedAt) || 'just now'}.`,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
if (verdict.status === 'failed') {
|
|
88
|
+
return { tone: 'err', text: REJECTED_TEXT, hint: said(verdict.detail) ?? REJECTED_FALLBACK };
|
|
89
|
+
}
|
|
90
|
+
return { tone: 'ok', text: UNVERIFIED_TEXT, hint: said(verdict.detail) ?? UNVERIFIED_FALLBACK };
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* The detail, if the server actually said something in it.
|
|
95
|
+
*
|
|
96
|
+
* `??` is not enough: a detail of `''` is absent in every sense that matters
|
|
97
|
+
* here, and passing it through renders the word with nothing behind it —
|
|
98
|
+
* `Not working.` followed by silence — which is precisely the evidence-free
|
|
99
|
+
* claim this file exists to prevent. A whitespace-only detail is the same
|
|
100
|
+
* absence spelled differently. Redaction can produce one: a body that was
|
|
101
|
+
* nothing but the credential comes back blank.
|
|
102
|
+
*
|
|
103
|
+
* The UNTRIMMED value is returned when there is something in it, so the
|
|
104
|
+
* provider's own words reach the reader exactly as the server composed them.
|
|
105
|
+
*/
|
|
106
|
+
function said(detail: string | null | undefined): string | null {
|
|
107
|
+
return detail?.trim() ? detail : null;
|
|
108
|
+
}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { useCallback, useRef, useState } from 'react';
|
|
2
|
+
import { checkToolConnection, type ProbeVerdict } from '../services/tool-secrets.api';
|
|
3
|
+
import { PROBE_UNREACHABLE } from './probe-verdict';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Probe a tool's credential after it is SAVED, and hold the answer.
|
|
7
|
+
*
|
|
8
|
+
* Lifted out of the tool page, which was the only surface doing this — the
|
|
9
|
+
* Connect page and the vault stored a key and said nothing, so a mistyped one
|
|
10
|
+
* looked exactly like a working one until an agent tripped over it hours
|
|
11
|
+
* later. The lifecycle is subtle enough (two ordering hazards, both of which
|
|
12
|
+
* produce a CONFIDENT WRONG ANSWER rather than a visible bug) that copying it
|
|
13
|
+
* to two more surfaces was never the right move.
|
|
14
|
+
*
|
|
15
|
+
* What the hook is responsible for, and nothing else: run the probe, drop the
|
|
16
|
+
* answers that no longer describe what is on screen, and never block the save.
|
|
17
|
+
* The words belong to `probe-verdict.ts` and the layout to each surface.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* A probe's answer: what the provider said, or that we never reached it.
|
|
22
|
+
*
|
|
23
|
+
* These are different in kind, which is why they are not one field. A verdict
|
|
24
|
+
* is about the CREDENTIAL — the provider looked at it and decided. An
|
|
25
|
+
* `unreachable` is about US: our network, our access, our timeout. Rendering
|
|
26
|
+
* the second as though it were the first tells someone their key is wrong on
|
|
27
|
+
* the evidence of our own trouble, and sends them off to rotate a key that was
|
|
28
|
+
* fine.
|
|
29
|
+
*/
|
|
30
|
+
export type ProbeResult =
|
|
31
|
+
| { kind: 'verdict'; verdict: ProbeVerdict }
|
|
32
|
+
| { kind: 'unreachable'; message: string };
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* WHICH configuration an answer is an answer about: the tool, and the revision
|
|
36
|
+
* of its definition.
|
|
37
|
+
*
|
|
38
|
+
* The slug is half of it because a panel is not guaranteed to unmount when the
|
|
39
|
+
* tool under it changes — the `.tool` editor's sidebar swaps `tool` on a
|
|
40
|
+
* mounted `ToolSecretsPanel` — and a verdict left over from the previous tool
|
|
41
|
+
* would then sit beside a variable of the same name on the new one, saying
|
|
42
|
+
* `Connected` about a provider nobody has called. Keying the panel at each
|
|
43
|
+
* caller would fix the callers that remembered to; carrying the slug here
|
|
44
|
+
* fixes the ones that don't.
|
|
45
|
+
*/
|
|
46
|
+
interface Asked {
|
|
47
|
+
slug: string;
|
|
48
|
+
stamp: number;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** An answer, with the configuration it is an answer ABOUT. */
|
|
52
|
+
interface Stamped extends Asked {
|
|
53
|
+
result: ProbeResult;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface SavedKeyProbe {
|
|
57
|
+
/**
|
|
58
|
+
* The last answer, while it still describes the configuration on screen —
|
|
59
|
+
* otherwise null. Never stale by construction: see `stamp`.
|
|
60
|
+
*/
|
|
61
|
+
result: ProbeResult | null;
|
|
62
|
+
/** The verdict specifically, for surfaces that only render that. */
|
|
63
|
+
verdict: ProbeVerdict | null;
|
|
64
|
+
/** A probe for the configuration on screen is in flight. */
|
|
65
|
+
checking: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* WHICH saved key the current answer is about, as the caller named it, or
|
|
68
|
+
* null on a surface that never names one.
|
|
69
|
+
*
|
|
70
|
+
* A probe answers for the whole TOOL — one credential set, one call — but a
|
|
71
|
+
* page of key rows has to put that answer somewhere, and the only honest
|
|
72
|
+
* place is beside the key whose save asked the question. So one probe per
|
|
73
|
+
* tool, and the rows render it only where `subject` points. Giving each row
|
|
74
|
+
* its own probe instead would leave the first row saying `Connected` about a
|
|
75
|
+
* credential set the second row has since changed: the same confident stale
|
|
76
|
+
* claim this feature exists to remove, rebuilt one level down.
|
|
77
|
+
*/
|
|
78
|
+
subject: string | null;
|
|
79
|
+
/** Probe now — what a "Test connection" button calls. */
|
|
80
|
+
run(): Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* A key was just SAVED. Drops the previous answer first: it was about the
|
|
83
|
+
* key this one replaced, and leaving it up for the round-trip means the old
|
|
84
|
+
* key's `Connected` describing the new key's save.
|
|
85
|
+
*
|
|
86
|
+
* @param subject names the key that was saved, for surfaces that show the
|
|
87
|
+
* answer beside one of several rows.
|
|
88
|
+
*/
|
|
89
|
+
probeSaved(subject?: string): void;
|
|
90
|
+
/**
|
|
91
|
+
* A credential write LANDED and no probe follows (a delete, or a caller that
|
|
92
|
+
* re-probes on its own terms). Orphans anything in flight — after a delete,
|
|
93
|
+
* `Connected` would otherwise arrive about a credential that no longer
|
|
94
|
+
* exists.
|
|
95
|
+
*/
|
|
96
|
+
forget(): void;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* @param slug the tool to probe. Part of the identity of every answer the
|
|
101
|
+
* hook holds, so a caller that swaps tools without remounting (the `.tool`
|
|
102
|
+
* editor's sidebar) cannot show the previous tool's verdict beside the new
|
|
103
|
+
* tool's variables.
|
|
104
|
+
* @param stamp the revision of the configuration being probed — bump it when
|
|
105
|
+
* the tool's DEFINITION changes (an edited MCP server: different endpoint,
|
|
106
|
+
* different headers). An answer is stored with the stamp it was asked under
|
|
107
|
+
* and read back only while that still matches, so a verdict about a server
|
|
108
|
+
* nobody is configured against any more simply stops showing. Comparing
|
|
109
|
+
* rather than clearing keeps it race-free: an effect that cleared on change
|
|
110
|
+
* would race the probe it is meant to protect, since a save starts a probe
|
|
111
|
+
* and a refetch at the same moment. Surfaces with no such notion pass
|
|
112
|
+
* nothing and every stamp is 0.
|
|
113
|
+
*/
|
|
114
|
+
export function useSavedKeyProbe(slug: string, stamp = 0): SavedKeyProbe {
|
|
115
|
+
const [answer, setAnswer] = useState<Stamped | null>(null);
|
|
116
|
+
/** What the probe in flight is about, or null — `checking` is DERIVED from it. */
|
|
117
|
+
const [inFlight, setInFlight] = useState<Asked | null>(null);
|
|
118
|
+
/** The key whose save the current answer belongs to, stamped like the answer. */
|
|
119
|
+
const [subject, setSubject] = useState<(Asked & { name: string | null }) | null>(null);
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Which probe is allowed to publish. Two saves in quick succession start two
|
|
123
|
+
* probes, and the first can answer last — so a result is applied only while
|
|
124
|
+
* it is still the newest one asked for. Without it the older key's verdict
|
|
125
|
+
* wins by finishing late, which is the same stale-answer bug this feature
|
|
126
|
+
* exists to remove, one layer up.
|
|
127
|
+
*/
|
|
128
|
+
const seq = useRef(0);
|
|
129
|
+
|
|
130
|
+
/** Is this what is on screen right now? */
|
|
131
|
+
const current = (asked: Asked) => asked.slug === slug && asked.stamp === stamp;
|
|
132
|
+
|
|
133
|
+
// In-flight against the CURRENT configuration only: a definition edit or a
|
|
134
|
+
// tool switch mid-probe hands the button back immediately instead of waiting
|
|
135
|
+
// for the orphan to settle.
|
|
136
|
+
const checking = inFlight !== null && current(inFlight);
|
|
137
|
+
const result = answer && current(answer) ? answer.result : null;
|
|
138
|
+
|
|
139
|
+
const run = useCallback(async () => {
|
|
140
|
+
const mine = ++seq.current;
|
|
141
|
+
const asked: Asked = { slug, stamp };
|
|
142
|
+
setInFlight(asked);
|
|
143
|
+
// A replacement probe makes a previous TRANSPORT failure history the
|
|
144
|
+
// moment it starts — leaving that alert up while "Testing…" runs reads as
|
|
145
|
+
// the new attempt already having failed. A previous VERDICT stays: it is
|
|
146
|
+
// still the last thing the provider said, and blanking it would make a
|
|
147
|
+
// re-test look like it had lost the answer.
|
|
148
|
+
setAnswer((prev) =>
|
|
149
|
+
prev && prev.slug === asked.slug && prev.stamp === asked.stamp && prev.result.kind === 'verdict'
|
|
150
|
+
? prev
|
|
151
|
+
: null,
|
|
152
|
+
);
|
|
153
|
+
try {
|
|
154
|
+
const verdict = await checkToolConnection(slug);
|
|
155
|
+
// Newest-probe guard only: everything published is STAMPED and compared
|
|
156
|
+
// at render, so a probe that raced a definition change stores state that
|
|
157
|
+
// simply never shows — no clock to synchronise, no ref read mid-render.
|
|
158
|
+
//
|
|
159
|
+
// A response with no verdict in it is treated as a probe we could not
|
|
160
|
+
// run, not as a verdict. It should not happen — but rendering whatever
|
|
161
|
+
// came back would throw inside the result component, and a malformed
|
|
162
|
+
// answer to an optional question must not take down the page the person
|
|
163
|
+
// is saving on.
|
|
164
|
+
if (seq.current === mine) {
|
|
165
|
+
setAnswer({
|
|
166
|
+
...asked,
|
|
167
|
+
result: verdict
|
|
168
|
+
? { kind: 'verdict', verdict }
|
|
169
|
+
: { kind: 'unreachable', message: PROBE_UNREACHABLE },
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
} catch (err) {
|
|
173
|
+
// A rejected credential RESOLVES with `status: 'failed'`; only a
|
|
174
|
+
// transport or access failure lands here, and that is not a verdict about
|
|
175
|
+
// the credential. Inside the guard too: an older probe rejecting after a
|
|
176
|
+
// newer one answered would otherwise raise a transport error over a
|
|
177
|
+
// verdict that is currently correct.
|
|
178
|
+
if (seq.current === mine) {
|
|
179
|
+
setAnswer({
|
|
180
|
+
...asked,
|
|
181
|
+
result: {
|
|
182
|
+
kind: 'unreachable',
|
|
183
|
+
message: err instanceof Error && err.message ? err.message : PROBE_UNREACHABLE,
|
|
184
|
+
},
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
} finally {
|
|
188
|
+
// Only the newest probe releases the slot: an older one finishing late
|
|
189
|
+
// must not clear a newer probe's in-flight marker.
|
|
190
|
+
if (seq.current === mine) setInFlight(null);
|
|
191
|
+
}
|
|
192
|
+
}, [slug, stamp]);
|
|
193
|
+
|
|
194
|
+
const forget = useCallback(() => {
|
|
195
|
+
seq.current++;
|
|
196
|
+
setInFlight(null);
|
|
197
|
+
setAnswer(null);
|
|
198
|
+
setSubject(null);
|
|
199
|
+
}, []);
|
|
200
|
+
|
|
201
|
+
const probeSaved = useCallback(
|
|
202
|
+
(nextSubject?: string) => {
|
|
203
|
+
setAnswer(null);
|
|
204
|
+
// The answer MOVES to the key that was just saved. It was never about
|
|
205
|
+
// one key — a probe calls the provider with the whole credential set —
|
|
206
|
+
// but the newest save is the only row where the claim is current, and a
|
|
207
|
+
// stale one left behind on a sibling row is exactly the thing being
|
|
208
|
+
// fixed here.
|
|
209
|
+
setSubject({ slug, stamp, name: nextSubject ?? null });
|
|
210
|
+
// NOT awaited, and never on the save's critical path: the value is already
|
|
211
|
+
// stored by the time this is called, and a probe that hangs, fails or is
|
|
212
|
+
// missing entirely must cost the person nothing. The floating promise is
|
|
213
|
+
// the point.
|
|
214
|
+
void run();
|
|
215
|
+
},
|
|
216
|
+
[run, slug, stamp],
|
|
217
|
+
);
|
|
218
|
+
|
|
219
|
+
return {
|
|
220
|
+
result,
|
|
221
|
+
verdict: result?.kind === 'verdict' ? result.verdict : null,
|
|
222
|
+
checking,
|
|
223
|
+
subject: subject && current(subject) ? subject.name : null,
|
|
224
|
+
run,
|
|
225
|
+
probeSaved,
|
|
226
|
+
forget,
|
|
227
|
+
};
|
|
228
|
+
}
|
|
@@ -1,20 +1,40 @@
|
|
|
1
1
|
import { authFetch } from '../../../lib/api';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* The aggregated "connect your tools" surface: everything
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* The aggregated "connect your tools" surface: everything standing between the
|
|
5
|
+
* signed-in person and the tools they can reach working in their own agent,
|
|
6
|
+
* split into plain values (API keys) and OAuth sign-ins.
|
|
7
|
+
*
|
|
8
|
+
* It is NOT only the caller's own items. The Library's plugin banner counts an
|
|
9
|
+
* integration that needs a WORKSPACE value nobody but its owner can set, and a
|
|
10
|
+
* page that omitted those disagreed with the banner that sent the reader to it.
|
|
11
|
+
* Such an item arrives flagged `ownerOnly` so the page can say whose job it is
|
|
12
|
+
* instead of pretending it is the reader's. Readability is unchanged: the server
|
|
13
|
+
* builds this from the tools the caller may read, so one they may not is absent
|
|
14
|
+
* rather than greyed.
|
|
8
15
|
*/
|
|
9
16
|
|
|
17
|
+
/** Set once for the workspace by the tool's owner, or by each person for themselves. */
|
|
18
|
+
export type ConnectVarScope = 'admin' | 'user';
|
|
19
|
+
|
|
10
20
|
export interface ConnectVar {
|
|
11
21
|
/** Bare variable name (e.g. `API_KEY`). */
|
|
12
22
|
name: string;
|
|
13
23
|
label: string | null;
|
|
14
24
|
/** The stored key — `<manual>_<VAR>`. */
|
|
15
25
|
key: string;
|
|
16
|
-
|
|
26
|
+
scope: ConnectVarScope;
|
|
27
|
+
/**
|
|
28
|
+
* A value the caller's agent would resolve exists — the workspace's for an
|
|
29
|
+
* `admin` var, the caller's own for a `user` one. An already-set `admin` var
|
|
30
|
+
* is dropped server-side, so this is false for every one that arrives.
|
|
31
|
+
*/
|
|
17
32
|
configured: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* An `admin` var the caller may not write: it needs whoever owns the tool.
|
|
35
|
+
* Never true for a `user` var, and never true for an owner.
|
|
36
|
+
*/
|
|
37
|
+
ownerOnly: boolean;
|
|
18
38
|
}
|
|
19
39
|
|
|
20
40
|
export interface ConnectTool {
|
|
@@ -22,6 +42,8 @@ export interface ConnectTool {
|
|
|
22
42
|
name: string;
|
|
23
43
|
path: string;
|
|
24
44
|
type: 'inline' | 'http' | 'mcp';
|
|
45
|
+
/** The caller may set this tool's workspace (owner) values. */
|
|
46
|
+
canWrite: boolean;
|
|
25
47
|
variables: ConnectVar[];
|
|
26
48
|
}
|
|
27
49
|
|
|
@@ -45,6 +67,15 @@ export interface ConnectToolOAuth {
|
|
|
45
67
|
* declares now (a scope was added since sign-in) — show Reconnect, not Connected.
|
|
46
68
|
*/
|
|
47
69
|
needsReauth: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* The owner-side half is done: the provider registration (client secret) exists,
|
|
72
|
+
* so Authorize can actually reach a consent screen. Until it does, nobody's
|
|
73
|
+
* sign-in can work — which is why the row is outstanding even for a person who
|
|
74
|
+
* has nothing to do about it.
|
|
75
|
+
*/
|
|
76
|
+
ownerConfigured: boolean;
|
|
77
|
+
/** Waiting on the registration above, and the caller may not write it. */
|
|
78
|
+
ownerOnly: boolean;
|
|
48
79
|
}
|
|
49
80
|
|
|
50
81
|
export interface ConnectPending {
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ConnectPending,
|
|
3
|
+
ConnectTool,
|
|
4
|
+
ConnectToolOAuth,
|
|
5
|
+
ConnectVar,
|
|
6
|
+
} from '../services/connect.api';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* What the Connect page still owes, counted the way the Library counts it.
|
|
10
|
+
*
|
|
11
|
+
* The plugin banner counts INTEGRATIONS — one per tool whose status is not ok
|
|
12
|
+
* (`attentionOf`) — and then links here. This page used to count VARIABLES, and
|
|
13
|
+
* only the ones the reader could act on, so a plugin whose banner said four
|
|
14
|
+
* arrived at a page showing two. Every rule below exists to close one half of
|
|
15
|
+
* that gap:
|
|
16
|
+
*
|
|
17
|
+
* - the unit is the TOOL, not the variable: a tool missing two keys is one
|
|
18
|
+
* integration needing setup, and a tool that appears in both sections (a
|
|
19
|
+
* sign-in AND a typed key) is still one;
|
|
20
|
+
* - a value only its owner can set counts, because the banner counts it — the
|
|
21
|
+
* reader cannot act on it, but the integration is no less unusable for that;
|
|
22
|
+
* - a SKIPPED tool counts, for the same reason. Skipping is a choice about what
|
|
23
|
+
* the agent may use, not a claim the tool is set up, and the banner has never
|
|
24
|
+
* pretended otherwise.
|
|
25
|
+
*
|
|
26
|
+
* Kept out of the component file deliberately: it is the half of this page that
|
|
27
|
+
* has to agree with another module, so it is testable beside `attentionOf`
|
|
28
|
+
* rather than only through the DOM.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* What a row says when the workspace value it is waiting on belongs to somebody
|
|
33
|
+
* else. The VARIABLE is the whole message — a reader who has to go and ask an
|
|
34
|
+
* owner needs the name of the thing to ask for, not the news that they are
|
|
35
|
+
* blocked. One function so the badge on the tool and the line on the variable
|
|
36
|
+
* cannot come to word it differently.
|
|
37
|
+
*/
|
|
38
|
+
export function ownerReason(varName: string): string {
|
|
39
|
+
return `Needs an owner to set ${varName}`;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** A variable the caller can do something about right now. */
|
|
43
|
+
export function isActionable(v: ConnectVar): boolean {
|
|
44
|
+
return !v.ownerOnly;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Is this tool still short of something? Any variable the listing carried and
|
|
49
|
+
* did not mark configured — the caller's to set or the owner's, since the
|
|
50
|
+
* integration is unusable either way.
|
|
51
|
+
*/
|
|
52
|
+
export function toolNeedsSetup(tool: ConnectTool): boolean {
|
|
53
|
+
return tool.variables.some((v) => !v.configured);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Is this sign-in still short of something? Three ways, in the order the row
|
|
58
|
+
* reads them: the provider was never registered (the owner's job), the caller
|
|
59
|
+
* never signed in, or the token no longer covers what the tool declares.
|
|
60
|
+
*/
|
|
61
|
+
export function signInNeedsSetup(o: ConnectToolOAuth): boolean {
|
|
62
|
+
return !o.ownerConfigured || !o.authorized || o.needsReauth;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* The page's outstanding count: distinct INTEGRATIONS that need something.
|
|
67
|
+
*
|
|
68
|
+
* Distinct by slug across both sections — a tool with an unfinished sign-in and
|
|
69
|
+
* an unset key is one integration in the banner and must be one here.
|
|
70
|
+
*
|
|
71
|
+
* Standalone sign-ins are deliberately NOT in this number. They are registered
|
|
72
|
+
* on the Secrets page rather than declared by a `.tool`, so no plugin banner has
|
|
73
|
+
* ever counted one, and this number is counted the way a banner counts. Adding
|
|
74
|
+
* them would reintroduce the disagreement from the other side: a reader with one
|
|
75
|
+
* unauthorized personal secret would see a page claiming five where the plugin
|
|
76
|
+
* said four. They are still work, and still listed — see `standaloneOutstanding`.
|
|
77
|
+
*
|
|
78
|
+
* Counted the same WAY, not always the same NUMBER: this page lists every
|
|
79
|
+
* plugin the reader can reach, so with several plugins it is the sum of their
|
|
80
|
+
* banners, and equals one banner only when that plugin is the only one.
|
|
81
|
+
*/
|
|
82
|
+
export function outstandingCount(pending: ConnectPending): number {
|
|
83
|
+
const slugs = new Set<string>();
|
|
84
|
+
for (const t of pending.tools) if (toolNeedsSetup(t)) slugs.add(t.slug);
|
|
85
|
+
for (const o of pending.toolOAuth) if (signInNeedsSetup(o)) slugs.add(o.slug);
|
|
86
|
+
return slugs.size;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Standalone sign-ins still waiting on the reader — kept apart from the
|
|
91
|
+
* integration count precisely because nothing else counts them, and folded back
|
|
92
|
+
* in only where the page asks "is there anything left at all?" (the zero-state
|
|
93
|
+
* banner). A page that said "everything is set up" over a row saying
|
|
94
|
+
* "Needs sign-in" would be lying about the row right under it.
|
|
95
|
+
*/
|
|
96
|
+
export function standaloneOutstanding(pending: ConnectPending): number {
|
|
97
|
+
return pending.oauth.filter((o) => !o.authorized).length;
|
|
98
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { Banner, Button } from '../../../shared/components';
|
|
3
|
+
import { Dialog } from '../../../shared/components/Dialog';
|
|
4
|
+
import { CopyBlock } from '../../../shared/mcp';
|
|
5
|
+
import { ClaudeConnectionFields } from './ClaudeConnectionFields';
|
|
6
|
+
import {
|
|
7
|
+
fetchGitHubFacade,
|
|
8
|
+
rotateGitHubFacade,
|
|
9
|
+
type GitHubFacadeCredentials,
|
|
10
|
+
} from '../services/github-facade.api';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The admin's half of "add this marketplace in Cowork or claude.ai": the
|
|
14
|
+
* generated credentials, inside step 1 of the registration steps in the
|
|
15
|
+
* Marketplace section of Deployment configuration. It fetches on mount, and
|
|
16
|
+
* that step mounts it only while its drawer is open.
|
|
17
|
+
*
|
|
18
|
+
* Those surfaces sync marketplaces only from hosts they know, and the one
|
|
19
|
+
* kind of host an organization can add itself is a GitHub Enterprise Server.
|
|
20
|
+
* Hexis presents itself as one: an Owner registers this deployment once in
|
|
21
|
+
* Claude's admin settings, pasting the fields below, and from then on every
|
|
22
|
+
* person connects their own claude.ai account through the ordinary hexis
|
|
23
|
+
* sign-in and gets the marketplace compiled for what they may read.
|
|
24
|
+
*
|
|
25
|
+
* The fields are exactly the ones the "Add manually" form asks for, in its
|
|
26
|
+
* order, so the card reads as a copy source, not a form of its own. Rotate
|
|
27
|
+
* replaces the generated ones: the registration on the Claude side stops
|
|
28
|
+
* matching until an Owner re-enters them, while people's existing
|
|
29
|
+
* connections — connection keys, ours — keep working.
|
|
30
|
+
*
|
|
31
|
+
* What is on screen is always the LATEST answer the server gave: a load
|
|
32
|
+
* that was in flight when a rotation returned is discarded, never applied
|
|
33
|
+
* over the new set — an admin copying pre-rotation values into Claude would
|
|
34
|
+
* register a secret that no longer exists.
|
|
35
|
+
*/
|
|
36
|
+
export function ClaudeConnectionCard() {
|
|
37
|
+
const [creds, setCreds] = useState<GitHubFacadeCredentials | null>(null);
|
|
38
|
+
const [error, setError] = useState<string | null>(null);
|
|
39
|
+
const [loaded, setLoaded] = useState(false);
|
|
40
|
+
const [confirmRotate, setConfirmRotate] = useState(false);
|
|
41
|
+
const [rotating, setRotating] = useState(false);
|
|
42
|
+
const [rotateError, setRotateError] = useState<string | null>(null);
|
|
43
|
+
// Every request takes a number; only the newest one's answer is applied.
|
|
44
|
+
const latest = useRef(0);
|
|
45
|
+
|
|
46
|
+
const refresh = useCallback(() => {
|
|
47
|
+
const seq = ++latest.current;
|
|
48
|
+
fetchGitHubFacade()
|
|
49
|
+
.then((c) => {
|
|
50
|
+
if (seq !== latest.current) return;
|
|
51
|
+
setCreds(c);
|
|
52
|
+
setError(null);
|
|
53
|
+
})
|
|
54
|
+
.catch((err: unknown) => {
|
|
55
|
+
if (seq !== latest.current) return;
|
|
56
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
57
|
+
})
|
|
58
|
+
.finally(() => {
|
|
59
|
+
if (seq === latest.current) setLoaded(true);
|
|
60
|
+
});
|
|
61
|
+
}, []);
|
|
62
|
+
|
|
63
|
+
useEffect(refresh, [refresh]);
|
|
64
|
+
|
|
65
|
+
const rotate = async () => {
|
|
66
|
+
const seq = ++latest.current;
|
|
67
|
+
setRotating(true);
|
|
68
|
+
setRotateError(null);
|
|
69
|
+
try {
|
|
70
|
+
const next = await rotateGitHubFacade();
|
|
71
|
+
if (seq !== latest.current) return;
|
|
72
|
+
setCreds(next);
|
|
73
|
+
setError(null);
|
|
74
|
+
setConfirmRotate(false);
|
|
75
|
+
} catch (err) {
|
|
76
|
+
// Inside the dialog, where the person is looking — not behind its scrim.
|
|
77
|
+
if (seq === latest.current) setRotateError(err instanceof Error ? err.message : String(err));
|
|
78
|
+
} finally {
|
|
79
|
+
setRotating(false);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const closeRotate = () => {
|
|
84
|
+
setConfirmRotate(false);
|
|
85
|
+
setRotateError(null);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<div className="space-y-3" data-testid="claude-connection-credentials">
|
|
90
|
+
{!loaded && <div className="text-xs text-ink-muted">Loading the credentials…</div>}
|
|
91
|
+
|
|
92
|
+
{error && (
|
|
93
|
+
<Banner tone="danger" role="alert">
|
|
94
|
+
{error}
|
|
95
|
+
<Button variant="outline" size="sm" className="ml-3" onClick={refresh}>
|
|
96
|
+
Try again
|
|
97
|
+
</Button>
|
|
98
|
+
</Banner>
|
|
99
|
+
)}
|
|
100
|
+
|
|
101
|
+
{creds && (
|
|
102
|
+
<div className="border border-line rounded p-3 space-y-3">
|
|
103
|
+
<ClaudeConnectionFields creds={creds} />
|
|
104
|
+
<p className="text-meta text-ink-muted leading-snug">
|
|
105
|
+
The webhook URL Claude generates after saving can be ignored: nothing here sends
|
|
106
|
+
webhooks yet. The private key is required by the form but not used by the
|
|
107
|
+
user-added marketplace flow.
|
|
108
|
+
</p>
|
|
109
|
+
<CopyBlock label="Marketplace URL people add" value={creds.marketplaceUrl} rows={1} />
|
|
110
|
+
<div className="flex items-center justify-between gap-3">
|
|
111
|
+
<span className="text-meta text-ink-muted">
|
|
112
|
+
{creds.rotatedAt
|
|
113
|
+
? `Rotated ${new Date(creds.rotatedAt).toLocaleString()}`
|
|
114
|
+
: `Generated ${new Date(creds.createdAt).toLocaleString()}`}
|
|
115
|
+
</span>
|
|
116
|
+
<Button variant="outline" size="sm" onClick={() => setConfirmRotate(true)}>
|
|
117
|
+
Rotate credentials
|
|
118
|
+
</Button>
|
|
119
|
+
</div>
|
|
120
|
+
</div>
|
|
121
|
+
)}
|
|
122
|
+
|
|
123
|
+
<Dialog
|
|
124
|
+
open={confirmRotate}
|
|
125
|
+
onClose={closeRotate}
|
|
126
|
+
title="Rotate the Claude connection credentials?"
|
|
127
|
+
size="sm"
|
|
128
|
+
busy={rotating}
|
|
129
|
+
footer={
|
|
130
|
+
<>
|
|
131
|
+
<Button variant="outline" size="sm" onClick={closeRotate} disabled={rotating}>
|
|
132
|
+
Cancel
|
|
133
|
+
</Button>
|
|
134
|
+
<Button variant="danger" size="sm" onClick={() => void rotate()} disabled={rotating}>
|
|
135
|
+
{rotating ? 'Rotating…' : rotateError ? 'Try again' : 'Rotate'}
|
|
136
|
+
</Button>
|
|
137
|
+
</>
|
|
138
|
+
}
|
|
139
|
+
>
|
|
140
|
+
<p className="text-sm text-ink">
|
|
141
|
+
The App ID, Client ID, client secret, webhook secret and private key change; the
|
|
142
|
+
hostname and the marketplace URL stay the same. The registration in Claude's admin
|
|
143
|
+
settings stops working until an Owner enters the new values there. People who already
|
|
144
|
+
connected keep their connection.
|
|
145
|
+
</p>
|
|
146
|
+
{rotateError && (
|
|
147
|
+
<Banner tone="danger" role="alert" className="mt-3">
|
|
148
|
+
{rotateError}
|
|
149
|
+
</Banner>
|
|
150
|
+
)}
|
|
151
|
+
</Dialog>
|
|
152
|
+
</div>
|
|
153
|
+
);
|
|
154
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { CopyBlock } from '../../../shared/mcp';
|
|
2
|
+
import type { GitHubFacadeCredentials } from '../services/github-facade.api';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The six values Claude's "Add GitHub Enterprise" form asks for, in ITS
|
|
6
|
+
* order, so the block reads as a copy source rather than a form of its own.
|
|
7
|
+
*
|
|
8
|
+
* Rendered by the Claude connection card, inside step 1 of the registration
|
|
9
|
+
* steps in the Marketplace section of Deployment configuration — the fields
|
|
10
|
+
* sit in the step that asks for them.
|
|
11
|
+
*/
|
|
12
|
+
export function ClaudeConnectionFields({ creds }: { creds: GitHubFacadeCredentials }) {
|
|
13
|
+
return (
|
|
14
|
+
<>
|
|
15
|
+
<CopyBlock label="Hostname" value={creds.host} rows={1} />
|
|
16
|
+
<CopyBlock label="App ID" value={creds.appId} rows={1} />
|
|
17
|
+
<CopyBlock label="Client ID" value={creds.clientId} rows={1} />
|
|
18
|
+
<CopyBlock label="Client secret" value={creds.clientSecret} rows={1} />
|
|
19
|
+
<CopyBlock label="Webhook secret" value={creds.webhookSecret} rows={1} />
|
|
20
|
+
<CopyBlock label="Private key" value={creds.privateKeyPem} rows={6} />
|
|
21
|
+
</>
|
|
22
|
+
);
|
|
23
|
+
}
|