@bevel-software/platform-core-frontend 0.15.1 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD-PARTY-NOTICES.md +2 -2
- package/package.json +3 -3
- package/src/core/CoreAppShell.tsx +16 -9
- package/src/core/__tests__/AppChrome.test.tsx +0 -3
- package/src/core/__tests__/events.test.ts +43 -0
- package/src/core/bootstrap.ts +11 -3
- package/src/core/events.ts +85 -3
- package/src/core/registry.ts +1 -1
- package/src/lib/__tests__/email.test.ts +44 -0
- package/src/lib/email.ts +37 -1
- package/src/modules/access/__tests__/ManageAccessDialog.add-row-picking.test.tsx +141 -0
- package/src/modules/access/__tests__/ManageAccessDialog.chip-truncation.test.tsx +204 -0
- package/src/modules/access/__tests__/ManageAccessDialog.download-read.test.tsx +234 -0
- package/src/modules/access/__tests__/ManageAccessDialog.edited-row-visible.test.tsx +160 -0
- package/src/modules/access/__tests__/ManageAccessDialog.placement.test.tsx +2 -2
- package/src/modules/access/__tests__/ManageAccessDialog.proposal.test.tsx +166 -0
- package/src/modules/access/__tests__/ManageAccessDialog.restrict.test.tsx +510 -0
- package/src/modules/access/__tests__/ManageAccessDialog.row-menu-axes.test.tsx +299 -0
- package/src/modules/access/__tests__/ManageAccessDialog.row-menu-width.test.tsx +226 -0
- package/src/modules/access/__tests__/ManageAccessDialog.test.tsx +721 -126
- package/src/modules/access/__tests__/ManageAccessDialog.unknown-email.test.tsx +314 -0
- package/src/modules/access/__tests__/manage-access-affordance.test.ts +14 -0
- package/src/modules/access/__tests__/tailwindDeclarations.ts +210 -0
- package/src/modules/access/api.ts +140 -6
- package/src/modules/access/components/ManageAccessDialog.tsx +1299 -561
- package/src/modules/access/manage-access-affordance.ts +17 -0
- package/src/modules/admin/__tests__/AddMemberInput.test.tsx +297 -0
- package/src/modules/admin/__tests__/AdminRolesPage.capabilities.test.tsx +2 -2
- package/src/modules/admin/__tests__/AdminRolesPage.fixed-admin.test.tsx +189 -0
- package/src/modules/admin/__tests__/AdminRolesPage.suggest.test.tsx +1 -1
- package/src/modules/admin/__tests__/ConnectionKeysPage.test.tsx +266 -0
- package/src/modules/admin/__tests__/DirectoryGroupsPage.suggest.test.tsx +182 -0
- package/src/modules/admin/__tests__/DirectoryGroupsPage.test.tsx +165 -14
- package/src/modules/admin/__tests__/UserAccountsPage.test.tsx +401 -4
- package/src/modules/admin/__tests__/group-members-path.test.ts +27 -0
- package/src/modules/admin/components/AddMemberInput.tsx +268 -0
- package/src/modules/admin/components/AdminRolesPage.tsx +97 -132
- package/src/modules/admin/components/ConnectionKeysPage.tsx +269 -0
- package/src/modules/admin/components/DirectoryGroupsPage.tsx +91 -39
- package/src/modules/admin/components/UserAccountsPage.tsx +271 -37
- package/src/modules/admin/components/connection-keys-grouping.ts +43 -0
- package/src/modules/admin/components/group-members-path.ts +32 -0
- package/src/modules/admin/services/connection-keys.api.ts +47 -0
- package/src/modules/admin/services/roles.api.ts +12 -1
- package/src/modules/auth/__tests__/AccountPage.test.tsx +50 -2
- package/src/modules/auth/components/AccountPage.tsx +73 -54
- package/src/modules/auth/components/LoginScreen.tsx +1 -0
- package/src/modules/auth/services/account.api.ts +78 -4
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.access-rules.test.tsx +144 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.binary.test.tsx +422 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.brings-itself-up-to-date.test.tsx +431 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.fork-point.test.tsx +193 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.initial-file.test.tsx +142 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.moved.test.tsx +202 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.test.tsx +205 -13
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.unreadable.test.tsx +271 -0
- package/src/modules/change-requests/__tests__/FileChangeBoxes.test.tsx +208 -0
- package/src/modules/change-requests/__tests__/apply-outcome-for-every-viewer.test.tsx +286 -0
- package/src/modules/change-requests/__tests__/propose.concurrent.test.ts +273 -0
- package/src/modules/change-requests/__tests__/readFailure.test.ts +122 -0
- package/src/modules/change-requests/__tests__/useCrFileDiffs.test.tsx +238 -0
- package/src/modules/change-requests/__tests__/useFileOnBranch.test.tsx +56 -1
- package/src/modules/change-requests/__tests__/useForkPointFile.test.tsx +79 -0
- package/src/modules/change-requests/components/BranchFilePreview.tsx +357 -0
- package/src/modules/change-requests/components/ChangeBox.tsx +31 -2
- package/src/modules/change-requests/components/ChangeRequestDialog.tsx +862 -72
- package/src/modules/change-requests/components/CrFileTree.tsx +74 -58
- package/src/modules/change-requests/components/FileChangeBoxes.tsx +19 -15
- package/src/modules/change-requests/hooks/useApplyChangeRequest.ts +41 -7
- package/src/modules/change-requests/hooks/useCrFileDiffs.ts +181 -23
- package/src/modules/change-requests/hooks/useFileOnBranch.ts +70 -7
- package/src/modules/change-requests/hooks/useForkPointFile.ts +77 -0
- package/src/modules/change-requests/services/change-requests.api.ts +57 -1
- package/src/modules/change-requests/services/denied-file.api.ts +53 -0
- package/src/modules/change-requests/services/propose.api.ts +97 -8
- package/src/modules/change-requests/utils/approval.ts +15 -0
- package/src/modules/change-requests/utils/author.ts +32 -0
- package/src/modules/change-requests/utils/readFailure.ts +110 -0
- package/src/modules/git/__tests__/FileHistoryPanel.test.tsx +20 -0
- package/src/modules/git/components/FileHistoryPanel.tsx +5 -0
- package/src/modules/git/components/PullRequestsForMe.tsx +51 -24
- package/src/modules/git/services/__tests__/error-messages.test.ts +29 -0
- package/src/modules/git/services/error-messages.ts +12 -0
- package/src/modules/git/services/pr-prompts.ts +5 -5
- package/src/modules/layout/__tests__/HeaderAlignment.test.tsx +401 -0
- package/src/modules/layout/__tests__/SidebarFooterGrid.test.tsx +286 -0
- package/src/modules/layout/__tests__/SidebarFrameResponsive.test.tsx +61 -0
- package/src/modules/layout/components/AppLayout.tsx +2 -0
- package/src/modules/layout/components/MobileChatLayout.tsx +4 -1
- package/src/modules/layout/components/ResizableThreePaneLayout.tsx +4 -1
- package/src/modules/layout/components/SidebarFrame.tsx +108 -3
- package/src/modules/library/__tests__/AddToPluginDialog.test.tsx +171 -5
- package/src/modules/library/__tests__/DeleteToolDialog.test.tsx +356 -0
- package/src/modules/library/__tests__/IntegrationsSetupReminder.test.tsx +60 -0
- package/src/modules/library/__tests__/LibraryCard.test.tsx +91 -10
- package/src/modules/library/__tests__/LibraryRoutes.test.tsx +242 -107
- package/src/modules/library/__tests__/LibrarySidebarMenu.test.tsx +103 -98
- package/src/modules/library/__tests__/LinkSkillPanel.test.tsx +20 -5
- package/src/modules/library/__tests__/LockedPluginView.test.tsx +97 -7
- package/src/modules/library/__tests__/NewPluginDialog.test.tsx +13 -4
- package/src/modules/library/__tests__/PersonalAddDialog.test.tsx +79 -3
- package/src/modules/library/__tests__/PersonalPluginPage.test.tsx +201 -0
- package/src/modules/library/__tests__/PluginExtras.test.tsx +100 -9
- package/src/modules/library/__tests__/PluginJoinRequests.test.tsx +60 -1
- package/src/modules/library/__tests__/PluginPage.test.tsx +258 -6
- package/src/modules/library/__tests__/PluginsSidebar.contextmenu.test.tsx +16 -56
- package/src/modules/library/__tests__/PluginsSidebar.test.tsx +155 -152
- package/src/modules/library/__tests__/PluginsSidebarMenu.test.tsx +16 -0
- package/src/modules/library/__tests__/SharedViaPlugins.test.tsx +106 -0
- package/src/modules/library/__tests__/SkillPage.test.tsx +386 -80
- package/src/modules/library/__tests__/SkillsTree.test.tsx +293 -4
- package/src/modules/library/__tests__/ToolConnectionSection.test.tsx +582 -71
- package/src/modules/library/__tests__/ToolPage.test.tsx +87 -4
- package/src/modules/library/__tests__/WorkspaceItemRoute.test.tsx +173 -26
- package/src/modules/library/__tests__/auth-harness.tsx +9 -9
- package/src/modules/library/__tests__/card-row-menu.test.tsx +320 -0
- package/src/modules/library/__tests__/library-data.mapping.test.tsx +98 -0
- package/src/modules/library/__tests__/library-data.stale.test.tsx +121 -28
- package/src/modules/library/__tests__/library-data.test.ts +7 -0
- package/src/modules/library/__tests__/library-paths.test.ts +47 -4
- package/src/modules/library/__tests__/link-membership.test.ts +13 -4
- package/src/modules/library/__tests__/name-with-badges.test.tsx +273 -0
- package/src/modules/library/__tests__/newSkillMarkdown.test.ts +30 -0
- package/src/modules/library/__tests__/owner-pill.test.tsx +357 -0
- package/src/modules/library/__tests__/pending-tools.test.tsx +400 -0
- package/src/modules/library/__tests__/plugin-entries.test.ts +122 -0
- package/src/modules/library/__tests__/plugin-summary.test.ts +36 -1
- package/src/modules/library/__tests__/status.test.ts +82 -2
- package/src/modules/library/__tests__/tools.api.test.ts +44 -1
- package/src/modules/library/components/AccessRequestsBanner.tsx +85 -47
- package/src/modules/library/components/AddDialogTabs.tsx +103 -0
- package/src/modules/library/components/AddToPluginDialog.tsx +74 -18
- package/src/modules/library/components/IntegrationsSetupReminder.tsx +59 -0
- package/src/modules/library/components/ItemActionsMenu.tsx +288 -0
- package/src/modules/library/components/LibraryCard.tsx +146 -45
- package/src/modules/library/components/LibraryLayout.tsx +119 -256
- package/src/modules/library/components/LibraryPage.tsx +172 -39
- package/src/modules/library/components/LinkSkillPanel.tsx +1 -3
- package/src/modules/library/components/LockedPluginView.tsx +62 -34
- package/src/modules/library/components/NameWithBadges.tsx +164 -0
- package/src/modules/library/components/NewPluginDialog.tsx +16 -2
- package/src/modules/library/components/PageActions.tsx +11 -9
- package/src/modules/library/components/{PendingSkillReview.tsx → PendingItemReview.tsx} +14 -7
- package/src/modules/library/components/PersonalAddDialog.tsx +68 -18
- package/src/modules/library/components/PersonalPluginPage.tsx +121 -22
- package/src/modules/library/components/PluginExtras.tsx +140 -17
- package/src/modules/library/components/PluginIndexRow.tsx +47 -12
- package/src/modules/library/components/PluginPage.tsx +157 -41
- package/src/modules/library/components/PluginRows.tsx +286 -0
- package/src/modules/library/components/PluginsSidebar.tsx +239 -263
- package/src/modules/library/components/PluginsSidebarMenu.tsx +26 -1
- package/src/modules/library/components/ShareButton.tsx +17 -0
- package/src/modules/library/components/SkillsTree.tsx +141 -28
- package/src/modules/library/components/TeamRoute.tsx +15 -0
- package/src/modules/library/components/__tests__/upload-notices-once-per-page.test.tsx +144 -0
- package/src/modules/library/components/plugin-page-parts.tsx +103 -17
- package/src/modules/library/components/skill-page/SharedViaPlugins.tsx +6 -12
- package/src/modules/library/components/skill-page/SkillFilePane.tsx +5 -0
- package/src/modules/library/components/skill-page/SkillPage.tsx +274 -122
- package/src/modules/library/components/tool-page/DeleteToolDialog.tsx +218 -0
- package/src/modules/library/components/tool-page/ToolConnectionSection.tsx +79 -178
- package/src/modules/library/components/tool-page/ToolPage.tsx +106 -16
- package/src/modules/library/components/tool-page/ToolVarRow.tsx +42 -41
- package/src/modules/library/hooks/__tests__/useLibraryData.test.ts +98 -0
- package/src/modules/library/hooks/useLibraryData.ts +92 -19
- package/src/modules/library/routes/LibraryRoutes.tsx +14 -11
- package/src/modules/library/routes/WorkspaceItemRoute.tsx +77 -27
- package/src/modules/library/routes/library-paths.ts +26 -28
- package/src/modules/library/services/library.api.ts +38 -20
- package/src/modules/library/services/plugins.api.ts +69 -8
- package/src/modules/library/services/teams.api.ts +15 -0
- package/src/modules/library/services/tools.api.ts +78 -0
- package/src/modules/library/state/library-data.tsx +170 -32
- package/src/modules/library/utils/personal-plugin.ts +13 -15
- package/src/modules/library/utils/plugin-entries.ts +134 -0
- package/src/modules/library/utils/plugin-summary.ts +75 -9
- package/src/modules/library/utils/status.ts +135 -33
- package/src/modules/onboarding/__tests__/creator-welcome.test.tsx +8 -1
- package/src/modules/onboarding/__tests__/onboarding.test.tsx +853 -760
- package/src/modules/onboarding/agent-clients.ts +55 -23
- package/src/modules/onboarding/components/ConnectAgentPill.tsx +5 -1
- package/src/modules/onboarding/components/WelcomePage.tsx +98 -62
- package/src/modules/pr/services/pr-merge.api.ts +2 -1
- package/src/modules/review/components/MarkdownDiffViewer.tsx +53 -8
- package/src/modules/review/components/ReviewPanel.tsx +15 -17
- package/src/modules/review/components/__tests__/MarkdownDiffViewer.test.tsx +64 -0
- package/src/modules/review/components/__tests__/ReviewPanel.test.tsx +25 -1
- package/src/modules/secrets-vault/components/ConnectToolsPage.tsx +454 -117
- package/src/modules/secrets-vault/components/SecretsPage.tsx +48 -7
- package/src/modules/secrets-vault/components/ToolSecretsPanel.tsx +84 -5
- package/src/modules/secrets-vault/components/__tests__/ConnectToolsPage.test.tsx +425 -0
- package/src/modules/secrets-vault/components/__tests__/SecretsPage.test.tsx +417 -82
- package/src/modules/secrets-vault/components/__tests__/ToolSecretsPanel.test.tsx +105 -0
- package/src/modules/secrets-vault/components/__tests__/connect-lists-what-the-banner-counted.test.tsx +407 -0
- package/src/modules/secrets-vault/probe/SavedKeyProbeResult.tsx +98 -0
- package/src/modules/secrets-vault/probe/__tests__/probe-verdict.test.ts +160 -0
- package/src/modules/secrets-vault/probe/probe-verdict.ts +108 -0
- package/src/modules/secrets-vault/probe/useSavedKeyProbe.ts +228 -0
- package/src/modules/secrets-vault/services/connect.api.ts +36 -5
- package/src/modules/secrets-vault/utils/connect-status.ts +98 -0
- package/src/modules/settings/components/ClaudeConnectionCard.tsx +9 -24
- package/src/modules/settings/components/ClaudeConnectionFields.tsx +23 -0
- package/src/modules/settings/components/DeploymentPage.tsx +10 -30
- package/src/modules/settings/components/MarketplaceSection.tsx +152 -0
- package/src/modules/settings/components/__tests__/DeploymentPage.test.tsx +67 -4
- package/src/modules/settings/components/__tests__/MarketplaceSection.test.tsx +325 -0
- package/src/modules/settings/components/__tests__/SettingsLayout.test.tsx +5 -5
- package/src/modules/settings/services/github-facade.api.ts +23 -0
- package/src/modules/settings/settings-nav-items.tsx +10 -2
- package/src/modules/setup/__tests__/setup.oidc.test.tsx +172 -0
- package/src/modules/setup/__tests__/setup.probe-refusal.test.tsx +123 -0
- package/src/modules/setup/__tests__/setup.test.tsx +497 -4
- package/src/modules/setup/__tests__/useSetupStatus.test.tsx +130 -0
- package/src/modules/setup/components/SetupGate.tsx +16 -16
- package/src/modules/setup/components/SetupScreen.tsx +521 -43
- package/src/modules/setup/hooks/useSetupStatus.ts +93 -0
- package/src/modules/setup/services/setup.api.ts +140 -3
- package/src/modules/setup/utils/__tests__/root-folders.test.ts +72 -0
- package/src/modules/setup/utils/root-folders.ts +46 -0
- package/src/modules/toolbar/assets/claude-setup/01-add-manually.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/02-add-configuration.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/03-connect-account.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/04-pick-instance.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/05-plugins-add.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/06-add-marketplace.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/07-paste-url-sync.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/08-install-plugins.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/09-select-repository.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/10-connector-not-added.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/11-add-custom-connector.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/README.md +68 -0
- package/src/modules/toolbar/components/AgentInstructionsCard.tsx +296 -0
- package/src/modules/toolbar/components/ClaudeMarketplaceCarousel.tsx +107 -0
- package/src/modules/toolbar/components/ClaudeRegistrationSteps.tsx +127 -0
- package/src/modules/toolbar/components/CoworkSetupSteps.tsx +100 -0
- package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +177 -118
- package/src/modules/toolbar/components/ScreenshotStep.tsx +77 -0
- package/src/modules/toolbar/components/SetupCarousel.tsx +177 -0
- package/src/modules/toolbar/components/__tests__/AgentInstructionsCard.test.tsx +370 -0
- package/src/modules/toolbar/components/__tests__/ExternalAgentAccessPage.test.tsx +542 -42
- package/src/modules/toolbar/components/__tests__/Toolbar.test.tsx +2 -2
- package/src/modules/toolbar/components/__tests__/claude-setup-shots.test.ts +104 -0
- package/src/modules/toolbar/components/claude-connector-slide.tsx +38 -0
- package/src/modules/toolbar/components/claude-setup-shots.ts +167 -0
- package/src/modules/toolbar/components/deployment-address.ts +29 -0
- package/src/modules/toolbar/components/setup-step-parts.tsx +35 -0
- package/src/modules/toolbar/services/__tests__/agent-instructions.api.test.ts +89 -0
- package/src/modules/toolbar/services/agent-instructions.api.ts +167 -0
- package/src/modules/toolbar/services/external-api-keys.api.ts +6 -0
- package/src/modules/workflow/state/ChangeRequestStaleBinder.tsx +43 -0
- package/src/modules/workflow/state/EventBusProvider.tsx +122 -11
- package/src/modules/workflow/state/__tests__/EventBusProvider.storage.test.tsx +87 -0
- package/src/modules/workflow/state/__tests__/EventBusProvider.watch.test.tsx +223 -0
- package/src/modules/workflow/state/event-bus.context.ts +10 -0
- package/src/modules/workspace/__tests__/testFixtures.ts +5 -3
- package/src/modules/workspace/components/FileExplorer.tsx +1295 -191
- package/src/modules/workspace/components/FileRoute.tsx +353 -36
- package/src/modules/workspace/components/FileViewer.tsx +166 -45
- package/src/modules/workspace/components/KbDocumentShell.tsx +50 -6
- package/src/modules/workspace/components/KbPageHeader.tsx +120 -55
- package/src/modules/workspace/components/TreeActionConfirm.tsx +350 -0
- package/src/modules/workspace/components/__tests__/FileExplorer.test.tsx +2473 -129
- package/src/modules/workspace/components/__tests__/FileRoute.test.tsx +731 -18
- package/src/modules/workspace/components/__tests__/FileViewer.test.tsx +331 -12
- package/src/modules/workspace/components/__tests__/KbDocumentShell.test.tsx +39 -0
- package/src/modules/workspace/components/__tests__/KbPageHeader.test.tsx +33 -20
- package/src/modules/workspace/components/renderers/DocxRenderer.tsx +4 -5
- package/src/modules/workspace/components/renderers/DownloadFileButton.tsx +13 -4
- package/src/modules/workspace/components/renderers/EmailRenderer.tsx +4 -3
- package/src/modules/workspace/components/renderers/HtmlRenderer.tsx +8 -14
- package/src/modules/workspace/components/renderers/ImageRenderer.tsx +75 -16
- package/src/modules/workspace/components/renderers/KbImage.tsx +180 -0
- package/src/modules/workspace/components/renderers/KbMarkdownView.tsx +22 -6
- package/src/modules/workspace/components/renderers/MarkdownRenderer.tsx +48 -22
- package/src/modules/workspace/components/renderers/PdfRenderer.tsx +4 -5
- package/src/modules/workspace/components/renderers/PptxRenderer.tsx +4 -3
- package/src/modules/workspace/components/renderers/XlsxRenderer.tsx +4 -3
- package/src/modules/workspace/components/renderers/__tests__/DocxRenderer.test.tsx +12 -0
- package/src/modules/workspace/components/renderers/__tests__/DownloadFileButton.test.tsx +57 -9
- package/src/modules/workspace/components/renderers/__tests__/EmailRenderer.test.tsx +13 -1
- package/src/modules/workspace/components/renderers/__tests__/ImageRenderer.test.tsx +163 -0
- package/src/modules/workspace/components/renderers/__tests__/KbMarkdownView.test.tsx +237 -0
- package/src/modules/workspace/components/renderers/__tests__/MarkdownRenderer.test.tsx +108 -14
- package/src/modules/workspace/components/renderers/__tests__/PptxRenderer.test.tsx +14 -1
- package/src/modules/workspace/components/renderers/__tests__/XlsxRenderer.test.tsx +16 -1
- package/src/modules/workspace/components/renderers/__tests__/rendererSelection.test.tsx +66 -1
- package/src/modules/workspace/components/renderers/index.ts +53 -2
- package/src/modules/workspace/components/renderers/kbMarkdownPipeline.tsx +25 -4
- package/src/modules/workspace/components/renderers/rendererWorkspace.ts +40 -0
- package/src/modules/workspace/hooks/__tests__/useImageRevision.test.tsx +174 -0
- package/src/modules/workspace/hooks/__tests__/useOpenChangeRequests.test.tsx +179 -1
- package/src/modules/workspace/hooks/__tests__/useWorkspaceImageResolver.test.tsx +122 -0
- package/src/modules/workspace/hooks/__tests__/useWorkspaceState.test.tsx +892 -7
- package/src/modules/workspace/hooks/useImageRevision.ts +101 -0
- package/src/modules/workspace/hooks/useMergedWorkspaceTree.ts +22 -3
- package/src/modules/workspace/hooks/useWorkspaceImageResolver.ts +55 -0
- package/src/modules/workspace/hooks/useWorkspaceState.ts +424 -66
- package/src/modules/workspace/routing/__tests__/kb-routes.test.tsx +279 -3
- package/src/modules/workspace/routing/kb-routes.ts +206 -29
- package/src/modules/workspace/services/__tests__/workspace.api.test.ts +57 -1
- package/src/modules/workspace/services/workspace.api.ts +57 -4
- package/src/modules/workspace/state/__tests__/applied-request-clears-pending.test.tsx +343 -0
- package/src/modules/workspace/state/__tests__/upload-lands-where-it-was-dropped.test.tsx +158 -0
- package/src/modules/workspace/state/open-change-requests.tsx +100 -12
- package/src/modules/workspace/state/workspace.context.ts +125 -19
- package/src/modules/workspace/utils/__tests__/file-trace.test.ts +73 -0
- package/src/modules/workspace/utils/__tests__/fileTree.test.ts +220 -6
- package/src/modules/workspace/utils/__tests__/pasteLink.test.ts +76 -0
- package/src/modules/workspace/utils/__tests__/treeConfirm.test.ts +364 -0
- package/src/modules/workspace/utils/__tests__/uploadError.test.ts +35 -0
- package/src/modules/workspace/utils/file-trace.ts +50 -0
- package/src/modules/workspace/utils/fileTree.ts +112 -36
- package/src/modules/workspace/utils/frontmatter.ts +8 -4
- package/src/modules/workspace/utils/pasteLink.ts +90 -0
- package/src/modules/workspace/utils/treeConfirm.ts +338 -0
- package/src/modules/workspace/utils/uploadError.ts +29 -0
- package/src/shared/__tests__/marketplace-url.test.ts +6 -1
- package/src/shared/components/Button.tsx +16 -2
- package/src/shared/components/Dialog.tsx +27 -11
- package/src/shared/components/Menu.tsx +13 -1
- package/src/shared/components/PageShell.tsx +13 -8
- package/src/shared/components/__tests__/primitives.test.tsx +116 -2
- package/src/shared/components/__tests__/useFocusHandoff.test.tsx +192 -0
- package/src/shared/components/index.ts +2 -0
- package/src/shared/components/useDismissableMenu.ts +32 -10
- package/src/shared/components/useFocusHandoff.ts +51 -0
- package/src/shared/components/useLatestRef.ts +28 -0
- package/src/shared/markdown/Markdown.tsx +12 -3
- package/src/shared/markdown/__tests__/escapeSpacesInLinkDestinations.test.ts +39 -0
- package/src/shared/markdown/hrefs.ts +50 -0
- package/src/shared/marketplace-url.ts +33 -5
- package/src/shared/mcp/ChatGptInstallLink.tsx +3 -3
- package/src/shared/mcp/ConnectionInstructions.tsx +38 -27
- package/src/shared/mcp/__tests__/connect-snippets.test.ts +3 -3
- package/src/shared/mcp/connect-snippets.ts +14 -9
- package/src/shared/mcp/index.ts +1 -1
- package/src/shared/theme/__tests__/header-band.test.ts +197 -0
- package/src/shared/theme/header.ts +75 -0
- package/src/shared/theme/measure.ts +7 -4
- package/src/shared/theme/tokens.css +25 -0
- package/src/modules/library/__tests__/PluginsIndexPage.test.tsx +0 -363
- package/src/modules/library/__tests__/PluginsSidebar.locked.test.tsx +0 -97
- package/src/modules/library/components/PluginsIndexPage.tsx +0 -270
- package/src/modules/update-check/__tests__/UpdateBanner.test.tsx +0 -126
- package/src/modules/update-check/components/UpdateBanner.tsx +0 -92
- package/src/modules/update-check/services/update-check.api.ts +0 -24
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { useCallback, useEffect, useState } from 'react';
|
|
1
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { Link } from 'react-router-dom';
|
|
3
3
|
import { Badge, Banner, Button, Surface, TextField } from '../../../shared/components';
|
|
4
4
|
import { cn } from '../../../lib/utils';
|
|
5
5
|
import { LIBRARY_ROOT, pathForTool } from '../../library/routes/library-paths';
|
|
6
6
|
import { ToolLogo } from '../../library/components/ToolLogo';
|
|
7
7
|
import { startOAuth } from '../services/secrets.api';
|
|
8
|
-
import { setUserVar, deleteUserVar } from '../services/tool-secrets.api';
|
|
8
|
+
import { setUserVar, setAdminVar, deleteUserVar, setOAuthClientSecret } from '../services/tool-secrets.api';
|
|
9
|
+
import { SavedKeyProbeResult } from '../probe/SavedKeyProbeResult';
|
|
10
|
+
import { useSavedKeyProbe, type SavedKeyProbe } from '../probe/useSavedKeyProbe';
|
|
11
|
+
import { announceToolCredentialsChanged } from '../../../core/events';
|
|
9
12
|
import {
|
|
10
13
|
getConnectPending,
|
|
11
14
|
startToolOAuth,
|
|
@@ -15,6 +18,12 @@ import {
|
|
|
15
18
|
type ConnectOAuth,
|
|
16
19
|
type ConnectToolOAuth,
|
|
17
20
|
} from '../services/connect.api';
|
|
21
|
+
import {
|
|
22
|
+
isActionable,
|
|
23
|
+
outstandingCount,
|
|
24
|
+
ownerReason,
|
|
25
|
+
standaloneOutstanding,
|
|
26
|
+
} from '../utils/connect-status';
|
|
18
27
|
|
|
19
28
|
/**
|
|
20
29
|
* Persisted copy of the external-agent authorization state (`?oauth=<state>`).
|
|
@@ -26,10 +35,25 @@ const MCP_OAUTH_STATE_KEY = 'mcp-oauth-state';
|
|
|
26
35
|
|
|
27
36
|
/**
|
|
28
37
|
* "Connect your tools" — the page a person lands on from the needs-authorization
|
|
29
|
-
* link surfaced by their external agent
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
38
|
+
* link surfaced by their external agent, and from the plugin banner that says
|
|
39
|
+
* how many integrations need setup. It lists everything standing between them
|
|
40
|
+
* and the tools they can reach: an input for each personal API key, an
|
|
41
|
+
* "Authorize" button for each OAuth sign-in.
|
|
42
|
+
*
|
|
43
|
+
* It also lists what they CANNOT act on, which is the whole point of the list
|
|
44
|
+
* agreeing with the banner that sent them. Three states, and the page owes the
|
|
45
|
+
* reader the reason for each of the two that are not theirs to fix:
|
|
46
|
+
*
|
|
47
|
+
* - actionable — their own key or sign-in, or a workspace value they own;
|
|
48
|
+
* - owner-only — a workspace value somebody else has to set, greyed, naming
|
|
49
|
+
* the variable so they know what to ask for;
|
|
50
|
+
* - skipped — a tool they took out themselves, greyed, with Include to put it
|
|
51
|
+
* back.
|
|
52
|
+
*
|
|
53
|
+
* All three are counted. A banner saying four and a page showing two was the
|
|
54
|
+
* bug; a page that showed four and counted two would be the same bug with more
|
|
55
|
+
* steps. What is NOT here is a tool the reader may not read — the server never
|
|
56
|
+
* sends one, so there is no state in which this page names it.
|
|
33
57
|
*
|
|
34
58
|
* Two modes:
|
|
35
59
|
* - Plain (default): configure credentials, go back to the agent by hand.
|
|
@@ -40,42 +64,78 @@ const MCP_OAUTH_STATE_KEY = 'mcp-oauth-state';
|
|
|
40
64
|
* sends the browser back to the agent.
|
|
41
65
|
*
|
|
42
66
|
* DESIGN: this page speaks the Library's vocabulary, because it is the other
|
|
43
|
-
* half of the same job. Every state reads what is STORED — `Signed in`,
|
|
44
|
-
* `Key saved` — or `Needs
|
|
45
|
-
* reserved for the tool page, whose probe actually earns the word), nothing
|
|
46
|
-
* that needs a person is grey, and a tool is
|
|
67
|
+
* half of the same job. Every ROW state reads what is STORED — `Signed in`,
|
|
68
|
+
* `Key saved` — or `Needs …`, nothing that needs a person is grey, and a tool is
|
|
47
69
|
* identified by its mark before its name — the same `ToolLogo` the gallery
|
|
48
70
|
* cards use. It went through the design system wholesale: no raw palette, no
|
|
49
71
|
* off-scale type, no ad-hoc bordered `div`s pretending to be Surfaces.
|
|
72
|
+
*
|
|
73
|
+
* `Connected` appears in exactly one place here, and only after a real call:
|
|
74
|
+
* the probe each key row runs on its own save (`SavedKeyProbeResult`). This
|
|
75
|
+
* page used to store a key and say nothing, so a mistyped one sat here looking
|
|
76
|
+
* identical to a working one — the badge said `Key saved`, which was true, and
|
|
77
|
+
* nothing anywhere said the provider had refused it.
|
|
50
78
|
*/
|
|
51
79
|
export function ConnectToolsPage() {
|
|
52
80
|
const [tools, setTools] = useState<ConnectTool[]>([]);
|
|
53
81
|
const [oauth, setOauth] = useState<ConnectOAuth[]>([]);
|
|
54
82
|
const [toolOAuth, setToolOAuth] = useState<ConnectToolOAuth[]>([]);
|
|
55
83
|
const [loading, setLoading] = useState(true);
|
|
84
|
+
/** A refetch is in flight over a list that is already on screen. */
|
|
85
|
+
const [refreshing, setRefreshing] = useState(false);
|
|
56
86
|
const [error, setError] = useState<string | null>(null);
|
|
57
87
|
const [notice, setNotice] = useState<string | null>(null);
|
|
58
88
|
// Agent-connect mode: the signed authorization state + who is asking.
|
|
59
89
|
const [agentState, setAgentState] = useState<string | null>(null);
|
|
60
90
|
const [agentName, setAgentName] = useState<string | null>(null);
|
|
61
91
|
const [finishing, setFinishing] = useState(false);
|
|
62
|
-
// Entries the user
|
|
63
|
-
//
|
|
64
|
-
|
|
92
|
+
// Entries the user took OUT. Everything the server sent is in by default —
|
|
93
|
+
// it used to be the other way round, and an unconfigured tool the reader had
|
|
94
|
+
// never seen rendered grey and uncounted, which is exactly how a page reached
|
|
95
|
+
// from "4 integrations need setup" came to show two.
|
|
96
|
+
const [skipped, setSkipped] = useState<Set<string>>(new Set());
|
|
65
97
|
const [wiping, setWiping] = useState<Set<string>>(new Set());
|
|
66
98
|
|
|
67
|
-
|
|
68
|
-
|
|
99
|
+
/**
|
|
100
|
+
* Which load is allowed to publish. Saving a key refreshes, and so does the
|
|
101
|
+
* mount, the Refresh button and every wipe — so two are routinely open at
|
|
102
|
+
* once, and the network does not promise to answer them in order. An older
|
|
103
|
+
* answer landing last would repaint the page with the state from BEFORE the
|
|
104
|
+
* save: the row just filled in back to `Needs a key`, or the client-secret
|
|
105
|
+
* form the owner just completed, back and empty. The same newest-wins rule
|
|
106
|
+
* the probe itself follows, for the same reason.
|
|
107
|
+
*/
|
|
108
|
+
const loadSeq = useRef(0);
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* @param quiet keep the list on screen while it refetches.
|
|
112
|
+
*
|
|
113
|
+
* The loud refresh drops the page to "Loading…", which UNMOUNTS every row —
|
|
114
|
+
* and a row holds the verdict of the probe its own save just started. That
|
|
115
|
+
* state is the only copy (nothing persists a verdict), so a loud refetch
|
|
116
|
+
* after a save throws away the very answer the save was waiting for. Same
|
|
117
|
+
* fix `useToolPage` made for the tool page, for the same reason.
|
|
118
|
+
*/
|
|
119
|
+
const refresh = useCallback(async (quiet = false) => {
|
|
120
|
+
const mine = ++loadSeq.current;
|
|
121
|
+
if (!quiet) setLoading(true);
|
|
122
|
+
setRefreshing(true);
|
|
69
123
|
try {
|
|
70
124
|
const pending = await getConnectPending();
|
|
125
|
+
if (loadSeq.current !== mine) return;
|
|
71
126
|
setTools(pending.tools);
|
|
72
127
|
setOauth(pending.oauth);
|
|
73
128
|
setToolOAuth(pending.toolOAuth);
|
|
74
129
|
setError(null);
|
|
75
130
|
} catch (err) {
|
|
76
|
-
|
|
131
|
+
// Inside the guard too: an older load failing after a newer one
|
|
132
|
+
// succeeded would raise an alert about a request nobody is waiting on.
|
|
133
|
+
if (loadSeq.current === mine) setError(err instanceof Error ? err.message : String(err));
|
|
77
134
|
} finally {
|
|
78
|
-
|
|
135
|
+
if (loadSeq.current === mine) {
|
|
136
|
+
setLoading(false);
|
|
137
|
+
setRefreshing(false);
|
|
138
|
+
}
|
|
79
139
|
}
|
|
80
140
|
}, []);
|
|
81
141
|
|
|
@@ -126,6 +186,10 @@ export function ConnectToolsPage() {
|
|
|
126
186
|
else if (params.has('error')) setError(params.get('error') || 'Authorization failed.');
|
|
127
187
|
if (params.has('authorized') || params.has('error')) {
|
|
128
188
|
window.history.replaceState(null, '', window.location.pathname + window.location.search);
|
|
189
|
+
// Whichever way the round-trip went, a provider has just had its say
|
|
190
|
+
// about a sign-in this page did not perform itself — so the Library's
|
|
191
|
+
// view of the tool is from before the browser left.
|
|
192
|
+
announceToolCredentialsChanged();
|
|
129
193
|
}
|
|
130
194
|
}, []);
|
|
131
195
|
|
|
@@ -161,30 +225,51 @@ export function ConnectToolsPage() {
|
|
|
161
225
|
};
|
|
162
226
|
|
|
163
227
|
/**
|
|
164
|
-
* Include/skip toggle. `id` keys the local opt-
|
|
228
|
+
* Include/skip toggle. `id` keys the local opt-out set; `configured` says
|
|
165
229
|
* whether any per-user value exists; `wipe` removes them all. Unticking a
|
|
166
230
|
* configured entry wipes it (that's what "skip" means — the tool must not
|
|
167
231
|
* register for the agent); unticking an unconfigured one just hides inputs.
|
|
232
|
+
* Either way the row STAYS, greyed and still counted: skipping is a decision
|
|
233
|
+
* about what the agent may use, not a claim the tool is set up.
|
|
234
|
+
*
|
|
235
|
+
* `wipe` calls the `removed` callback it is handed after each DELETE that
|
|
236
|
+
* lands. A tool with several saved keys is several round-trips, and the
|
|
237
|
+
* second one can fail after the first succeeded: that key is gone for real,
|
|
238
|
+
* so the Library's copy went stale at the FIRST success, not at the last.
|
|
239
|
+
* Announcing only on a clean wipe would leave the catalog showing a key
|
|
240
|
+
* nobody has any more.
|
|
168
241
|
*/
|
|
169
|
-
const onToggle = async (
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
242
|
+
const onToggle = async (
|
|
243
|
+
id: string,
|
|
244
|
+
configured: boolean,
|
|
245
|
+
wipe: (removed: () => void) => Promise<void>,
|
|
246
|
+
) => {
|
|
247
|
+
if (skipped.has(id)) {
|
|
248
|
+
setSkipped((s) => {
|
|
249
|
+
const nextSet = new Set(s);
|
|
250
|
+
nextSet.delete(id);
|
|
251
|
+
return nextSet;
|
|
252
|
+
});
|
|
173
253
|
return;
|
|
174
254
|
}
|
|
175
|
-
|
|
176
|
-
const nextSet = new Set(s);
|
|
177
|
-
nextSet.delete(id);
|
|
178
|
-
return nextSet;
|
|
179
|
-
});
|
|
255
|
+
setSkipped((s) => new Set(s).add(id));
|
|
180
256
|
if (configured) {
|
|
181
257
|
setWiping((s) => new Set(s).add(id));
|
|
258
|
+
let removedAny = false;
|
|
182
259
|
try {
|
|
183
|
-
await wipe()
|
|
184
|
-
|
|
260
|
+
await wipe(() => {
|
|
261
|
+
removedAny = true;
|
|
262
|
+
});
|
|
185
263
|
} catch (err) {
|
|
186
264
|
setError(err instanceof Error ? err.message : String(err));
|
|
187
265
|
} finally {
|
|
266
|
+
if (removedAny) {
|
|
267
|
+
// Before this page's own refetch, not after it: the Library is a
|
|
268
|
+
// different store with a different round-trip, and there is nothing
|
|
269
|
+
// for it to wait on.
|
|
270
|
+
announceToolCredentialsChanged();
|
|
271
|
+
await refresh();
|
|
272
|
+
}
|
|
188
273
|
setWiping((s) => {
|
|
189
274
|
const nextSet = new Set(s);
|
|
190
275
|
nextSet.delete(id);
|
|
@@ -198,23 +283,17 @@ export function ConnectToolsPage() {
|
|
|
198
283
|
const toolId = (t: ConnectTool) => `tool:${t.slug}`;
|
|
199
284
|
const signInId = (o: ConnectToolOAuth) => `signin:${o.key}`;
|
|
200
285
|
const toolConfigured = (t: ConnectTool) => t.variables.some((v) => v.configured);
|
|
201
|
-
const
|
|
202
|
-
|
|
203
|
-
//
|
|
204
|
-
//
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
) +
|
|
213
|
-
oauth.filter((o) => !o.authorized).length +
|
|
214
|
-
// Not-yet-connected OR connected-but-under-scoped (needs reconnect) both count.
|
|
215
|
-
toolOAuth.filter(
|
|
216
|
-
(o) => isIncluded(signInId(o), o.authorized) && (!o.authorized || o.needsReauth),
|
|
217
|
-
).length;
|
|
286
|
+
const isOn = (id: string) => !skipped.has(id);
|
|
287
|
+
|
|
288
|
+
// One integration, one unit — and every state of it, including the two the
|
|
289
|
+
// reader cannot act on. See `outstandingCount`: this number exists to equal
|
|
290
|
+
// the plugin banner's, and the rules that make it do so are written down
|
|
291
|
+
// beside the rule the banner itself uses.
|
|
292
|
+
// …and the standalone sign-ins on top of it, only for the "anything left?"
|
|
293
|
+
// question the zero-state banner asks. No banner counts those, so they stay
|
|
294
|
+
// out of the number that has to match one.
|
|
295
|
+
const listing = { tools, oauth, toolOAuth };
|
|
296
|
+
const outstanding = outstandingCount(listing) + standaloneOutstanding(listing);
|
|
218
297
|
const nothingToDo =
|
|
219
298
|
!loading && tools.length === 0 && oauth.length === 0 && toolOAuth.length === 0;
|
|
220
299
|
|
|
@@ -231,7 +310,18 @@ export function ConnectToolsPage() {
|
|
|
231
310
|
{'‹ Skills & tools'}
|
|
232
311
|
</Link>
|
|
233
312
|
<h1 className="text-strong font-semibold text-ink">Connect your tools</h1>
|
|
234
|
-
|
|
313
|
+
{/* Quiet, like the refetch a save triggers. A loud one drops the page
|
|
314
|
+
to "Loading…", which unmounts the row holding the verdict of the
|
|
315
|
+
probe its own save just started — and that state is the only copy
|
|
316
|
+
of it. Disabling is the feedback instead: the list a spinner would
|
|
317
|
+
replace is already on screen. */}
|
|
318
|
+
<Button
|
|
319
|
+
variant="quiet"
|
|
320
|
+
size="sm"
|
|
321
|
+
className="ml-auto"
|
|
322
|
+
disabled={loading || refreshing}
|
|
323
|
+
onClick={() => void refresh(true)}
|
|
324
|
+
>
|
|
235
325
|
Refresh
|
|
236
326
|
</Button>
|
|
237
327
|
</header>
|
|
@@ -276,12 +366,16 @@ export function ConnectToolsPage() {
|
|
|
276
366
|
</Banner>
|
|
277
367
|
)}
|
|
278
368
|
|
|
369
|
+
{/* The third sentence is the one that earns the list its length: the
|
|
370
|
+
page shows more than the reader's own homework, so it has to say
|
|
371
|
+
so before they wonder why a row has no field. */}
|
|
279
372
|
{!nothingToDo && (
|
|
280
373
|
<p className="mb-5 text-ui text-ink-muted">
|
|
281
|
-
These tools need
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
374
|
+
These tools need a sign-in or a key before they will work in your agent. Authorize
|
|
375
|
+
each connection and enter any keys below, then head back to your agent and run the
|
|
376
|
+
tool again. Anything greyed out is not yours to do — it is waiting on the tool's
|
|
377
|
+
owner, or you took it out yourself. Your values are stored securely and never shown
|
|
378
|
+
again after saving.
|
|
285
379
|
</p>
|
|
286
380
|
)}
|
|
287
381
|
|
|
@@ -317,7 +411,37 @@ export function ConnectToolsPage() {
|
|
|
317
411
|
{/* OAuth-backed tool variables — authorized via the tool-scoped flow. */}
|
|
318
412
|
{toolOAuth.map((o) => {
|
|
319
413
|
const id = signInId(o);
|
|
320
|
-
const on =
|
|
414
|
+
const on = isOn(id);
|
|
415
|
+
// The provider was never registered, so there is no consent
|
|
416
|
+
// screen for Authorize to open. Whose job that is decides
|
|
417
|
+
// whether this is a greyed reason or a field.
|
|
418
|
+
if (!o.ownerConfigured) {
|
|
419
|
+
return o.ownerOnly ? (
|
|
420
|
+
<ConnectRow
|
|
421
|
+
key={o.key}
|
|
422
|
+
slug={o.slug}
|
|
423
|
+
name={o.toolName}
|
|
424
|
+
label={o.label || o.toolName}
|
|
425
|
+
on
|
|
426
|
+
dim
|
|
427
|
+
busy={false}
|
|
428
|
+
state="owner-only"
|
|
429
|
+
reason={ownerReason(o.varName)}
|
|
430
|
+
/>
|
|
431
|
+
) : (
|
|
432
|
+
<SignInOwnerSecret
|
|
433
|
+
key={o.key}
|
|
434
|
+
o={o}
|
|
435
|
+
onSaved={() => {
|
|
436
|
+
announceToolCredentialsChanged();
|
|
437
|
+
// Quiet, for the same reason as a key save: the row
|
|
438
|
+
// is about to show the probe's answer.
|
|
439
|
+
void refresh(true);
|
|
440
|
+
}}
|
|
441
|
+
onError={setError}
|
|
442
|
+
/>
|
|
443
|
+
);
|
|
444
|
+
}
|
|
321
445
|
return (
|
|
322
446
|
<ConnectRow
|
|
323
447
|
key={o.key}
|
|
@@ -325,6 +449,7 @@ export function ConnectToolsPage() {
|
|
|
325
449
|
name={o.toolName}
|
|
326
450
|
label={o.label || o.toolName}
|
|
327
451
|
on={on}
|
|
452
|
+
dim={!on}
|
|
328
453
|
busy={wiping.has(id)}
|
|
329
454
|
state={
|
|
330
455
|
!on
|
|
@@ -336,7 +461,10 @@ export function ConnectToolsPage() {
|
|
|
336
461
|
: 'needs-signin'
|
|
337
462
|
}
|
|
338
463
|
onToggle={() =>
|
|
339
|
-
void onToggle(id, o.authorized, () =>
|
|
464
|
+
void onToggle(id, o.authorized, async (removed) => {
|
|
465
|
+
await deleteUserVar(o.slug, o.varName);
|
|
466
|
+
removed();
|
|
467
|
+
})
|
|
340
468
|
}
|
|
341
469
|
action={
|
|
342
470
|
on ? (
|
|
@@ -347,7 +475,9 @@ export function ConnectToolsPage() {
|
|
|
347
475
|
>
|
|
348
476
|
{o.authorized ? 'Reconnect' : 'Authorize'}
|
|
349
477
|
</Button>
|
|
350
|
-
) :
|
|
478
|
+
) : (
|
|
479
|
+
<IncludeButton onClick={() => void onToggle(id, false, async () => {})} />
|
|
480
|
+
)
|
|
351
481
|
}
|
|
352
482
|
/>
|
|
353
483
|
);
|
|
@@ -360,6 +490,7 @@ export function ConnectToolsPage() {
|
|
|
360
490
|
name={o.label || o.key}
|
|
361
491
|
label={o.label || o.key}
|
|
362
492
|
on
|
|
493
|
+
dim={false}
|
|
363
494
|
busy={false}
|
|
364
495
|
state={o.authorized ? 'signed-in' : 'needs-signin'}
|
|
365
496
|
action={
|
|
@@ -381,8 +512,28 @@ export function ConnectToolsPage() {
|
|
|
381
512
|
{tools.map((tool) => {
|
|
382
513
|
const id = toolId(tool);
|
|
383
514
|
const configured = toolConfigured(tool);
|
|
384
|
-
|
|
385
|
-
|
|
515
|
+
// A tool whose every remaining variable belongs to somebody
|
|
516
|
+
// else offers nothing to opt into, so it gets no toggle —
|
|
517
|
+
// and cannot be "skipped by you", because you never had it.
|
|
518
|
+
const actionable = tool.variables.filter(isActionable);
|
|
519
|
+
const on = actionable.length === 0 || isOn(id);
|
|
520
|
+
const unset = actionable.filter((v) => !v.configured).length;
|
|
521
|
+
const ownerVar = tool.variables.find((v) => v.ownerOnly);
|
|
522
|
+
// Grey the CARD only when nothing on it is the reader's to
|
|
523
|
+
// do: they took the tool out, or every variable left on it
|
|
524
|
+
// belongs to an owner. A tool that owes a workspace value
|
|
525
|
+
// AND offers the reader a field of their own keeps its
|
|
526
|
+
// normal weight — the owner's line is already greyed on its
|
|
527
|
+
// own row (see `KeyRow`), and dimming the card around it
|
|
528
|
+
// would fade out an input that works right now.
|
|
529
|
+
const dim = !on || actionable.length === 0;
|
|
530
|
+
const state = !on
|
|
531
|
+
? ('skipped' as const)
|
|
532
|
+
: unset > 0
|
|
533
|
+
? ('needs-key' as const)
|
|
534
|
+
: ownerVar
|
|
535
|
+
? ('owner-only' as const)
|
|
536
|
+
: ('key-saved' as const);
|
|
386
537
|
return (
|
|
387
538
|
<Surface
|
|
388
539
|
key={tool.slug}
|
|
@@ -390,37 +541,46 @@ export function ConnectToolsPage() {
|
|
|
390
541
|
radius="xl"
|
|
391
542
|
elevation="card"
|
|
392
543
|
padded
|
|
393
|
-
className={cn(
|
|
544
|
+
className={cn(dim && 'opacity-60')}
|
|
394
545
|
>
|
|
395
546
|
<ConnectRowHead
|
|
396
547
|
slug={tool.slug}
|
|
397
548
|
name={tool.name}
|
|
398
549
|
label={tool.name}
|
|
399
550
|
on={on}
|
|
551
|
+
dim={dim}
|
|
400
552
|
busy={wiping.has(id)}
|
|
401
|
-
state={
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
553
|
+
state={state}
|
|
554
|
+
reason={state === 'owner-only' && ownerVar ? ownerReason(ownerVar.name) : undefined}
|
|
555
|
+
onToggle={
|
|
556
|
+
actionable.length === 0
|
|
557
|
+
? undefined
|
|
558
|
+
: () =>
|
|
559
|
+
void onToggle(id, configured, async (removed) => {
|
|
560
|
+
for (const v of actionable.filter((x) => x.configured)) {
|
|
561
|
+
await deleteUserVar(tool.slug, v.name);
|
|
562
|
+
removed();
|
|
563
|
+
}
|
|
564
|
+
})
|
|
565
|
+
}
|
|
566
|
+
action={
|
|
567
|
+
on ? undefined : (
|
|
568
|
+
<IncludeButton onClick={() => void onToggle(id, false, async () => {})} />
|
|
569
|
+
)
|
|
408
570
|
}
|
|
409
571
|
/>
|
|
410
572
|
{on && (
|
|
411
|
-
<
|
|
412
|
-
{tool
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
))}
|
|
423
|
-
</ul>
|
|
573
|
+
<ToolKeyList
|
|
574
|
+
tool={tool}
|
|
575
|
+
onSaved={() => {
|
|
576
|
+
announceToolCredentialsChanged();
|
|
577
|
+
// Quiet: a row is about to show what the provider
|
|
578
|
+
// makes of the key it just saved, and a loud
|
|
579
|
+
// refetch would unmount it first.
|
|
580
|
+
void refresh(true);
|
|
581
|
+
}}
|
|
582
|
+
onError={setError}
|
|
583
|
+
/>
|
|
424
584
|
)}
|
|
425
585
|
</Surface>
|
|
426
586
|
);
|
|
@@ -452,15 +612,29 @@ function Section({ title, children }: { title: string; children: React.ReactNode
|
|
|
452
612
|
* what is wrong. "skipped" is the one non-status here: it is a choice you made,
|
|
453
613
|
* not a state of the tool, so it stays grey.
|
|
454
614
|
*
|
|
455
|
-
*
|
|
456
|
-
*
|
|
457
|
-
*
|
|
458
|
-
*
|
|
459
|
-
*
|
|
460
|
-
* in
|
|
615
|
+
* Two of the seven are GREY on purpose, against the Library's rule that nothing
|
|
616
|
+
* needing a person is grey — because the rule is about the person READING. A
|
|
617
|
+
* workspace key only an owner can set, and a tool you took out yourself, both
|
|
618
|
+
* need somebody; neither needs you, and drawing them amber beside the rows you
|
|
619
|
+
* can actually fix is what makes a list of four unusable. They keep their place
|
|
620
|
+
* in the count regardless: grey says "not yours", never "not counted".
|
|
621
|
+
*
|
|
622
|
+
* Note what is NOT here: `Connected`. A ROW knows only what is STORED, and the
|
|
623
|
+
* one word that asserts a working connection belongs to a probe that actually
|
|
624
|
+
* called the provider — which is the line underneath the row, not the badge on
|
|
625
|
+
* it. Two states rather than one, because "signed in" and "key saved" describe
|
|
626
|
+
* two different things the reader did, and telling someone a key was saved
|
|
627
|
+
* when they signed in is a small lie of exactly the kind this vocabulary
|
|
628
|
+
* exists to stop.
|
|
461
629
|
*/
|
|
462
630
|
const ROW_STATE: Record<
|
|
463
|
-
'signed-in'
|
|
631
|
+
| 'signed-in'
|
|
632
|
+
| 'key-saved'
|
|
633
|
+
| 'needs-signin'
|
|
634
|
+
| 'needs-reauth'
|
|
635
|
+
| 'needs-key'
|
|
636
|
+
| 'owner-only'
|
|
637
|
+
| 'skipped',
|
|
464
638
|
{ text: string; tone: 'ok' | 'wait' | 'outline' }
|
|
465
639
|
> = {
|
|
466
640
|
'signed-in': { text: 'Signed in', tone: 'ok' },
|
|
@@ -468,45 +642,78 @@ const ROW_STATE: Record<
|
|
|
468
642
|
'needs-signin': { text: 'Needs your sign-in', tone: 'wait' },
|
|
469
643
|
'needs-reauth': { text: 'Needs signing in again', tone: 'wait' },
|
|
470
644
|
'needs-key': { text: 'Needs a key from you', tone: 'wait' },
|
|
471
|
-
|
|
645
|
+
// The default for a row whose `reason` names no variable; every one this page
|
|
646
|
+
// renders does name it, because "an owner" without "to set what" leaves the
|
|
647
|
+
// reader with nothing to ask for.
|
|
648
|
+
'owner-only': { text: 'Needs an owner', tone: 'outline' },
|
|
649
|
+
skipped: { text: 'Skipped by you', tone: 'outline' },
|
|
472
650
|
};
|
|
473
651
|
|
|
474
652
|
interface RowHeadProps {
|
|
475
653
|
slug: string;
|
|
476
654
|
name: string;
|
|
477
655
|
label: string;
|
|
656
|
+
/** The include/skip toggle's position — what the agent may use. */
|
|
478
657
|
on: boolean;
|
|
658
|
+
/** Greyed: nothing here is the reader's to do. Not the same question as `on`. */
|
|
659
|
+
dim: boolean;
|
|
479
660
|
busy: boolean;
|
|
480
661
|
state: keyof typeof ROW_STATE;
|
|
662
|
+
/** Overrides the state's stock wording — used to name the awaited variable. */
|
|
663
|
+
reason?: string;
|
|
481
664
|
onToggle?: () => void;
|
|
482
665
|
action?: React.ReactNode;
|
|
483
666
|
}
|
|
484
667
|
|
|
485
668
|
/** Mark, name, state, and (optionally) the control that fixes it. */
|
|
486
|
-
function ConnectRowHead({
|
|
669
|
+
function ConnectRowHead({
|
|
670
|
+
slug,
|
|
671
|
+
name,
|
|
672
|
+
label,
|
|
673
|
+
on,
|
|
674
|
+
dim,
|
|
675
|
+
busy,
|
|
676
|
+
state,
|
|
677
|
+
reason,
|
|
678
|
+
onToggle,
|
|
679
|
+
action,
|
|
680
|
+
}: RowHeadProps) {
|
|
487
681
|
const s = ROW_STATE[state];
|
|
488
682
|
return (
|
|
489
683
|
<div className="flex items-center gap-2.5">
|
|
490
684
|
{onToggle && <IncludeToggle on={on} busy={busy} onChange={onToggle} />}
|
|
491
|
-
<ToolLogo slug={slug} name={name} className={cn(
|
|
685
|
+
<ToolLogo slug={slug} name={name} className={cn(dim && 'grayscale')} />
|
|
492
686
|
<Link
|
|
493
687
|
to={pathForTool(slug)}
|
|
494
688
|
aria-label={`Open ${name}`}
|
|
495
689
|
className={cn(
|
|
496
690
|
'truncate rounded-xs text-ui font-semibold hover:underline',
|
|
497
|
-
|
|
691
|
+
dim ? 'text-ink-faint' : 'text-ink',
|
|
498
692
|
)}
|
|
499
693
|
>
|
|
500
694
|
{label}
|
|
501
695
|
</Link>
|
|
502
696
|
<Badge tone={s.tone} size="xs" className="shrink-0">
|
|
503
|
-
{s.text}
|
|
697
|
+
{reason ?? s.text}
|
|
504
698
|
</Badge>
|
|
505
699
|
{action && <span className="ml-auto shrink-0">{action}</span>}
|
|
506
700
|
</div>
|
|
507
701
|
);
|
|
508
702
|
}
|
|
509
703
|
|
|
704
|
+
/**
|
|
705
|
+
* Put a skipped tool back. The checkbox beside the name does the same thing,
|
|
706
|
+
* and this is here anyway: an unticked box in a greyed row reads as a record of
|
|
707
|
+
* what happened, not as the way to undo it.
|
|
708
|
+
*/
|
|
709
|
+
function IncludeButton({ onClick }: { onClick: () => void }) {
|
|
710
|
+
return (
|
|
711
|
+
<Button variant="outline" size="tiny" onClick={onClick}>
|
|
712
|
+
Include
|
|
713
|
+
</Button>
|
|
714
|
+
);
|
|
715
|
+
}
|
|
716
|
+
|
|
510
717
|
function ConnectRow(props: RowHeadProps) {
|
|
511
718
|
return (
|
|
512
719
|
<Surface tone="surface" radius="lg" elevation="none" padded className="border border-line">
|
|
@@ -541,18 +748,119 @@ function IncludeToggle({
|
|
|
541
748
|
);
|
|
542
749
|
}
|
|
543
750
|
|
|
751
|
+
/**
|
|
752
|
+
* One tool's keys, and the ONE probe they share.
|
|
753
|
+
*
|
|
754
|
+
* Tool-level, not row-level, because that is what a probe actually is: a
|
|
755
|
+
* single call carrying the tool's whole credential set. Two rows probing
|
|
756
|
+
* independently would each keep their own `Connected`, and the first would go
|
|
757
|
+
* on claiming it after the second changed the very keys it was testing.
|
|
758
|
+
*
|
|
759
|
+
* Each row saves through the call its tier needs — the workspace's value for
|
|
760
|
+
* an `admin` var, the reader's own for a `user` one — and a workspace value
|
|
761
|
+
* the reader may not write renders as the reason instead of a field.
|
|
762
|
+
*/
|
|
763
|
+
function ToolKeyList({
|
|
764
|
+
tool,
|
|
765
|
+
onSaved,
|
|
766
|
+
onError,
|
|
767
|
+
}: {
|
|
768
|
+
tool: ConnectTool;
|
|
769
|
+
onSaved: () => void;
|
|
770
|
+
onError: (m: string) => void;
|
|
771
|
+
}) {
|
|
772
|
+
const probe = useSavedKeyProbe(tool.slug);
|
|
773
|
+
return (
|
|
774
|
+
<ul className="mt-3 flex flex-col gap-2">
|
|
775
|
+
{tool.variables.map((v) => (
|
|
776
|
+
<KeyRow
|
|
777
|
+
key={v.key}
|
|
778
|
+
name={v.name}
|
|
779
|
+
label={v.label}
|
|
780
|
+
configured={v.configured}
|
|
781
|
+
ownerOnly={v.ownerOnly}
|
|
782
|
+
save={(value) =>
|
|
783
|
+
v.scope === 'admin' ? setAdminVar(tool.slug, v.name, value) : setUserVar(tool.slug, v.name, value)
|
|
784
|
+
}
|
|
785
|
+
probe={probe}
|
|
786
|
+
onSaved={onSaved}
|
|
787
|
+
onError={onError}
|
|
788
|
+
/>
|
|
789
|
+
))}
|
|
790
|
+
</ul>
|
|
791
|
+
);
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
/**
|
|
795
|
+
* The owner's half of a sign-in — the client secret — on the Connect page, so
|
|
796
|
+
* the person who CAN unblock everyone else does not have to go and find the
|
|
797
|
+
* tool page to do it. Its own probe, like every other place a credential is
|
|
798
|
+
* saved: a replaced client secret can invalidate the tokens minted under the
|
|
799
|
+
* old one, so the tool's health is worth testing straight away.
|
|
800
|
+
*/
|
|
801
|
+
function SignInOwnerSecret({
|
|
802
|
+
o,
|
|
803
|
+
onSaved,
|
|
804
|
+
onError,
|
|
805
|
+
}: {
|
|
806
|
+
o: ConnectToolOAuth;
|
|
807
|
+
onSaved: () => void;
|
|
808
|
+
onError: (m: string) => void;
|
|
809
|
+
}) {
|
|
810
|
+
const probe = useSavedKeyProbe(o.slug);
|
|
811
|
+
return (
|
|
812
|
+
<Surface tone="surface" radius="lg" elevation="none" padded className="border border-line">
|
|
813
|
+
<ConnectRowHead
|
|
814
|
+
slug={o.slug}
|
|
815
|
+
name={o.toolName}
|
|
816
|
+
label={o.label || o.toolName}
|
|
817
|
+
on
|
|
818
|
+
dim={false}
|
|
819
|
+
busy={false}
|
|
820
|
+
state="needs-key"
|
|
821
|
+
/>
|
|
822
|
+
<ul className="mt-3 flex flex-col gap-2">
|
|
823
|
+
<KeyRow
|
|
824
|
+
name={o.varName}
|
|
825
|
+
label={`${o.varName} (client secret)`}
|
|
826
|
+
configured={false}
|
|
827
|
+
ownerOnly={false}
|
|
828
|
+
save={(value) => setOAuthClientSecret(o.slug, o.varName, value)}
|
|
829
|
+
probe={probe}
|
|
830
|
+
onSaved={onSaved}
|
|
831
|
+
onError={onError}
|
|
832
|
+
/>
|
|
833
|
+
</ul>
|
|
834
|
+
</Surface>
|
|
835
|
+
);
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
/**
|
|
839
|
+
* One variable of a tool: the field that sets it, or — when it is a workspace
|
|
840
|
+
* value the reader may not write — the name of who has to.
|
|
841
|
+
*
|
|
842
|
+
* `save` rather than a slug plus a tier, because the three things a row can
|
|
843
|
+
* write (your own key, the workspace's, a sign-in's client secret) are three
|
|
844
|
+
* different calls and the row's job is the same in all three.
|
|
845
|
+
*/
|
|
544
846
|
function KeyRow({
|
|
545
|
-
slug,
|
|
546
847
|
name,
|
|
547
848
|
label,
|
|
548
849
|
configured,
|
|
850
|
+
ownerOnly,
|
|
851
|
+
save: persist,
|
|
852
|
+
probe,
|
|
549
853
|
onSaved,
|
|
550
854
|
onError,
|
|
551
855
|
}: {
|
|
552
|
-
slug: string;
|
|
553
856
|
name: string;
|
|
554
857
|
label: string | null;
|
|
555
858
|
configured: boolean;
|
|
859
|
+
/** A workspace value the reader cannot set: no field, just the reason. */
|
|
860
|
+
ownerOnly: boolean;
|
|
861
|
+
save: (value: string) => Promise<void>;
|
|
862
|
+
/** Shared with this tool's other rows; it answers for whichever saved last. */
|
|
863
|
+
probe: SavedKeyProbe;
|
|
556
864
|
onSaved: () => void;
|
|
557
865
|
onError: (m: string) => void;
|
|
558
866
|
}) {
|
|
@@ -563,43 +871,72 @@ function KeyRow({
|
|
|
563
871
|
if (!value.trim()) return;
|
|
564
872
|
setBusy(true);
|
|
565
873
|
try {
|
|
566
|
-
await
|
|
874
|
+
await persist(value.trim());
|
|
875
|
+
// The value is STORED before anything is probed, and the field is
|
|
876
|
+
// cleared before anything is probed. Nothing below can fail the save or
|
|
877
|
+
// hold it open — the probe is a question asked after the fact, and it is
|
|
878
|
+
// allowed to hang, fail, or not exist at all.
|
|
567
879
|
setValue('');
|
|
568
880
|
onSaved();
|
|
569
881
|
} catch (err) {
|
|
570
882
|
onError(err instanceof Error ? err.message : String(err));
|
|
883
|
+
return;
|
|
571
884
|
} finally {
|
|
572
885
|
setBusy(false);
|
|
573
886
|
}
|
|
887
|
+
// Outside the try, and deliberately not awaited: a save that landed is a
|
|
888
|
+
// save that landed, and a probe's trouble is never reported as the save's.
|
|
889
|
+
// Naming the variable moves the shared answer onto THIS row.
|
|
890
|
+
probe.probeSaved(name);
|
|
574
891
|
};
|
|
575
892
|
|
|
893
|
+
if (ownerOnly) {
|
|
894
|
+
return (
|
|
895
|
+
<li className="flex items-center gap-2.5">
|
|
896
|
+
<div className="flex min-w-0 flex-1 items-center gap-2">
|
|
897
|
+
<span className="truncate text-detail text-ink-faint">{label || name}</span>
|
|
898
|
+
<Badge tone="outline" size="xs" className="shrink-0">
|
|
899
|
+
{ownerReason(name)}
|
|
900
|
+
</Badge>
|
|
901
|
+
</div>
|
|
902
|
+
</li>
|
|
903
|
+
);
|
|
904
|
+
}
|
|
905
|
+
|
|
576
906
|
return (
|
|
577
|
-
<li className="flex
|
|
578
|
-
<div className="flex
|
|
579
|
-
<
|
|
580
|
-
|
|
581
|
-
{configured ? '
|
|
582
|
-
|
|
907
|
+
<li className="flex flex-col gap-1.5">
|
|
908
|
+
<div className="flex items-center gap-2.5">
|
|
909
|
+
<div className="flex min-w-0 flex-1 items-center gap-2">
|
|
910
|
+
<span className="truncate text-detail text-ink-muted">{label || name}</span>
|
|
911
|
+
<Badge tone={configured ? 'ok' : 'wait'} size="xs" className="shrink-0">
|
|
912
|
+
{configured ? 'Set' : 'Needs a key'}
|
|
913
|
+
</Badge>
|
|
914
|
+
</div>
|
|
915
|
+
{/* Write-only. The stored value is never fetched, rendered or logged —
|
|
916
|
+
the field starts empty even for a configured key, and saving replaces
|
|
917
|
+
rather than reveals. */}
|
|
918
|
+
<TextField
|
|
919
|
+
type="password"
|
|
920
|
+
value={value}
|
|
921
|
+
onChange={(e) => setValue(e.target.value)}
|
|
922
|
+
placeholder={configured ? 'Replace…' : 'Enter value'}
|
|
923
|
+
aria-label={`${label || name} value`}
|
|
924
|
+
className="w-44"
|
|
925
|
+
/>
|
|
926
|
+
<Button
|
|
927
|
+
variant="primary"
|
|
928
|
+
size="sm"
|
|
929
|
+
disabled={busy || !value.trim()}
|
|
930
|
+
onClick={() => void save()}
|
|
931
|
+
>
|
|
932
|
+
Save
|
|
933
|
+
</Button>
|
|
583
934
|
</div>
|
|
584
|
-
{/*
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
value={value}
|
|
590
|
-
onChange={(e) => setValue(e.target.value)}
|
|
591
|
-
placeholder={configured ? 'Replace…' : 'Enter value'}
|
|
592
|
-
aria-label={`${label || name} value`}
|
|
593
|
-
className="w-44"
|
|
594
|
-
/>
|
|
595
|
-
<Button
|
|
596
|
-
variant="primary"
|
|
597
|
-
size="sm"
|
|
598
|
-
disabled={busy || !value.trim()}
|
|
599
|
-
onClick={() => void save()}
|
|
600
|
-
>
|
|
601
|
-
Save
|
|
602
|
-
</Button>
|
|
935
|
+
{/* What the provider made of the key that was just typed here — the
|
|
936
|
+
whole reason this page no longer accepts a wrong key in silence.
|
|
937
|
+
Only on the row that asked: the answer is the tool's, and the newest
|
|
938
|
+
save is the only place it is still current. */}
|
|
939
|
+
{probe.subject === name && <SavedKeyProbeResult probe={probe} />}
|
|
603
940
|
</li>
|
|
604
941
|
);
|
|
605
942
|
}
|