@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
|
@@ -125,6 +125,42 @@ export async function getMcpServer(slug: string): Promise<McpServerView | null>
|
|
|
125
125
|
return (await res.json()) as McpServerView;
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
+
/**
|
|
129
|
+
* What deleting a tool would affect — the dialog's whole content.
|
|
130
|
+
*
|
|
131
|
+
* Owner-only on the backend, which is the same verdict the page gates the menu
|
|
132
|
+
* item on: a 403 here means the affordance should never have been offered, and
|
|
133
|
+
* the dialog says so rather than pretending the delete is still possible.
|
|
134
|
+
*/
|
|
135
|
+
export interface ToolDependents {
|
|
136
|
+
slug: string;
|
|
137
|
+
name: string;
|
|
138
|
+
/** `manual` — a `.tool` file; `server` — one entry in a plugin's mcp.json. */
|
|
139
|
+
source: 'manual' | 'server';
|
|
140
|
+
/** Where the page returns once the tool is gone. */
|
|
141
|
+
plugin: { name: string; displayName: string };
|
|
142
|
+
/** Skills whose `allowed-tools` name this tool — their files are NOT touched. */
|
|
143
|
+
skills: { name: string; path: string }[];
|
|
144
|
+
/** Other plugins that carry it. */
|
|
145
|
+
plugins: { name: string; displayName: string }[];
|
|
146
|
+
/** Counts only — never a value, never whose. */
|
|
147
|
+
storedKeys: number;
|
|
148
|
+
signIns: number;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export async function getToolDependents(slug: string): Promise<ToolDependents> {
|
|
152
|
+
const res = await authFetch(`/api/tools/${encodeURIComponent(slug)}/dependents`);
|
|
153
|
+
if (!res.ok) await unwrap(res, "Couldn't read what depends on this tool.");
|
|
154
|
+
return (await res.json()) as ToolDependents;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/** Delete the tool. Answers the plugin it lived in — where the page goes next. */
|
|
158
|
+
export async function deleteTool(slug: string): Promise<{ plugin: string }> {
|
|
159
|
+
const res = await authFetch(`/api/tools/${encodeURIComponent(slug)}`, { method: 'DELETE' });
|
|
160
|
+
if (!res.ok) await unwrap(res, "Couldn't delete the tool.");
|
|
161
|
+
return (await res.json()) as { plugin: string };
|
|
162
|
+
}
|
|
163
|
+
|
|
128
164
|
export async function putMcpServer(slug: string, write: McpServerWrite): Promise<{ name: string }> {
|
|
129
165
|
const res = await authFetch(`/api/tools/${encodeURIComponent(slug)}/server`, {
|
|
130
166
|
method: 'PUT',
|
|
@@ -134,3 +170,45 @@ export async function putMcpServer(slug: string, write: McpServerWrite): Promise
|
|
|
134
170
|
if (!res.ok) await unwrap(res, "Couldn't save the server configuration.");
|
|
135
171
|
return (await res.json()) as { name: string };
|
|
136
172
|
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* A tool that exists only on an open change request's branch — proposed, and
|
|
176
|
+
* waiting on somebody to approve it. The mirror of `PendingSkillSummary`, and
|
|
177
|
+
* separate from every catalog type for the same reason: it is not in the
|
|
178
|
+
* catalog, nothing registers it, nothing calls it, and it is visible only to
|
|
179
|
+
* its author and to whoever could approve it.
|
|
180
|
+
*/
|
|
181
|
+
export interface PendingToolSummary {
|
|
182
|
+
slug: string;
|
|
183
|
+
name: string;
|
|
184
|
+
/** The `.tool` file, or the plugin's `mcp.json` — what the card files under. */
|
|
185
|
+
path: string;
|
|
186
|
+
type: 'inline' | 'http' | 'mcp';
|
|
187
|
+
description?: string;
|
|
188
|
+
/** The plugin folder the declaration targets, or null when it targets none. */
|
|
189
|
+
plugin: string | null;
|
|
190
|
+
changeRequestNumber: number;
|
|
191
|
+
branch: string;
|
|
192
|
+
authorName: string;
|
|
193
|
+
createdAt: string;
|
|
194
|
+
/** True when the caller proposed it themselves. */
|
|
195
|
+
isAuthor: boolean;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Tools awaiting approval that the caller may see. The backend does the
|
|
200
|
+
* filtering — author or possible approver — so this is a plain read.
|
|
201
|
+
*/
|
|
202
|
+
export async function listPendingTools(): Promise<PendingToolSummary[]> {
|
|
203
|
+
const res = await authFetch('/api/tools/pending');
|
|
204
|
+
if (!res.ok) await unwrap(res, "Couldn't load proposed tools.");
|
|
205
|
+
const body = (await res.json()) as { tools?: PendingToolSummary[] } | null;
|
|
206
|
+
// Guarded, not trusted: a backend BUILT BEFORE this route existed answers
|
|
207
|
+
// through `/tools/:slug` — a 200 whose shape is not this one. The review
|
|
208
|
+
// shelf degrading to empty is the right failure; `undefined` reaching the
|
|
209
|
+
// item mapper takes the whole library down (blank page), which is exactly
|
|
210
|
+
// what it did on the skills side before its own guard. A bare `null` body is
|
|
211
|
+
// one of those shapes, and reading `.tools` off it would throw BEFORE the
|
|
212
|
+
// guard ran — so the optional chain is the guard's first half, not decoration.
|
|
213
|
+
return Array.isArray(body?.tools) ? body.tools : [];
|
|
214
|
+
}
|
|
@@ -1,25 +1,39 @@
|
|
|
1
|
+
import { subscribePrStale, TOOL_CREDENTIALS_STALE_EVENT } from '../../../core/events';
|
|
1
2
|
import { useCallback, useContext, useEffect, useMemo, useState, type ReactNode, } from 'react';
|
|
2
3
|
import { LibraryContext } from './library-context';
|
|
3
|
-
import {
|
|
4
|
+
import { SKILLS_DIR } from '@bevel-software/platform-shared';
|
|
5
|
+
import { pluginNameForPath, pluginsHoldingTool } from '../utils/plugin-summary';
|
|
6
|
+
import type { PluginMembership } from '../services/library.api';
|
|
4
7
|
|
|
5
8
|
/**
|
|
6
|
-
* The plugin a card files under —
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* The plugin a card files under, by IDENTITY — the server's own answer for a
|
|
10
|
+
* skill it decorated (the inline membership), else the folder resolved
|
|
11
|
+
* through the plugin summaries (see `pluginNameForPath`). Personal folders
|
|
12
|
+
* map to `null`, the "yours alone" bucket: a personal folder is a place, not
|
|
13
|
+
* a plugin, and the only personal items a caller can ever read are their own.
|
|
11
14
|
*/
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
function pluginOfItem(
|
|
16
|
+
path: string,
|
|
17
|
+
memberships: readonly { name: string; linked: boolean }[] | undefined,
|
|
18
|
+
summaries: readonly PluginSummary[],
|
|
19
|
+
): string | null {
|
|
20
|
+
return memberships?.find((m) => !m.linked)?.name ?? pluginNameForPath(path, summaries);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Under the shared `Skills/` root — owned by a scope, not by a person or a plugin folder. */
|
|
24
|
+
function isSharedPath(path: string): boolean {
|
|
25
|
+
return path === SKILLS_DIR || path.startsWith(`${SKILLS_DIR}/`);
|
|
15
26
|
}
|
|
16
27
|
import { useLibraryData, type LibraryData } from '../hooks/useLibraryData';
|
|
17
28
|
import { listPlugins, type PluginSummary } from '../services/plugins.api';
|
|
29
|
+
import { listTeams } from '../services/teams.api';
|
|
18
30
|
import {
|
|
31
|
+
isInPlugin,
|
|
19
32
|
neededToolsFor,
|
|
20
33
|
skillStatus,
|
|
21
34
|
toolStatus,
|
|
22
35
|
type AttentionStatus,
|
|
36
|
+
type TeamAccess,
|
|
23
37
|
} from '../utils/status';
|
|
24
38
|
|
|
25
39
|
/**
|
|
@@ -44,10 +58,27 @@ export interface LibraryItem {
|
|
|
44
58
|
id: string;
|
|
45
59
|
name: string;
|
|
46
60
|
description: string;
|
|
61
|
+
/**
|
|
62
|
+
* The caller is named in the item's `owner:` grant, directly or through a
|
|
63
|
+
* role — the Owner pill and "Owned by me". Write access is not ownership.
|
|
64
|
+
*/
|
|
47
65
|
owned: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* The caller may write the item — a skill's SKILL.md, a tool's `.tool`
|
|
68
|
+
* file. What the editor-side affordances go by, owner or not.
|
|
69
|
+
*/
|
|
70
|
+
canWrite: boolean;
|
|
48
71
|
status: AttentionStatus;
|
|
49
72
|
/** Folder plugin from the KB path, or null when the item is in none. */
|
|
50
73
|
plugin: string | null;
|
|
74
|
+
/** Under the shared `Skills/` root — see `LibraryFilterable.shared`. */
|
|
75
|
+
shared?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Every plugin holding the item, inline or linked. A skill's comes from the
|
|
78
|
+
* server, which keeps the link index; a TOOL's is derived here from where
|
|
79
|
+
* its file sits and which roots each plugin links (`pluginsHoldingTool`).
|
|
80
|
+
*/
|
|
81
|
+
plugins?: PluginMembership[];
|
|
51
82
|
/** Repo-root-relative path — the skill's folder, or the `.tool` file. */
|
|
52
83
|
path: string;
|
|
53
84
|
/**
|
|
@@ -57,12 +88,15 @@ export interface LibraryItem {
|
|
|
57
88
|
*/
|
|
58
89
|
version?: string;
|
|
59
90
|
/**
|
|
60
|
-
* Set only on
|
|
61
|
-
* request's branch and is waiting on somebody to approve it.
|
|
91
|
+
* Set only on an item that does not exist yet — it lives on an open change
|
|
92
|
+
* request's branch and is waiting on somebody to approve it. A skill's
|
|
93
|
+
* `SKILL.md`, a tool's `.tool` manual or `mcp.json` server: the same flag,
|
|
94
|
+
* because the reader's question ("can I use this yet?") and the card's
|
|
95
|
+
* answer are the same for both.
|
|
62
96
|
*
|
|
63
97
|
* Deliberately NOT folded into `status`: `AttentionStatus` answers "is
|
|
64
98
|
* anything standing in this item's way?", which drives the setup filter and
|
|
65
|
-
* the amber counts, and
|
|
99
|
+
* the amber counts, and an item under review is not a broken one. Callers
|
|
66
100
|
* that must treat a proposal differently — the card, the click — read this.
|
|
67
101
|
*/
|
|
68
102
|
pending?: {
|
|
@@ -80,15 +114,32 @@ export interface LibraryContextValue extends LibraryData {
|
|
|
80
114
|
pluginSummaries: PluginSummary[];
|
|
81
115
|
pluginsLoading: boolean;
|
|
82
116
|
pluginsError: string | null;
|
|
117
|
+
/**
|
|
118
|
+
* What each team can use (`GET /api/teams`), `[]` until loaded and on
|
|
119
|
+
* error. Loaded and reloaded WITH the plugin summaries: both are answers
|
|
120
|
+
* from the access rules, and an edit that changes one changes the other.
|
|
121
|
+
*/
|
|
122
|
+
teams: TeamAccess[];
|
|
123
|
+
teamsLoading: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Why `teams` is empty when it is: the request failed. Kept apart from
|
|
126
|
+
* "no teams" so a team page can tell "this team is not there" from "we
|
|
127
|
+
* could not ask" — the second is not the first.
|
|
128
|
+
*/
|
|
129
|
+
teamsError: string | null;
|
|
83
130
|
reloadPlugins(): void;
|
|
84
131
|
}
|
|
85
132
|
|
|
86
133
|
|
|
87
134
|
export function LibraryProvider({ children }: { children: ReactNode }) {
|
|
88
135
|
const data = useLibraryData();
|
|
136
|
+
const { reload } = data;
|
|
89
137
|
const [pluginSummaries, setPluginSummaries] = useState<PluginSummary[]>([]);
|
|
90
138
|
const [pluginsLoading, setPluginsLoading] = useState(true);
|
|
91
139
|
const [pluginsError, setPluginsError] = useState<string | null>(null);
|
|
140
|
+
const [teams, setTeams] = useState<TeamAccess[]>([]);
|
|
141
|
+
const [teamsLoading, setTeamsLoading] = useState(true);
|
|
142
|
+
const [teamsError, setTeamsError] = useState<string | null>(null);
|
|
92
143
|
const [pluginsRevision, setPluginsRevision] = useState(0);
|
|
93
144
|
|
|
94
145
|
useEffect(() => {
|
|
@@ -113,6 +164,34 @@ export function LibraryProvider({ children }: { children: ReactNode }) {
|
|
|
113
164
|
};
|
|
114
165
|
}, [pluginsRevision]);
|
|
115
166
|
|
|
167
|
+
useEffect(() => {
|
|
168
|
+
let cancelled = false;
|
|
169
|
+
// The team lens degrades to "no teams" rather than failing the Library:
|
|
170
|
+
// the sidebar simply has no team rows, and Everything is untouched.
|
|
171
|
+
// (`teamsLoading` is raised by `reloadPlugins`, as `pluginsLoading` is —
|
|
172
|
+
// the first load starts raised, and the effect body stays free of a
|
|
173
|
+
// synchronous setState.)
|
|
174
|
+
listTeams()
|
|
175
|
+
.then((next) => {
|
|
176
|
+
if (cancelled) return;
|
|
177
|
+
setTeams(next);
|
|
178
|
+
setTeamsError(null);
|
|
179
|
+
})
|
|
180
|
+
.catch((err: unknown) => {
|
|
181
|
+
if (cancelled) return;
|
|
182
|
+
setTeams([]);
|
|
183
|
+
// A blank message is no message: the page tells the error state
|
|
184
|
+
// apart from "no teams" by this being non-empty.
|
|
185
|
+
setTeamsError((err instanceof Error && err.message) || "Couldn't load teams.");
|
|
186
|
+
})
|
|
187
|
+
.finally(() => {
|
|
188
|
+
if (!cancelled) setTeamsLoading(false);
|
|
189
|
+
});
|
|
190
|
+
return () => {
|
|
191
|
+
cancelled = true;
|
|
192
|
+
};
|
|
193
|
+
}, [pluginsRevision]);
|
|
194
|
+
|
|
116
195
|
const items: LibraryItem[] = useMemo(() => {
|
|
117
196
|
const skillItems: LibraryItem[] = data.skills.map((s) => ({
|
|
118
197
|
kind: 'skill',
|
|
@@ -120,7 +199,10 @@ export function LibraryProvider({ children }: { children: ReactNode }) {
|
|
|
120
199
|
name: s.name,
|
|
121
200
|
description: s.description,
|
|
122
201
|
owned: data.ownedSkills.has(s.name),
|
|
123
|
-
|
|
202
|
+
canWrite: data.writableSkills.has(s.name),
|
|
203
|
+
plugin: pluginOfItem(s.path, s.plugins, pluginSummaries),
|
|
204
|
+
shared: isSharedPath(s.path),
|
|
205
|
+
plugins: s.plugins ?? [],
|
|
124
206
|
path: s.path,
|
|
125
207
|
version: s.version,
|
|
126
208
|
status: skillStatus(
|
|
@@ -144,7 +226,9 @@ export function LibraryProvider({ children }: { children: ReactNode }) {
|
|
|
144
226
|
name: s.name,
|
|
145
227
|
description: s.description,
|
|
146
228
|
owned: false,
|
|
147
|
-
|
|
229
|
+
canWrite: false,
|
|
230
|
+
plugin: pluginOfItem(s.path, undefined, pluginSummaries),
|
|
231
|
+
shared: isSharedPath(s.path),
|
|
148
232
|
path: s.path,
|
|
149
233
|
version: s.version,
|
|
150
234
|
status: { state: 'ok', text: 'In review' },
|
|
@@ -155,25 +239,81 @@ export function LibraryProvider({ children }: { children: ReactNode }) {
|
|
|
155
239
|
mine: s.isAuthor,
|
|
156
240
|
},
|
|
157
241
|
}));
|
|
158
|
-
const toolItems: LibraryItem[] = data.tools.map((t) =>
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
//
|
|
163
|
-
//
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
242
|
+
const toolItems: LibraryItem[] = data.tools.map((t) => {
|
|
243
|
+
// A tool's memberships are DERIVED, not served — the tool surface knows
|
|
244
|
+
// where the file is, the summaries know which roots each plugin links,
|
|
245
|
+
// and `pluginsHoldingTool` is the one place those two meet. With them a
|
|
246
|
+
// tool under a linked root is on the plugin's page, pill and all, the
|
|
247
|
+
// way a linked skill is.
|
|
248
|
+
const plugins = pluginsHoldingTool(t.path, pluginSummaries);
|
|
249
|
+
return {
|
|
250
|
+
kind: 'integration',
|
|
251
|
+
id: t.slug,
|
|
252
|
+
name: t.name,
|
|
253
|
+
// The browser tool surface exposes no human description for a `.tool`
|
|
254
|
+
// manual yet (see report) — the card stays clean; detail lives behind it.
|
|
255
|
+
description: '',
|
|
256
|
+
owned: data.ownedTools.has(t.slug),
|
|
257
|
+
canWrite: t.canWrite,
|
|
258
|
+
plugin: pluginOfItem(t.path, plugins, pluginSummaries),
|
|
259
|
+
plugins,
|
|
260
|
+
path: t.path,
|
|
261
|
+
status: toolStatus(t),
|
|
262
|
+
};
|
|
263
|
+
});
|
|
264
|
+
/**
|
|
265
|
+
* Proposed tools, beside the released ones exactly as proposed skills sit
|
|
266
|
+
* beside released skills — and for the very same bug: a tool an agent
|
|
267
|
+
* proposed was nowhere in the library at all until somebody merged it, so
|
|
268
|
+
* the person who asked for it had no way to see that it was on its way.
|
|
269
|
+
*
|
|
270
|
+
* `owned`/`canWrite` are false and stay false: there is no file on the
|
|
271
|
+
* default branch to own or to edit, and every affordance that reads them
|
|
272
|
+
* would address a path that is not there. Membership is derived from the
|
|
273
|
+
* declaration's own path — where the file will land — by the same
|
|
274
|
+
* `pluginsHoldingTool` the released tools use, so a proposal into a root a
|
|
275
|
+
* plugin LINKS is on that plugin's page the way its released neighbours
|
|
276
|
+
* are. Without it a linked-root proposal would belong to no plugin here and
|
|
277
|
+
* simply never appear.
|
|
278
|
+
*/
|
|
279
|
+
const pendingToolItems: LibraryItem[] = data.pendingTools.map((t) => {
|
|
280
|
+
const plugins = pluginsHoldingTool(t.path, pluginSummaries);
|
|
281
|
+
return {
|
|
282
|
+
kind: 'integration',
|
|
283
|
+
id: t.slug,
|
|
284
|
+
name: t.name,
|
|
285
|
+
// The released tool cards carry no description either — detail lives
|
|
286
|
+
// behind the card — and a proposal has even less standing to differ.
|
|
287
|
+
description: '',
|
|
288
|
+
owned: false,
|
|
289
|
+
canWrite: false,
|
|
290
|
+
plugin: pluginOfItem(t.path, plugins, pluginSummaries),
|
|
291
|
+
plugins,
|
|
292
|
+
path: t.path,
|
|
293
|
+
// The neutral `ok`, as for a proposed skill: a proposal has no
|
|
294
|
+
// credential resolved against it, and reporting `warn` would put it in
|
|
295
|
+
// the setup filter and the plugin's amber count as though an integration
|
|
296
|
+
// somebody has to configure had appeared.
|
|
297
|
+
status: { state: 'ok', text: 'In review' },
|
|
298
|
+
pending: {
|
|
299
|
+
changeRequestNumber: t.changeRequestNumber,
|
|
300
|
+
branch: t.branch,
|
|
301
|
+
authorName: t.authorName,
|
|
302
|
+
mine: t.isAuthor,
|
|
303
|
+
},
|
|
304
|
+
};
|
|
305
|
+
});
|
|
306
|
+
return [...skillItems, ...pendingItems, ...toolItems, ...pendingToolItems];
|
|
171
307
|
}, [
|
|
172
308
|
data.skills,
|
|
173
309
|
data.pendingSkills,
|
|
174
310
|
data.tools,
|
|
311
|
+
data.pendingTools,
|
|
175
312
|
data.ownedSkills,
|
|
313
|
+
data.writableSkills,
|
|
314
|
+
data.ownedTools,
|
|
176
315
|
data.allowedToolsBySkill,
|
|
316
|
+
pluginSummaries,
|
|
177
317
|
]);
|
|
178
318
|
|
|
179
319
|
// The loading flag is raised HERE rather than in the effect: `useState(true)`
|
|
@@ -182,19 +322,54 @@ export function LibraryProvider({ children }: { children: ReactNode }) {
|
|
|
182
322
|
// costs a cascading render on every revision).
|
|
183
323
|
const reloadPlugins = useCallback(() => {
|
|
184
324
|
setPluginsLoading(true);
|
|
325
|
+
setTeamsLoading(true);
|
|
185
326
|
setPluginsRevision((r) => r + 1);
|
|
186
327
|
}, []);
|
|
187
328
|
|
|
329
|
+
// ONE reload for the whole Library. The plugin summaries carry counts and
|
|
330
|
+
// verdicts derived from the same knowledge base as the catalog — how many
|
|
331
|
+
// skills a plugin holds, how many of its links are broken, who may read
|
|
332
|
+
// it — so a page that refreshes the catalog after a link, a repair or an
|
|
333
|
+
// access edit must refresh the summaries too, or the sidebar count and the
|
|
334
|
+
// plugin page's banner keep the number from before the change.
|
|
335
|
+
const reloadAll = useCallback(() => {
|
|
336
|
+
reload();
|
|
337
|
+
reloadPlugins();
|
|
338
|
+
}, [reload, reloadPlugins]);
|
|
339
|
+
|
|
340
|
+
// The catalog carries its own view of open change requests (proposals,
|
|
341
|
+
// review boxes). The shell's change-request provider refreshes on this
|
|
342
|
+
// event; so does the whole Library, or the two would disagree after a
|
|
343
|
+
// proposal lands or is resolved — and a merged change can move plugin
|
|
344
|
+
// links and access, so the summaries refresh with the catalog here too.
|
|
345
|
+
useEffect(() => subscribePrStale(reloadAll), [reloadAll]);
|
|
346
|
+
|
|
347
|
+
// A credential landing anywhere in the app is a catalog change here: every
|
|
348
|
+
// "needs setup" in the Library — the cards, the plugin page's banner, the
|
|
349
|
+
// sidebar count — is derived from the tool rows this catalog carries, and
|
|
350
|
+
// they were loaded before the save. The tool page re-probes itself, which is
|
|
351
|
+
// why the bug only ever showed up one click LATER: on the page the reader
|
|
352
|
+
// went back to.
|
|
353
|
+
useEffect(() => {
|
|
354
|
+
const onCredentials = () => reloadAll();
|
|
355
|
+
window.addEventListener(TOOL_CREDENTIALS_STALE_EVENT, onCredentials);
|
|
356
|
+
return () => window.removeEventListener(TOOL_CREDENTIALS_STALE_EVENT, onCredentials);
|
|
357
|
+
}, [reloadAll]);
|
|
358
|
+
|
|
188
359
|
const value = useMemo(
|
|
189
360
|
(): LibraryContextValue => ({
|
|
190
361
|
...data,
|
|
362
|
+
reload: reloadAll,
|
|
191
363
|
items,
|
|
192
364
|
pluginSummaries,
|
|
193
365
|
pluginsLoading,
|
|
194
366
|
pluginsError,
|
|
367
|
+
teams,
|
|
368
|
+
teamsLoading,
|
|
369
|
+
teamsError,
|
|
195
370
|
reloadPlugins,
|
|
196
371
|
}),
|
|
197
|
-
[data, items, pluginSummaries, pluginsLoading, pluginsError, reloadPlugins],
|
|
372
|
+
[data, reloadAll, items, pluginSummaries, pluginsLoading, pluginsError, teams, teamsLoading, teamsError, reloadPlugins],
|
|
198
373
|
);
|
|
199
374
|
|
|
200
375
|
return <LibraryContext.Provider value={value}>{children}</LibraryContext.Provider>;
|
|
@@ -228,17 +403,73 @@ export function workspaceHasNoPlugins(lib: LibraryContextValue): boolean {
|
|
|
228
403
|
}
|
|
229
404
|
|
|
230
405
|
/**
|
|
231
|
-
* How
|
|
232
|
-
*
|
|
233
|
-
* can never disagree.
|
|
406
|
+
* How much of a plugin needs a person — the count on the sidebar row, the
|
|
407
|
+
* index badge and the plugin page's banners, computed from one place so they
|
|
408
|
+
* can never disagree. Two kinds, added together:
|
|
409
|
+
*
|
|
410
|
+
* - integrations that need setup (`brokenLinksOf` subtracted from this
|
|
411
|
+
* gives that number alone);
|
|
412
|
+
* - linked skills the plugin's members cannot read (`brokenLinksOf`).
|
|
413
|
+
*
|
|
414
|
+
* A skill that reports `warn` about a tool is NOT counted: it is warning
|
|
415
|
+
* about the very integration already counted here, so counting both would
|
|
416
|
+
* double every broken connection. Pending change requests are a review
|
|
417
|
+
* concern, not a setup one, and belong to a different surface.
|
|
418
|
+
*/
|
|
419
|
+
export interface PluginAttention {
|
|
420
|
+
/** Everything that needs a person: integrations to set up, broken links, and what the definition left out. */
|
|
421
|
+
total: number;
|
|
422
|
+
/** The broken-link part alone — what turns the count orange. */
|
|
423
|
+
brokenLinks: number;
|
|
424
|
+
/** What the platform could not keep of the plugin's definition — a server, a skill root — as the server reports it. */
|
|
425
|
+
warnings: number;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
export function attentionOf(
|
|
429
|
+
items: readonly LibraryItem[],
|
|
430
|
+
plugin: string,
|
|
431
|
+
summaries: readonly Pick<PluginSummary, 'name' | 'brokenLinks' | 'warnings'>[] = [],
|
|
432
|
+
): PluginAttention {
|
|
433
|
+
// One pass for the links, returned beside the total: every caller wants
|
|
434
|
+
// both, and computing the part again for the tone would filter the whole
|
|
435
|
+
// catalog a second time per plugin.
|
|
436
|
+
const brokenLinks = brokenLinksOf(items, plugin, summaries);
|
|
437
|
+
// `!i.pending` is said out loud rather than left to the neutral `ok` a
|
|
438
|
+
// proposal carries: this count drives the sidebar badge and the setup
|
|
439
|
+
// filter, and "somebody has to configure this integration" is never true of
|
|
440
|
+
// a tool that does not exist yet. A future status change on the proposal
|
|
441
|
+
// side must not be able to leak into the amber count by accident.
|
|
442
|
+
const integrations = items.filter(
|
|
443
|
+
(i) => isInPlugin(i, plugin) && i.kind === 'integration' && !i.pending && i.status.state !== 'ok',
|
|
444
|
+
).length;
|
|
445
|
+
// Amber, like an integration to set up: it needs a person who can edit
|
|
446
|
+
// the plugin's files, and blocks nobody but the users of what is missing.
|
|
447
|
+
const warnings = summaries.find((s) => s.name === plugin)?.warnings?.length ?? 0;
|
|
448
|
+
return { total: integrations + brokenLinks + warnings, brokenLinks, warnings };
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* How many of `plugin`'s LINKED skills its members cannot read: the link is
|
|
453
|
+
* in the manifest but the skill folder no longer grants the plugin's readers.
|
|
454
|
+
* Counted apart from the integrations because it is a different kind of
|
|
455
|
+
* problem — a tool that needs setup blocks the reader's own use; a link
|
|
456
|
+
* without its grant blocks every member of the plugin, right now — and the
|
|
457
|
+
* sidebar and the plugin page rank it above amber for that reason.
|
|
234
458
|
*
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
*
|
|
459
|
+
* The SERVER's count wins when the summary carries one: it comes from the
|
|
460
|
+
* unfiltered link index, so a manager whom the missing grant locks out of
|
|
461
|
+
* the skill still sees it. The caller's own catalog is only the fallback for
|
|
462
|
+
* an older server — it cannot list a skill the caller may not read, which is
|
|
463
|
+
* exactly the skill this is about.
|
|
239
464
|
*/
|
|
240
|
-
export function
|
|
465
|
+
export function brokenLinksOf(
|
|
466
|
+
items: readonly LibraryItem[],
|
|
467
|
+
plugin: string,
|
|
468
|
+
summaries: readonly Pick<PluginSummary, 'name' | 'brokenLinks'>[] = [],
|
|
469
|
+
): number {
|
|
470
|
+
const served = summaries.find((s) => s.name === plugin)?.brokenLinks;
|
|
471
|
+
if (served !== undefined) return served;
|
|
241
472
|
return items.filter(
|
|
242
|
-
(i) => i.
|
|
473
|
+
(i) => i.kind === 'skill' && (i.plugins ?? []).some((m) => m.name === plugin && m.linked && m.granted === false),
|
|
243
474
|
).length;
|
|
244
475
|
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The name of a person's own space — the prototype's `MINE()
|
|
3
|
-
*
|
|
2
|
+
* The name of a person's own space — the prototype's `MINE()`, which named
|
|
3
|
+
* it after the person (`Juan's List`).
|
|
4
4
|
*
|
|
5
5
|
* It is called a PLUGIN here rather than a list because that is what it now is:
|
|
6
6
|
* the same page, the same sections, the same card grid as `Plugins/Engineering`.
|
|
7
7
|
* The only difference is which items it holds, and that is a query, not a kind.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* One name for everyone, deliberately: the page is always the reader's own,
|
|
10
|
+
* so the reader's name on it adds nothing — and a sign-in record's spelling
|
|
11
|
+
* of a name is not a style guide. (`displayFirstName` still greets people
|
|
12
|
+
* on the welcome page.)
|
|
11
13
|
*/
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
if (!first) return 'Yours';
|
|
17
|
-
return `${first}'s Plugin`;
|
|
14
|
+
export const PERSONAL_PLUGIN_NAME = 'Personal plugin';
|
|
15
|
+
|
|
16
|
+
export function personalPluginName(): string {
|
|
17
|
+
return PERSONAL_PLUGIN_NAME;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
/**
|
|
@@ -22,12 +22,10 @@ export function personalPluginName(displayName: string | null | undefined): stri
|
|
|
22
22
|
*
|
|
23
23
|
* Sign-in records are not a style guide — an account created from a lowercase
|
|
24
24
|
* email or a hastily typed name should still be greeted the way a person
|
|
25
|
-
* writes their own name. The capital belongs HERE rather than at
|
|
26
|
-
* site, so
|
|
27
|
-
* to spell the same person.
|
|
25
|
+
* writes their own name. The capital belongs HERE rather than at the call
|
|
26
|
+
* site, so every greeting spells the same person the same way.
|
|
28
27
|
*
|
|
29
|
-
* Empty when there is no name to work with
|
|
30
|
-
* fallback: the plugin heading says "Yours", the welcome page says "there".
|
|
28
|
+
* Empty when there is no name to work with; the welcome page then says "there".
|
|
31
29
|
*/
|
|
32
30
|
export function displayFirstName(displayName: string | null | undefined): string {
|
|
33
31
|
const first = (displayName ?? '').trim().split(/\s+/)[0] ?? '';
|