@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,8 +1,7 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { useState, type MouseEvent, type ReactNode } from 'react';
|
|
2
2
|
import { cn } from '../../../lib/utils';
|
|
3
|
+
import { SIDEBAR_ROW_INSET } from '../../layout/components/SidebarFrame';
|
|
3
4
|
import type { LibraryFilter } from '../utils/status';
|
|
4
|
-
import { ChalkArrow } from './plugin-page-parts';
|
|
5
|
-
import { LockGlyph } from './LockGlyph';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* Where a right-click landed in the nav, and everything the layout needs to
|
|
@@ -22,133 +21,130 @@ export interface SidebarContextTarget {
|
|
|
22
21
|
row: HTMLElement | null;
|
|
23
22
|
}
|
|
24
23
|
|
|
24
|
+
/**
|
|
25
|
+
* The two views of what sits below the lenses: by TEAM (who can use what),
|
|
26
|
+
* or the ADVANCED view — the two roots as they are on disk.
|
|
27
|
+
*/
|
|
28
|
+
export type SidebarView = 'teams' | 'advanced';
|
|
29
|
+
|
|
25
30
|
export interface PluginsSidebarProps {
|
|
26
31
|
/** What the URL has selected, or null on a page with no gallery filter. */
|
|
27
32
|
filter: LibraryFilter | null;
|
|
28
33
|
/** A row was clicked — the layout navigates; the sidebar owns no state. */
|
|
29
34
|
onSelect(filter: LibraryFilter): void;
|
|
30
|
-
/** Readable plugins, with their item count and how many integrations need setup. `label` is what the row shows; `plugin` is the identity it navigates by. */
|
|
31
|
-
plugins: {
|
|
32
|
-
plugin: string;
|
|
33
|
-
label?: string;
|
|
34
|
-
count: number;
|
|
35
|
-
attention: number;
|
|
36
|
-
/**
|
|
37
|
-
* Some of the attention is a linked skill the plugin's members cannot
|
|
38
|
-
* read. That outranks a tool the reader has not set up for themselves —
|
|
39
|
-
* it blocks other people — so the count turns orange, not amber.
|
|
40
|
-
*/
|
|
41
|
-
urgent?: boolean;
|
|
42
|
-
}[];
|
|
43
|
-
/**
|
|
44
|
-
* Plugins the caller cannot read, alphabetical. Rendered after a gap, with a
|
|
45
|
-
* lock instead of a count. A bare string is a plugin whose label is its name.
|
|
46
|
-
*/
|
|
47
|
-
lockedPlugins: (string | { name: string; label: string })[];
|
|
48
35
|
ownedCount: number;
|
|
49
36
|
/**
|
|
50
37
|
* How many of the caller's OWN items are waiting on them. Drives the amber
|
|
51
38
|
* badge; when zero the row shows `ownedCount` in grey instead.
|
|
52
39
|
*/
|
|
53
40
|
ownedAttention: number;
|
|
54
|
-
/**
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
41
|
+
/**
|
|
42
|
+
* The teams — groups from the access rules, led by the org-wide `Everyone`
|
|
43
|
+
* entry the server puts first — each with how much of the
|
|
44
|
+
* catalog it can use, and how many of its plugins' links lock its members
|
|
45
|
+
* out of a skill right now. Orange wins the count slot: it is other
|
|
46
|
+
* people's problem, and the count is not the news.
|
|
47
|
+
*/
|
|
48
|
+
teams: { name: string; count: number; urgent: number }[];
|
|
61
49
|
/** Start a new plugin. The layout owns the dialog; this is only the intent. */
|
|
62
50
|
onCreatePlugin(): void;
|
|
63
51
|
/**
|
|
64
|
-
* Whether to spell the first plugin out in words,
|
|
65
|
-
* hover-revealed `+` is unchanged for everyone; this is only the
|
|
66
|
-
* mark, and it is an administrator's — see the
|
|
52
|
+
* Whether to spell the first plugin out in words, as a row above the trees.
|
|
53
|
+
* The hover-revealed `+` is unchanged for everyone; this is only the
|
|
54
|
+
* teaching mark, and it is an administrator's — see the row itself below.
|
|
67
55
|
*
|
|
68
56
|
* The caller passes a SETTLED verdict, not just a role: the layout derives
|
|
69
57
|
* it from `workspaceHasNoPlugins`, which stays false while plugin discovery
|
|
70
58
|
* is loading or has failed. Without that, an admin whose plugins were still
|
|
71
59
|
* arriving would briefly read "Create a plugin" over a workspace that has
|
|
72
|
-
* twenty.
|
|
73
|
-
* row may appear), while WHETHER it may appear is the caller's call.
|
|
60
|
+
* twenty.
|
|
74
61
|
*
|
|
75
|
-
* Optional, defaulting to OFF
|
|
76
|
-
* optional on the admin context: this props type is public, and a host
|
|
62
|
+
* Optional, defaulting to OFF: this props type is public, and a host
|
|
77
63
|
* application rendering the nav must stay source-compatible across the
|
|
78
|
-
* upgrade. Omitting it reproduces the nav
|
|
79
|
-
* no written-out CTA at all.
|
|
64
|
+
* upgrade. Omitting it reproduces the nav with no written-out CTA at all.
|
|
80
65
|
*/
|
|
81
66
|
canCreatePlugin?: boolean;
|
|
82
|
-
/**
|
|
83
|
-
* The all-plugins index is showing. Beside `filter` rather than inside it: the
|
|
84
|
-
* index lists PLACES, not a filtered slice of the catalog, so it is not a
|
|
85
|
-
* `LibraryFilter` and pretending otherwise would put a row in the gallery's
|
|
86
|
-
* vocabulary that no gallery can render.
|
|
87
|
-
*/
|
|
88
|
-
pluginsIndexActive: boolean;
|
|
89
|
-
/** Go to the index — the Library's home. */
|
|
90
|
-
onOpenPluginsIndex(): void;
|
|
91
67
|
/**
|
|
92
68
|
* A row — or the nav's empty space — was right-clicked. Like every other
|
|
93
|
-
* handler here this is an INTENT, not a menu: the layout owns the popup
|
|
94
|
-
* because the verbs in it (add to this plugin, manage its access) need the
|
|
95
|
-
* plugin summaries and the workspace, and the sidebar knows neither.
|
|
69
|
+
* handler here this is an INTENT, not a menu: the layout owns the popup.
|
|
96
70
|
*
|
|
97
71
|
* Omitted, the nav does nothing on right-click and the browser's own menu
|
|
98
72
|
* appears — which is the honest default for a view with no actions wired.
|
|
99
73
|
*/
|
|
100
74
|
onContextMenu?(target: SidebarContextTarget): void;
|
|
101
75
|
/**
|
|
102
|
-
* The
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
* source-compatible.
|
|
76
|
+
* The two roots as file trees, in the Advanced view — the shared `Skills/`
|
|
77
|
+
* root and the `Plugins/` root, exactly as they are on disk. SLOTS rather
|
|
78
|
+
* than components this nav names: each tree reads the workspace and
|
|
79
|
+
* navigates on its own, and the sidebar stays what it is, a pure view of
|
|
80
|
+
* names and counts. Omitted, the view has no trees, which keeps a host
|
|
81
|
+
* rendering the shipped nav source-compatible.
|
|
109
82
|
*/
|
|
110
83
|
skillsTree?: ReactNode;
|
|
84
|
+
pluginsTree?: ReactNode;
|
|
111
85
|
}
|
|
112
86
|
|
|
113
87
|
/**
|
|
114
88
|
* The library's nav spine — the prototype's `.side` + `.nav` (lines 55-95).
|
|
115
89
|
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
90
|
+
* The two LENSES on the whole catalog first — Everything (the Library's
|
|
91
|
+
* home) and Owned by me — then ONE switch between the two views of what is
|
|
92
|
+
* below them:
|
|
93
|
+
*
|
|
94
|
+
* - TEAMS (shown as "Groups") — Everyone first, the org-wide entry the
|
|
95
|
+
* server leads with, then every group from the access rules: a team's
|
|
96
|
+
* page is what being in that group lets a person use. The caller's own
|
|
97
|
+
* space is a plugin, not a group, and has no row here;
|
|
98
|
+
* - ADVANCED — `Skills/` and `Plugins/` as they are on disk.
|
|
121
99
|
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
100
|
+
* Plugins have no rows of their own here. They are reached through the
|
|
101
|
+
* pages that list them — Everything, a team — and through their folders in
|
|
102
|
+
* the Plugins tree; a nav that listed every plugin beside every team said
|
|
103
|
+
* the same thing twice and grew with the workspace.
|
|
104
|
+
*
|
|
105
|
+
* The switch is the one piece of state the nav holds, and it is VIEW state,
|
|
106
|
+
* not selection: which rows are on screen, not which one is current. The
|
|
107
|
+
* URL still owns selection, so the back button, a deep link and the
|
|
108
|
+
* highlighted row can never drift apart — whichever view is showing. The
|
|
109
|
+
* choice is remembered in the browser so a reload lands on the view the
|
|
110
|
+
* person left; the Teams view is the default.
|
|
125
111
|
*
|
|
126
112
|
* This is the CONTENTS only. Being a sidebar — the width, the background, the
|
|
127
113
|
* collapse animation, the drag handle — belongs to `SidebarFrame`, which
|
|
128
114
|
* Knowledge's file tree renders inside too. That is the whole reason the two
|
|
129
115
|
* navs cannot drift: there is one of them, holding a different list.
|
|
116
|
+
*
|
|
117
|
+
* The bottom of the sidebar is not this component's either. The setup
|
|
118
|
+
* reminder that used to close it — "2 integrations need setup. Finish now" —
|
|
119
|
+
* is a FOOTER ROW now (`IntegrationsSetupReminder`), which the layout passes
|
|
120
|
+
* into the frame's `footer` slot beside the change-request dock. A nav that
|
|
121
|
+
* also placed the last row in the column was the reason those two rows
|
|
122
|
+
* disagreed about where the left edge is.
|
|
130
123
|
*/
|
|
131
124
|
export function PluginsSidebar({
|
|
132
125
|
filter,
|
|
133
126
|
onSelect,
|
|
134
|
-
plugins,
|
|
135
|
-
lockedPlugins,
|
|
136
127
|
ownedCount,
|
|
137
128
|
ownedAttention,
|
|
138
|
-
|
|
139
|
-
ungroupedCount,
|
|
140
|
-
attentionCount,
|
|
141
|
-
onFinishSetup,
|
|
129
|
+
teams,
|
|
142
130
|
onCreatePlugin,
|
|
143
131
|
canCreatePlugin = false,
|
|
144
|
-
pluginsIndexActive,
|
|
145
|
-
onOpenPluginsIndex,
|
|
146
132
|
onContextMenu,
|
|
147
133
|
skillsTree,
|
|
134
|
+
pluginsTree,
|
|
148
135
|
}: PluginsSidebarProps) {
|
|
136
|
+
const [view, setView] = useState<SidebarView>(readStoredView);
|
|
137
|
+
const switchView = (next: SidebarView) => {
|
|
138
|
+
setView(next);
|
|
139
|
+
storeView(next);
|
|
140
|
+
};
|
|
141
|
+
|
|
149
142
|
const rowClass = (selected: boolean) =>
|
|
150
143
|
cn(
|
|
151
|
-
'flex items-center justify-between gap-2 rounded-sm
|
|
144
|
+
'flex items-center justify-between gap-2 rounded-sm py-1.5 text-ui transition-colors',
|
|
145
|
+
// The sidebar's row grid, from the frame that owns it — the same inset
|
|
146
|
+
// the footer rows below the tree take.
|
|
147
|
+
SIDEBAR_ROW_INSET,
|
|
152
148
|
selected ? 'bg-hover font-semibold text-ink' : 'text-ink-muted hover:bg-hover hover:text-ink',
|
|
153
149
|
);
|
|
154
150
|
|
|
@@ -157,10 +153,17 @@ export function PluginsSidebar({
|
|
|
157
153
|
* row's OWN target rather than restated at each call site, so a row cannot
|
|
158
154
|
* light up for a filter it does not navigate to.
|
|
159
155
|
*/
|
|
160
|
-
const isCurrent = (target: LibraryFilter) =>
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
:
|
|
156
|
+
const isCurrent = (target: LibraryFilter) => {
|
|
157
|
+
if (!filter) return false;
|
|
158
|
+
switch (target.kind) {
|
|
159
|
+
case 'team':
|
|
160
|
+
return filter.kind === 'team' && filter.group === target.group;
|
|
161
|
+
case 'group':
|
|
162
|
+
return filter.kind === 'group' && filter.plugin === target.plugin;
|
|
163
|
+
default:
|
|
164
|
+
return filter.kind === target.kind;
|
|
165
|
+
}
|
|
166
|
+
};
|
|
164
167
|
|
|
165
168
|
/**
|
|
166
169
|
* Report a right-click upward. `preventDefault` only when somebody is
|
|
@@ -187,9 +190,8 @@ export function PluginsSidebar({
|
|
|
187
190
|
tone: 'count' | 'pending' | 'urgent' = 'count',
|
|
188
191
|
) => (
|
|
189
192
|
<button
|
|
190
|
-
// Keyed by what the row IS (its target), never by what it says
|
|
191
|
-
|
|
192
|
-
key={target.kind === 'group' ? `group:${target.plugin}` : target.kind}
|
|
193
|
+
// Keyed by what the row IS (its target), never by what it says.
|
|
194
|
+
key={target.kind === 'team' ? `team:${target.group}` : target.kind}
|
|
193
195
|
type="button"
|
|
194
196
|
aria-current={isCurrent(target)}
|
|
195
197
|
className={rowClass(isCurrent(target))}
|
|
@@ -216,162 +218,174 @@ export function PluginsSidebar({
|
|
|
216
218
|
);
|
|
217
219
|
|
|
218
220
|
/**
|
|
219
|
-
* A
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
* slot so the column of counts stays a column. Never a count (the caller
|
|
225
|
-
* cannot see inside to count anything) and never the amber attention badge
|
|
226
|
-
* (a non-member has nothing to fix). The accessible name carries the state in
|
|
227
|
-
* words, so the glyph itself can stay decorative.
|
|
221
|
+
* A tablist is ONE tab stop: the chosen tab takes focus, the arrows move
|
|
222
|
+
* between the tabs and choose as they go (Home/End to the ends), so a
|
|
223
|
+
* keyboard user is not made to Tab through both views to reach the rows.
|
|
224
|
+
* Roving `tabIndex` is what makes the unchosen tab reachable by arrow and
|
|
225
|
+
* not by Tab.
|
|
228
226
|
*/
|
|
229
|
-
const
|
|
230
|
-
const
|
|
231
|
-
const
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
// A locked row gets the SAME menu as a readable one, for the same
|
|
242
|
-
// reason it gets the same click: a plugin you are not in is still a
|
|
243
|
-
// place, and `Manage access` is exactly the item an admin locked out of
|
|
244
|
-
// one needs. Which verbs are actually true is the layout's call.
|
|
245
|
-
onContextMenu={(e) => openMenu(e, target, label, e.currentTarget)}
|
|
246
|
-
>
|
|
247
|
-
<span className="truncate">{label}</span>
|
|
248
|
-
<span className="flex h-4.5 shrink-0 basis-5.5 items-center justify-center text-ink-faint">
|
|
249
|
-
<LockGlyph className="size-3" />
|
|
250
|
-
</span>
|
|
251
|
-
</button>
|
|
252
|
-
);
|
|
227
|
+
const onTablistKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {
|
|
228
|
+
const order: SidebarView[] = ['teams', 'advanced'];
|
|
229
|
+
const at = order.indexOf(view);
|
|
230
|
+
let next: SidebarView | null = null;
|
|
231
|
+
if (e.key === 'ArrowRight' || e.key === 'ArrowDown') next = order[(at + 1) % order.length]!;
|
|
232
|
+
else if (e.key === 'ArrowLeft' || e.key === 'ArrowUp') next = order[(at - 1 + order.length) % order.length]!;
|
|
233
|
+
else if (e.key === 'Home') next = order[0]!;
|
|
234
|
+
else if (e.key === 'End') next = order[order.length - 1]!;
|
|
235
|
+
if (next === null) return;
|
|
236
|
+
e.preventDefault();
|
|
237
|
+
switchView(next);
|
|
238
|
+
e.currentTarget.querySelector<HTMLElement>(`#library-view-tab-${next}`)?.focus();
|
|
253
239
|
};
|
|
254
240
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
row with no `LibraryFilter` behind it: the index is a list of
|
|
274
|
-
PLACES, not a slice of the catalog. Its menu is therefore the
|
|
275
|
-
nav's own (`filter: null`) — create a plugin, and none of the
|
|
276
|
-
verbs that need a folder to point at. */}
|
|
277
|
-
<button
|
|
278
|
-
type="button"
|
|
279
|
-
aria-current={pluginsIndexActive}
|
|
280
|
-
className={rowClass(pluginsIndexActive)}
|
|
281
|
-
onClick={onOpenPluginsIndex}
|
|
282
|
-
onContextMenu={(e) => openMenu(e, null, 'All plugins', e.currentTarget)}
|
|
283
|
-
>
|
|
284
|
-
<span className="truncate">All plugins</span>
|
|
285
|
-
</button>
|
|
286
|
-
{/* The shared Skills root, a folder right under the home row: the
|
|
287
|
-
two places the Library hangs off — every plugin, every skill —
|
|
288
|
-
before any lens slices the catalog. The tree is its own row. */}
|
|
289
|
-
{skillsTree}
|
|
290
|
-
|
|
291
|
-
{/* Lenses — the whole catalog, sliced — which is exactly what the
|
|
292
|
-
plugin rows below are not. Naming the section is what keeps that
|
|
293
|
-
distinction visible. `Everything` is a row again now that the
|
|
294
|
-
Library lands on the plugins index instead: without one it would
|
|
295
|
-
be a page with no way in. */}
|
|
296
|
-
<SectionLabel spaced>Library</SectionLabel>
|
|
297
|
-
{row('Everything', { kind: 'all' }, 0)}
|
|
298
|
-
{/* Amber is a summons, not a total. It shows how many of your own
|
|
299
|
-
items need something FROM YOU; when none do, the slot falls back
|
|
300
|
-
to the plain count of what you own, in grey. A permanent amber 26
|
|
301
|
-
beside "Owned by me" trained the eye to ignore the one colour on
|
|
302
|
-
this page that is supposed to mean "look here". */}
|
|
303
|
-
{row(
|
|
304
|
-
'Owned by me',
|
|
305
|
-
{ kind: 'owned' },
|
|
306
|
-
ownedAttention > 0 ? ownedAttention : ownedCount,
|
|
307
|
-
ownedAttention > 0 ? 'pending' : 'count',
|
|
308
|
-
)}
|
|
309
|
-
<PluginsLabel onCreate={onCreatePlugin} />
|
|
241
|
+
const tab = (id: SidebarView, label: string) => (
|
|
242
|
+
<button
|
|
243
|
+
key={id}
|
|
244
|
+
type="button"
|
|
245
|
+
role="tab"
|
|
246
|
+
id={`library-view-tab-${id}`}
|
|
247
|
+
aria-selected={view === id}
|
|
248
|
+
aria-controls={`library-view-${id}`}
|
|
249
|
+
tabIndex={view === id ? 0 : -1}
|
|
250
|
+
className={cn(
|
|
251
|
+
'flex-1 rounded-sm px-2 py-1 text-center text-meta font-semibold transition-[background-color,color,box-shadow]',
|
|
252
|
+
view === id ? 'bg-surface text-ink shadow-card' : 'text-ink-muted hover:text-ink',
|
|
253
|
+
)}
|
|
254
|
+
onClick={() => switchView(id)}
|
|
255
|
+
>
|
|
256
|
+
{label}
|
|
257
|
+
</button>
|
|
258
|
+
);
|
|
310
259
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
260
|
+
return (
|
|
261
|
+
<nav
|
|
262
|
+
aria-label="Library navigation"
|
|
263
|
+
className="flex min-h-0 flex-1 flex-col gap-px overflow-y-auto"
|
|
264
|
+
// The nav's empty space is a target too — Knowledge's tree gives its
|
|
265
|
+
// ROOT row a menu holding the create verbs, and this is where the
|
|
266
|
+
// Library's equivalent click lands. Rows stop the event before it
|
|
267
|
+
// reaches here, so this only ever fires on the gaps between them.
|
|
268
|
+
onContextMenu={(e) => openMenu(e, null, 'Library', null)}
|
|
269
|
+
>
|
|
270
|
+
{/* The two lenses on the whole catalog, unlabelled and first:
|
|
271
|
+
Everything is where the Library opens, and a destination the
|
|
272
|
+
whole surface hangs off does not sit inside a category. */}
|
|
273
|
+
{row('Everything', { kind: 'all' }, 0)}
|
|
274
|
+
{/* Amber is a summons, not a total. It shows how many of your own
|
|
275
|
+
items need something FROM YOU; when none do, the slot falls back
|
|
276
|
+
to the plain count of what you own, in grey. A permanent amber 26
|
|
277
|
+
beside "Owned by me" trained the eye to ignore the one colour on
|
|
278
|
+
this page that is supposed to mean "look here". */}
|
|
279
|
+
{row(
|
|
280
|
+
'Owned by me',
|
|
281
|
+
{ kind: 'owned' },
|
|
282
|
+
ownedAttention > 0 ? ownedAttention : ownedCount,
|
|
283
|
+
ownedAttention > 0 ? 'pending' : 'count',
|
|
284
|
+
)}
|
|
335
285
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
{/* Mirrored, so the tip points up-left at the row's words from
|
|
351
|
-
the room an empty nav is guaranteed to have beneath it. */}
|
|
352
|
-
<ChalkArrow className="pointer-events-none absolute left-[22px] top-[30px] h-[52px] w-[64px] -scale-x-100 text-ink-faint" />
|
|
353
|
-
</div>
|
|
354
|
-
)}
|
|
355
|
-
{/* Locked plugins, after the prototype's 14px `.navgap`. The gap is the
|
|
356
|
-
whole statement: these are in the same list because they are in the
|
|
357
|
-
same workspace, and below a break because you are not in them. */}
|
|
358
|
-
{lockedPlugins.length > 0 && <div className="h-3.5" aria-hidden="true" />}
|
|
359
|
-
{lockedPlugins.map(lockedRow)}
|
|
360
|
-
</nav>
|
|
286
|
+
{/* The switch — a segmented control as quiet as the rows, on the
|
|
287
|
+
nav's own hover tint, the chosen half lifted onto the surface. */}
|
|
288
|
+
<div
|
|
289
|
+
role="tablist"
|
|
290
|
+
aria-label="Sidebar view"
|
|
291
|
+
className="mt-4 mb-2 flex gap-0.5 rounded-md bg-hover p-0.5"
|
|
292
|
+
onKeyDown={onTablistKeyDown}
|
|
293
|
+
// The switch is a control, not empty nav space: a right-click on it
|
|
294
|
+
// is nobody's to answer, so it must not reach the nav behind it.
|
|
295
|
+
onContextMenu={(e) => e.stopPropagation()}
|
|
296
|
+
>
|
|
297
|
+
{tab('teams', 'Groups')}
|
|
298
|
+
{tab('advanced', 'Advanced')}
|
|
299
|
+
</div>
|
|
361
300
|
|
|
362
|
-
|
|
301
|
+
{/* Both panels stay MOUNTED and the inactive one is hidden, not
|
|
302
|
+
dropped: a tab's `aria-controls` always names a panel that exists,
|
|
303
|
+
and the trees keep what a person opened in them (expanded folders,
|
|
304
|
+
a rename in progress) across a switch and back. */}
|
|
305
|
+
<div
|
|
306
|
+
role="tabpanel"
|
|
307
|
+
id="library-view-teams"
|
|
308
|
+
aria-labelledby="library-view-tab-teams"
|
|
309
|
+
hidden={view !== 'teams'}
|
|
310
|
+
className="flex flex-col gap-px"
|
|
311
|
+
>
|
|
312
|
+
{/* Groups only: your own space is not a group — it is reached from
|
|
313
|
+
its row on Everything and its folder in the Plugins tree. */}
|
|
314
|
+
{teams.map(({ name, count, urgent }) =>
|
|
315
|
+
// Orange wins the count slot: members locked out of a skill outrank
|
|
316
|
+
// how much the team can use, which is not the news.
|
|
317
|
+
row(
|
|
318
|
+
name,
|
|
319
|
+
{ kind: 'team', group: name },
|
|
320
|
+
urgent > 0 ? urgent : count,
|
|
321
|
+
urgent > 0 ? 'urgent' : 'count',
|
|
322
|
+
),
|
|
323
|
+
)}
|
|
324
|
+
</div>
|
|
325
|
+
<div
|
|
326
|
+
role="tabpanel"
|
|
327
|
+
id="library-view-advanced"
|
|
328
|
+
aria-labelledby="library-view-tab-advanced"
|
|
329
|
+
hidden={view !== 'advanced'}
|
|
330
|
+
className="flex flex-col gap-px"
|
|
331
|
+
>
|
|
332
|
+
{/* The usual ways to a new plugin are a right-click — on the nav's
|
|
333
|
+
empty space, or on a folder in the Plugins tree — and a person
|
|
334
|
+
with no plugins yet is exactly the person who has not learned
|
|
335
|
+
either. While the workspace holds no plugins AT ALL, the way to
|
|
336
|
+
the first one is said in words, as a row above the trees.
|
|
337
|
+
Words only, no chalk arrow: the `Skills/` and `Plugins/` roots
|
|
338
|
+
render directly beneath this row even when both are empty, so
|
|
339
|
+
there is no empty space for an arrow to come from — it drew
|
|
340
|
+
across the two root rows. (The empty plugin page keeps its
|
|
341
|
+
arrow; it has the room.) Administrators only: on an untouched
|
|
342
|
+
workspace the first plugin is theirs to make, and telling
|
|
343
|
+
everyone else to make it points them at a decision that is not
|
|
344
|
+
theirs. (Everything says the same in its plugin band, for
|
|
345
|
+
whoever never opens this view.) */}
|
|
346
|
+
{canCreatePlugin && (
|
|
363
347
|
<button
|
|
364
348
|
type="button"
|
|
365
|
-
onClick={
|
|
366
|
-
className=
|
|
349
|
+
onClick={onCreatePlugin}
|
|
350
|
+
className={cn(
|
|
351
|
+
'flex items-center gap-2 rounded-sm py-1.5 text-left text-ui text-ink-faint transition-colors hover:bg-hover hover:text-ink',
|
|
352
|
+
SIDEBAR_ROW_INSET,
|
|
353
|
+
)}
|
|
367
354
|
>
|
|
368
|
-
|
|
355
|
+
<span aria-hidden="true">+</span>
|
|
356
|
+
<span className="truncate">Create a plugin</span>
|
|
369
357
|
</button>
|
|
370
358
|
)}
|
|
371
|
-
|
|
359
|
+
{skillsTree}
|
|
360
|
+
{pluginsTree}
|
|
361
|
+
</div>
|
|
362
|
+
</nav>
|
|
372
363
|
);
|
|
373
364
|
}
|
|
374
365
|
|
|
366
|
+
/**
|
|
367
|
+
* The remembered view. Browser storage is a per-viewer convenience: it can
|
|
368
|
+
* be absent, refused or cleared, and the nav must render either way — so
|
|
369
|
+
* every read and write is guarded and the default is the Teams view.
|
|
370
|
+
*/
|
|
371
|
+
const VIEW_STORAGE_KEY = 'bevel-library-sidebar-view';
|
|
372
|
+
|
|
373
|
+
function readStoredView(): SidebarView {
|
|
374
|
+
try {
|
|
375
|
+
return window.localStorage.getItem(VIEW_STORAGE_KEY) === 'advanced' ? 'advanced' : 'teams';
|
|
376
|
+
} catch {
|
|
377
|
+
return 'teams';
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
function storeView(view: SidebarView): void {
|
|
382
|
+
try {
|
|
383
|
+
window.localStorage.setItem(VIEW_STORAGE_KEY, view);
|
|
384
|
+
} catch {
|
|
385
|
+
// A browser that refuses storage still gets the view for this session.
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
|
|
375
389
|
/**
|
|
376
390
|
* A nav section's name, with an optional row of actions at its right edge.
|
|
377
391
|
* The first one has no top padding — the sidebar's own `pt-6` already placed
|
|
@@ -382,10 +396,6 @@ export function PluginsSidebar({
|
|
|
382
396
|
* their opacity follows hover, so the nav stays quiet without the controls
|
|
383
397
|
* being conditional. `focus-within:opacity-100` is what keeps that honest for
|
|
384
398
|
* anyone who never hovers anything.
|
|
385
|
-
*
|
|
386
|
-
* Exported for the Skills tree, whose heading is this label with the tree's
|
|
387
|
-
* own create buttons in the slot — one heading style over every list of
|
|
388
|
-
* places in this nav.
|
|
389
399
|
*/
|
|
390
400
|
export function SectionLabel({
|
|
391
401
|
children,
|
|
@@ -397,7 +407,9 @@ export function SectionLabel({
|
|
|
397
407
|
actions?: ReactNode;
|
|
398
408
|
}) {
|
|
399
409
|
return (
|
|
400
|
-
<div
|
|
410
|
+
<div
|
|
411
|
+
className={cn('group/label flex items-center gap-1 pb-1.5', SIDEBAR_ROW_INSET, spaced && 'pt-5')}
|
|
412
|
+
>
|
|
401
413
|
<span className="text-label uppercase text-ink-faint">{children}</span>
|
|
402
414
|
{actions && (
|
|
403
415
|
<span className="ml-auto flex items-center gap-0.5 opacity-0 transition-opacity focus-within:opacity-100 group-hover/label:opacity-100">
|
|
@@ -407,39 +419,3 @@ export function SectionLabel({
|
|
|
407
419
|
</div>
|
|
408
420
|
);
|
|
409
421
|
}
|
|
410
|
-
|
|
411
|
-
/**
|
|
412
|
-
* The `PLUGINS` heading, and the one way to make a new plugin — the
|
|
413
|
-
* prototype's `.lbladd` (line 78).
|
|
414
|
-
*
|
|
415
|
-
* It used to read "Included in your MCP", from when a plugin was the only
|
|
416
|
-
* way a skill reached an agent. Skills have a root of their own now, listed
|
|
417
|
-
* as a tree above this section, so the heading says what these rows ARE:
|
|
418
|
-
* plugins — the bundles the caller is in. (The locked rows that trail the
|
|
419
|
-
* list sit below a gap for the same reason: they are in the workspace but
|
|
420
|
-
* not the caller's, and the break is what keeps the heading honest.)
|
|
421
|
-
*
|
|
422
|
-
* `All plugins` is NOT a row here. It heads the whole nav instead: it is the
|
|
423
|
-
* Library's home rather than one more entry in the caller's set, and inside
|
|
424
|
-
* this list it used to collect the clicks meant for the plugins under it.
|
|
425
|
-
*/
|
|
426
|
-
function PluginsLabel({ onCreate }: { onCreate(): void }) {
|
|
427
|
-
return (
|
|
428
|
-
<SectionLabel
|
|
429
|
-
spaced
|
|
430
|
-
actions={
|
|
431
|
-
<button
|
|
432
|
-
type="button"
|
|
433
|
-
onClick={onCreate}
|
|
434
|
-
title="New plugin"
|
|
435
|
-
aria-label="New plugin"
|
|
436
|
-
className="flex size-4.5 items-center justify-center rounded-xs text-ui leading-none text-ink-faint hover:bg-hover hover:text-ink"
|
|
437
|
-
>
|
|
438
|
-
+
|
|
439
|
-
</button>
|
|
440
|
-
}
|
|
441
|
-
>
|
|
442
|
-
Plugins
|
|
443
|
-
</SectionLabel>
|
|
444
|
-
);
|
|
445
|
-
}
|