@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
|
@@ -3,6 +3,7 @@ import type { ToolSecrets } from '../../secrets-vault/services/tool-secrets.api'
|
|
|
3
3
|
import {
|
|
4
4
|
emptyMessageFor,
|
|
5
5
|
filterLibraryItems,
|
|
6
|
+
linkedHomeOf,
|
|
6
7
|
pluginCounts,
|
|
7
8
|
neededToolsFor,
|
|
8
9
|
skillStatus,
|
|
@@ -47,13 +48,34 @@ describe('toolStatus: stored vs working', () => {
|
|
|
47
48
|
expect(s.hint).toMatch(/not verified/i);
|
|
48
49
|
});
|
|
49
50
|
|
|
50
|
-
|
|
51
|
+
// `Key saved` and `Unverified` are not the same claim, and which one is true
|
|
52
|
+
// turns on whether anybody ASKED. With no verdict (above) nothing was
|
|
53
|
+
// attempted, so "a value is stored" is the whole of what is known. Here a
|
|
54
|
+
// probe ran and came back without an answer — the reader's question has been
|
|
55
|
+
// put to the provider and gone unanswered, and a row still saying "Key
|
|
56
|
+
// saved" would be reporting the storage rather than the attempt.
|
|
57
|
+
it('says Unverified — not Key saved — once a probe has run and reached no verdict', () => {
|
|
51
58
|
const s = toolStatus(withKey(), { status: 'unverifiable', detail: 'Provider timed out.', checkedAt: new Date().toISOString() });
|
|
59
|
+
// Still green: the key is saved, nothing is broken, nobody has to act.
|
|
52
60
|
expect(s.state).toBe('ok');
|
|
53
|
-
expect(s.text).toBe('
|
|
61
|
+
expect(s.text).toBe('Unverified');
|
|
62
|
+
// And it carries WHY, which is the whole difference from the untested case.
|
|
54
63
|
expect(s.hint).toBe('Provider timed out.');
|
|
55
64
|
});
|
|
56
65
|
|
|
66
|
+
// The commonest reason a probe reaches no verdict: the manual defines no
|
|
67
|
+
// health check, so there was never anything to call.
|
|
68
|
+
it('says Unverified with the reason when the manual defines no health check', () => {
|
|
69
|
+
const s = toolStatus(withKey(), {
|
|
70
|
+
status: 'unverifiable',
|
|
71
|
+
detail: "This tool doesn't offer a way to test its connection.",
|
|
72
|
+
checkedAt: new Date().toISOString(),
|
|
73
|
+
});
|
|
74
|
+
expect(s.state).toBe('ok');
|
|
75
|
+
expect(s.text).toBe('Unverified');
|
|
76
|
+
expect(s.hint).toBe("This tool doesn't offer a way to test its connection.");
|
|
77
|
+
});
|
|
78
|
+
|
|
57
79
|
it('earns Connected only from a passing probe, and shows when it was checked', () => {
|
|
58
80
|
const s = toolStatus(withKey(), { status: 'ok', detail: null, checkedAt: new Date().toISOString() });
|
|
59
81
|
expect(s.state).toBe('ok');
|
|
@@ -205,6 +227,23 @@ describe('filterLibraryItems (sidebar selection + search)', () => {
|
|
|
205
227
|
expect(filterLibraryItems(items, { kind: 'all' }, '')).toHaveLength(4);
|
|
206
228
|
});
|
|
207
229
|
|
|
230
|
+
it("a team is the server's slice, by id — never a property of the items", () => {
|
|
231
|
+
const named = items.map((i) => ({ ...i, id: i.name.toLowerCase() }));
|
|
232
|
+
const teams = [{ name: 'Sales', plugins: ['gtm'], skills: ['rfi responder'], tools: ['slack'] }];
|
|
233
|
+
expect(filterLibraryItems(named, { kind: 'team', group: 'Sales' }, '', teams).map((i) => i.name)).toEqual([
|
|
234
|
+
'RFI responder',
|
|
235
|
+
'Slack',
|
|
236
|
+
]);
|
|
237
|
+
// A skill's id is looked up among skills, a tool's among tools: a tool
|
|
238
|
+
// named like a listed skill is not in the team.
|
|
239
|
+
const crossed = [{ name: 'Sales', plugins: [], skills: ['slack'], tools: [] }];
|
|
240
|
+
expect(filterLibraryItems(named, { kind: 'team', group: 'Sales' }, '', crossed)).toEqual([]);
|
|
241
|
+
// No slice for the team, or no ids on the items: nothing, never everything.
|
|
242
|
+
expect(filterLibraryItems(named, { kind: 'team', group: 'Ops' }, '', teams)).toEqual([]);
|
|
243
|
+
expect(filterLibraryItems(items, { kind: 'team', group: 'Sales' }, '', teams)).toEqual([]);
|
|
244
|
+
expect(filterLibraryItems(named, { kind: 'team', group: 'Sales' }, '')).toEqual([]);
|
|
245
|
+
});
|
|
246
|
+
|
|
208
247
|
it('search matches name or description within the selection, case-insensitively', () => {
|
|
209
248
|
expect(filterLibraryItems(items, { kind: 'all' }, 'friday').map((i) => i.name)).toEqual([
|
|
210
249
|
'Weekly newsletter',
|
|
@@ -292,3 +331,44 @@ describe('toastDuration', () => {
|
|
|
292
331
|
expect([...times].sort((a, b) => a - b)).toEqual(times);
|
|
293
332
|
});
|
|
294
333
|
});
|
|
334
|
+
|
|
335
|
+
describe('linkedHomeOf', () => {
|
|
336
|
+
/** A skill's `path` is its folder; a tool's is its file. */
|
|
337
|
+
const linked = (path: string) => ({ path, plugins: [{ name: 'GTM', linked: true }] });
|
|
338
|
+
|
|
339
|
+
it('names the ROOT the manifest links, for a skill and for a tool beside it', () => {
|
|
340
|
+
const roots = ['Skills/Testing', 'Plugins/Shared/observability'];
|
|
341
|
+
expect(linkedHomeOf(linked('Skills/Testing/test-shared-linking'), 'GTM', roots)).toBe('Skills/Testing');
|
|
342
|
+
expect(linkedHomeOf(linked('Plugins/Shared/observability/grafana.tool'), 'GTM', roots)).toBe(
|
|
343
|
+
'Plugins/Shared/observability',
|
|
344
|
+
);
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
// The root IS the skill folder. Naming its parent would point at a shelf
|
|
348
|
+
// nobody linked — and at skills this plugin cannot see.
|
|
349
|
+
it('names the skill folder itself when THAT is what the manifest links', () => {
|
|
350
|
+
expect(
|
|
351
|
+
linkedHomeOf(linked('Skills/Testing/test-shared-linking'), 'GTM', ['Skills/Testing/test-shared-linking']),
|
|
352
|
+
).toBe('Skills/Testing/test-shared-linking');
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
it('answers with the deepest root that holds the item', () => {
|
|
356
|
+
const roots = ['Skills', 'Skills/Testing'];
|
|
357
|
+
expect(linkedHomeOf(linked('Skills/Testing/test-shared-linking'), 'GTM', roots)).toBe('Skills/Testing');
|
|
358
|
+
});
|
|
359
|
+
|
|
360
|
+
// The summary has not arrived, or the plugins endpoint failed: the parent
|
|
361
|
+
// folder is where a linked item lives in every case but the one above.
|
|
362
|
+
it('falls back to the parent folder when no root is known', () => {
|
|
363
|
+
expect(linkedHomeOf(linked('Skills/Testing/test-shared-linking'), 'GTM')).toBe('Skills/Testing');
|
|
364
|
+
expect(linkedHomeOf(linked('Skills/Testing/x'), 'GTM', ['Skills/Other'])).toBe('Skills/Testing');
|
|
365
|
+
});
|
|
366
|
+
|
|
367
|
+
it('is null for an INLINE item, and for one this plugin does not hold at all', () => {
|
|
368
|
+
const inline = { path: 'Plugins/GTM/outreach', plugins: [{ name: 'GTM', linked: false }] };
|
|
369
|
+
expect(linkedHomeOf(inline, 'GTM')).toBeNull();
|
|
370
|
+
// Linked into another plugin entirely — not this page's business.
|
|
371
|
+
expect(linkedHomeOf(linked('Skills/Testing/x'), 'Product')).toBeNull();
|
|
372
|
+
expect(linkedHomeOf({ path: 'Plugins/GTM/outreach' }, 'GTM')).toBeNull();
|
|
373
|
+
});
|
|
374
|
+
});
|
|
@@ -4,7 +4,7 @@ import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
|
4
4
|
// real network call. The module under test binds to this import at load.
|
|
5
5
|
vi.mock('../../../lib/api', () => ({ authFetch: vi.fn() }));
|
|
6
6
|
|
|
7
|
-
import { getMcpServer } from '../services/tools.api';
|
|
7
|
+
import { getMcpServer, listPendingTools } from '../services/tools.api';
|
|
8
8
|
import { authFetch } from '../../../lib/api';
|
|
9
9
|
|
|
10
10
|
const mockedFetch = vi.mocked(authFetch);
|
|
@@ -68,3 +68,46 @@ describe('getMcpServer', () => {
|
|
|
68
68
|
await expect(getMcpServer('vendor')).resolves.toEqual(view);
|
|
69
69
|
});
|
|
70
70
|
});
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* `GET /api/tools/pending` — the library's review shelf for tools.
|
|
74
|
+
*
|
|
75
|
+
* The guard under test is the one the skills side learned the hard way: a
|
|
76
|
+
* backend built before this route existed answers through `/tools/:slug`, so a
|
|
77
|
+
* 200 arrives whose body is not this shape. An empty shelf is the right
|
|
78
|
+
* failure; `undefined` reaching the item mapper blanked the whole library.
|
|
79
|
+
*/
|
|
80
|
+
describe('listPendingTools', () => {
|
|
81
|
+
const PENDING = {
|
|
82
|
+
slug: 'weather',
|
|
83
|
+
name: 'weather',
|
|
84
|
+
path: 'Plugins/Ops/weather.tool',
|
|
85
|
+
type: 'http' as const,
|
|
86
|
+
plugin: 'Ops',
|
|
87
|
+
changeRequestNumber: 7,
|
|
88
|
+
branch: 'agent/weather',
|
|
89
|
+
authorName: 'Ali Raza',
|
|
90
|
+
createdAt: '2026-09-06T09:00:00.000Z',
|
|
91
|
+
isAuthor: true,
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
beforeEach(() => {
|
|
95
|
+
vi.clearAllMocks();
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it('returns the proposals on 200', async () => {
|
|
99
|
+
mockedFetch.mockResolvedValueOnce(jsonRes(200, { tools: [PENDING] }));
|
|
100
|
+
await expect(listPendingTools()).resolves.toEqual([PENDING]);
|
|
101
|
+
expect(mockedFetch).toHaveBeenCalledWith('/api/tools/pending');
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
it('degrades to an empty shelf when the body is not this shape', async () => {
|
|
105
|
+
mockedFetch.mockResolvedValueOnce(jsonRes(200, { ok: false, error: 'not_found' }));
|
|
106
|
+
await expect(listPendingTools()).resolves.toEqual([]);
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it('surfaces a failure rather than pretending nothing is proposed', async () => {
|
|
110
|
+
mockedFetch.mockResolvedValueOnce(jsonRes(500, { error: 'Internal error' }));
|
|
111
|
+
await expect(listPendingTools()).rejects.toThrow('Internal error');
|
|
112
|
+
});
|
|
113
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
+
import { renderHook, waitFor } from '@testing-library/react';
|
|
3
|
+
import type { ReactNode } from 'react';
|
|
4
|
+
import type { JoinRequest } from '../services/plugins.api';
|
|
5
|
+
import { LibraryToastProvider } from '../state/toast';
|
|
6
|
+
import { useJoinRequests, type JoinRequestsApi } from '../hooks/useJoinRequests';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Requests belong to the plugin they were fetched for. A page that moves
|
|
10
|
+
* from one skill to the next without unmounting must show nothing of the
|
|
11
|
+
* previous one while the next one's answer is on its way: a banner still
|
|
12
|
+
* listing A's requests over B's folder would grant A's proposal to B.
|
|
13
|
+
*/
|
|
14
|
+
const request = (number: number): JoinRequest => ({
|
|
15
|
+
number,
|
|
16
|
+
branch: `ali/join-${number}`,
|
|
17
|
+
requesterName: 'Ali',
|
|
18
|
+
createdAt: '2026-01-01T00:00:00.000Z',
|
|
19
|
+
proposals: [],
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const wrapper = ({ children }: { children: ReactNode }) => <LibraryToastProvider>{children}</LibraryToastProvider>;
|
|
23
|
+
|
|
24
|
+
describe('useJoinRequests', () => {
|
|
25
|
+
it('shows only the requests of the plugin it is asked about, never a previous one\'s', async () => {
|
|
26
|
+
let releaseB: (rows: JoinRequest[]) => void = () => {};
|
|
27
|
+
const api: JoinRequestsApi = {
|
|
28
|
+
list: vi.fn((name: string) =>
|
|
29
|
+
name === 'A' ? Promise.resolve([request(1)]) : new Promise<JoinRequest[]>((resolve) => (releaseB = resolve)),
|
|
30
|
+
),
|
|
31
|
+
reconcile: vi.fn().mockResolvedValue(false),
|
|
32
|
+
};
|
|
33
|
+
const { result, rerender } = renderHook(({ plugin }) => useJoinRequests(plugin, `Skills/${plugin}`, api), {
|
|
34
|
+
wrapper,
|
|
35
|
+
initialProps: { plugin: 'A' },
|
|
36
|
+
});
|
|
37
|
+
await waitFor(() => expect(result.current.requests.map((r) => r.number)).toEqual([1]));
|
|
38
|
+
|
|
39
|
+
rerender({ plugin: 'B' });
|
|
40
|
+
// B's answer has not arrived: nothing, not A's rows.
|
|
41
|
+
expect(result.current.requests).toEqual([]);
|
|
42
|
+
|
|
43
|
+
releaseB([request(2)]);
|
|
44
|
+
await waitFor(() => expect(result.current.requests.map((r) => r.number)).toEqual([2]));
|
|
45
|
+
});
|
|
46
|
+
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
1
2
|
import { Banner, Button } from '../../../shared/components';
|
|
2
3
|
import { cn } from '../../../lib/utils';
|
|
3
4
|
import type { JoinProposal, JoinRequest } from '../services/plugins.api';
|
|
@@ -44,55 +45,92 @@ export function AccessRequestsBanner({
|
|
|
44
45
|
}: AccessRequestsBannerProps) {
|
|
45
46
|
if (requests.length === 0) return null;
|
|
46
47
|
|
|
48
|
+
const accept = (request: JoinRequest, proposal: JoinProposal) => (
|
|
49
|
+
<Button
|
|
50
|
+
variant="outline"
|
|
51
|
+
size="sm"
|
|
52
|
+
aria-label={`Grant ${proposal.verb} to ${proposal.label}`}
|
|
53
|
+
onClick={() => onAccept(request, proposal)}
|
|
54
|
+
>
|
|
55
|
+
Accept
|
|
56
|
+
</Button>
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
// One line per request, naming the requester and ending in its answers. A
|
|
60
|
+
// request proposing ONE grant says which on that line, so Accept and Decline
|
|
61
|
+
// sit together; a request proposing several gives each its own line and
|
|
62
|
+
// Accept, and keeps Decline — which answers the whole request — on the
|
|
63
|
+
// requester's line.
|
|
64
|
+
const lines: { key: string; text: ReactNode; actions: ReactNode; nested?: boolean }[] = [];
|
|
65
|
+
for (const request of requests) {
|
|
66
|
+
const single = request.proposals.length === 1 ? request.proposals[0] : null;
|
|
67
|
+
lines.push({
|
|
68
|
+
key: `request:${request.number}`,
|
|
69
|
+
text: single ? (
|
|
70
|
+
<>
|
|
71
|
+
{`${request.requesterName} asked for access to ${plugin}: `}
|
|
72
|
+
{single.label !== request.requesterName && `${single.label}, `}
|
|
73
|
+
<span className="font-semibold">{single.verb}</span>
|
|
74
|
+
</>
|
|
75
|
+
) : (
|
|
76
|
+
`${request.requesterName} asked for access to ${plugin}.`
|
|
77
|
+
),
|
|
78
|
+
actions: (
|
|
79
|
+
<>
|
|
80
|
+
{single && accept(request, single)}
|
|
81
|
+
<Button
|
|
82
|
+
variant="quiet"
|
|
83
|
+
size="sm"
|
|
84
|
+
aria-label={`Decline the request from ${request.requesterName}`}
|
|
85
|
+
onClick={() => onDecline(request)}
|
|
86
|
+
>
|
|
87
|
+
Decline
|
|
88
|
+
</Button>
|
|
89
|
+
</>
|
|
90
|
+
),
|
|
91
|
+
});
|
|
92
|
+
if (single) continue;
|
|
93
|
+
for (const proposal of request.proposals) {
|
|
94
|
+
lines.push({
|
|
95
|
+
key: `proposal:${request.number}:${proposal.verb}:${proposal.id}`,
|
|
96
|
+
text: (
|
|
97
|
+
<>
|
|
98
|
+
{`${proposal.label}: `}
|
|
99
|
+
<span className="font-semibold">{proposal.verb}</span>
|
|
100
|
+
</>
|
|
101
|
+
),
|
|
102
|
+
actions: accept(request, proposal),
|
|
103
|
+
nested: true,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
47
108
|
return (
|
|
48
109
|
<Banner role="status" tone="wait" className={cn('mb-4', className)}>
|
|
49
|
-
<
|
|
50
|
-
{
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
onClick={() => onAccept(request, proposal)}
|
|
74
|
-
>
|
|
75
|
-
Accept
|
|
76
|
-
</Button>
|
|
77
|
-
</div>
|
|
78
|
-
))}
|
|
79
|
-
<div>
|
|
80
|
-
<Button
|
|
81
|
-
variant="quiet"
|
|
82
|
-
size="sm"
|
|
83
|
-
aria-label={`Decline the request from ${request.requesterName}`}
|
|
84
|
-
onClick={() => onDecline(request)}
|
|
85
|
-
>
|
|
86
|
-
Decline
|
|
87
|
-
</Button>
|
|
88
|
-
</div>
|
|
89
|
-
</div>
|
|
90
|
-
))}
|
|
91
|
-
{folders.map((folder) => (
|
|
92
|
-
<div key={folder}>
|
|
93
|
-
<Button variant="quiet" size="sm" onClick={() => onManage(folder)}>
|
|
94
|
-
Manage access
|
|
95
|
-
</Button>
|
|
110
|
+
<div className="flex flex-col gap-1.5">
|
|
111
|
+
{lines.map((line, i) => (
|
|
112
|
+
<div
|
|
113
|
+
key={line.key}
|
|
114
|
+
className={cn('flex flex-wrap items-center gap-x-2 gap-y-1', line.nested && 'pl-4')}
|
|
115
|
+
>
|
|
116
|
+
<span className="min-w-0 flex-1">{line.text}</span>
|
|
117
|
+
<span className="flex shrink-0 items-center gap-1.5">
|
|
118
|
+
{line.actions}
|
|
119
|
+
{/* The third path, said as a link rather than a button of its
|
|
120
|
+
own: the manager who wants something other than what was
|
|
121
|
+
proposed. It closes the banner's last line. */}
|
|
122
|
+
{i === lines.length - 1 &&
|
|
123
|
+
folders.map((folder) => (
|
|
124
|
+
<button
|
|
125
|
+
key={folder}
|
|
126
|
+
type="button"
|
|
127
|
+
className="ml-1 rounded-xs text-detail text-ink-muted underline underline-offset-2 hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ink-muted"
|
|
128
|
+
onClick={() => onManage(folder)}
|
|
129
|
+
>
|
|
130
|
+
Manage access
|
|
131
|
+
</button>
|
|
132
|
+
))}
|
|
133
|
+
</span>
|
|
96
134
|
</div>
|
|
97
135
|
))}
|
|
98
136
|
</div>
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { useId, useRef, type ReactNode } from 'react';
|
|
2
|
+
import { cn } from '../../../lib/utils';
|
|
3
|
+
|
|
4
|
+
export type AddKind = 'skills' | 'tools';
|
|
5
|
+
|
|
6
|
+
const KINDS: ReadonlyArray<readonly [AddKind, string]> = [
|
|
7
|
+
['skills', 'Skills'],
|
|
8
|
+
['tools', 'Tools'],
|
|
9
|
+
];
|
|
10
|
+
|
|
11
|
+
interface AddDialogTabsProps {
|
|
12
|
+
selected: AddKind;
|
|
13
|
+
onSelect(kind: AddKind): void;
|
|
14
|
+
/**
|
|
15
|
+
* One panel per tab. BOTH are rendered — the inactive one is `hidden`, not
|
|
16
|
+
* unmounted, because the Skills panel holds typed state (the new-skill name,
|
|
17
|
+
* the link search) and unmounting it on a tab click would throw a draft away
|
|
18
|
+
* silently.
|
|
19
|
+
*/
|
|
20
|
+
panels: Record<AddKind, ReactNode>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The Skills / Tools split inside both add dialogs (plugin and personal).
|
|
25
|
+
*
|
|
26
|
+
* The dialog is titled "Add a skill or tool", but everything in it used to be
|
|
27
|
+
* about skills, and people went looking for how to add a tool and found
|
|
28
|
+
* nothing. A tool has no form to fill in here — it is a prompt for the agent,
|
|
29
|
+
* an `mcp.json` server, or a `.tool` manual — so the Tools tab explains rather
|
|
30
|
+
* than creates.
|
|
31
|
+
*
|
|
32
|
+
* Same keyboard contract as `SkillFileTabs`: arrows and Home/End move the
|
|
33
|
+
* selection, and focus follows it.
|
|
34
|
+
*/
|
|
35
|
+
export function AddDialogTabs({ selected, onSelect, panels }: AddDialogTabsProps) {
|
|
36
|
+
const baseId = useId();
|
|
37
|
+
const buttons = useRef(new Map<AddKind, HTMLButtonElement>());
|
|
38
|
+
|
|
39
|
+
function onKeyDown(e: React.KeyboardEvent) {
|
|
40
|
+
const i = KINDS.findIndex(([kind]) => kind === selected);
|
|
41
|
+
const at =
|
|
42
|
+
e.key === 'ArrowRight' ? (i + 1) % KINDS.length
|
|
43
|
+
: e.key === 'ArrowLeft' ? (i - 1 + KINDS.length) % KINDS.length
|
|
44
|
+
: e.key === 'Home' ? 0
|
|
45
|
+
: e.key === 'End' ? KINDS.length - 1
|
|
46
|
+
: undefined;
|
|
47
|
+
if (at === undefined) return;
|
|
48
|
+
e.preventDefault();
|
|
49
|
+
const next = KINDS[at][0];
|
|
50
|
+
onSelect(next);
|
|
51
|
+
buttons.current.get(next)?.focus();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<>
|
|
56
|
+
<div
|
|
57
|
+
role="tablist"
|
|
58
|
+
aria-label="What to add"
|
|
59
|
+
className="-mt-1 mb-3 flex gap-0.5 border-b border-line"
|
|
60
|
+
onKeyDown={onKeyDown}
|
|
61
|
+
>
|
|
62
|
+
{KINDS.map(([kind, label]) => {
|
|
63
|
+
const on = kind === selected;
|
|
64
|
+
return (
|
|
65
|
+
<button
|
|
66
|
+
key={kind}
|
|
67
|
+
type="button"
|
|
68
|
+
role="tab"
|
|
69
|
+
id={`${baseId}-tab-${kind}`}
|
|
70
|
+
aria-selected={on}
|
|
71
|
+
aria-controls={`${baseId}-panel-${kind}`}
|
|
72
|
+
tabIndex={on ? 0 : -1}
|
|
73
|
+
ref={(el) => {
|
|
74
|
+
if (el) buttons.current.set(kind, el);
|
|
75
|
+
else buttons.current.delete(kind);
|
|
76
|
+
}}
|
|
77
|
+
className={cn(
|
|
78
|
+
'rounded-t-sm px-3 pb-2 pt-1.5 text-ui transition-colors',
|
|
79
|
+
on
|
|
80
|
+
? 'font-semibold text-ink shadow-[inset_0_-2px_0_var(--color-ink)]'
|
|
81
|
+
: 'text-ink-muted hover:bg-hover hover:text-ink',
|
|
82
|
+
)}
|
|
83
|
+
onClick={() => onSelect(kind)}
|
|
84
|
+
>
|
|
85
|
+
{label}
|
|
86
|
+
</button>
|
|
87
|
+
);
|
|
88
|
+
})}
|
|
89
|
+
</div>
|
|
90
|
+
{KINDS.map(([kind]) => (
|
|
91
|
+
<div
|
|
92
|
+
key={kind}
|
|
93
|
+
role="tabpanel"
|
|
94
|
+
id={`${baseId}-panel-${kind}`}
|
|
95
|
+
aria-labelledby={`${baseId}-tab-${kind}`}
|
|
96
|
+
hidden={kind !== selected}
|
|
97
|
+
>
|
|
98
|
+
{panels[kind]}
|
|
99
|
+
</div>
|
|
100
|
+
))}
|
|
101
|
+
</>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
1
2
|
import { Button, Dialog, Surface } from '../../../shared/components';
|
|
2
3
|
import { useAdmin } from '../../admin/state/admin.context';
|
|
3
4
|
import { NewSkillPanel } from './NewSkillPanel';
|
|
5
|
+
import { LinkSkillPanel } from './LinkSkillPanel';
|
|
6
|
+
import { AddDialogTabs, type AddKind } from './AddDialogTabs';
|
|
7
|
+
import type { LibraryItem } from '../state/library-data';
|
|
4
8
|
import { useLibraryToast } from '../state/toast.context';
|
|
5
9
|
import { COPIED_TOAST, COPY_FAILED_TOAST, copyToClipboard } from '../utils/clipboard';
|
|
6
10
|
|
|
@@ -18,6 +22,13 @@ export interface AddToPluginDialogProps {
|
|
|
18
22
|
canWrite: boolean | null;
|
|
19
23
|
/** Every skill name already in the catalog. The admin create half rejects collisions. */
|
|
20
24
|
existingSkills: string[];
|
|
25
|
+
/**
|
|
26
|
+
* The caller's catalog, for the "link an existing skill" half. Optional
|
|
27
|
+
* together with `onLinked`: a caller without them gets the dialog as it was
|
|
28
|
+
* before linking existed.
|
|
29
|
+
*/
|
|
30
|
+
linkable?: LibraryItem[];
|
|
31
|
+
onLinked?(): void;
|
|
21
32
|
onClose(): void;
|
|
22
33
|
}
|
|
23
34
|
|
|
@@ -37,44 +48,44 @@ export interface AddToPluginDialogProps {
|
|
|
37
48
|
* safe action inside it: non-admins can copy the prompt, and the prompt's last
|
|
38
49
|
* clause tells the truth about whether the resulting skill lands directly or
|
|
39
50
|
* arrives as a change request.
|
|
51
|
+
*
|
|
52
|
+
* Skills and tools are separate tabs. The Tools tab has no form, on purpose: it
|
|
53
|
+
* carries a tool-specific prompt and says where an MCP server or a `.tool`
|
|
54
|
+
* manual goes, under the same owner-or-change-request note as the Skills tab.
|
|
55
|
+
* The footer's "Copy prompt" copies the prompt of whichever tab is showing.
|
|
40
56
|
*/
|
|
41
57
|
export function AddToPluginDialog({
|
|
42
58
|
name,
|
|
43
59
|
primaryPath,
|
|
44
60
|
canWrite,
|
|
45
61
|
existingSkills,
|
|
62
|
+
linkable,
|
|
63
|
+
onLinked,
|
|
46
64
|
onClose,
|
|
47
65
|
}: AddToPluginDialogProps) {
|
|
48
66
|
const { isAdmin } = useAdmin();
|
|
49
67
|
const toast = useLibraryToast();
|
|
68
|
+
const [kind, setKind] = useState<AddKind>('skills');
|
|
50
69
|
|
|
51
70
|
// The only sentence in this dialog that varies by role.
|
|
52
71
|
const landing = canWrite
|
|
53
72
|
? 'I run it, so it goes in directly. No review step.'
|
|
54
73
|
: 'I am not an owner, so send it to the plugin as a change request for review.';
|
|
55
|
-
const
|
|
74
|
+
const skillPrompt = `Help me build a new skill or tool and add it to the ${name} plugin at Bevel. ${landing}`;
|
|
75
|
+
const toolPrompt = `Help me build a new tool and add it to the ${name} plugin at Bevel. ${landing}`;
|
|
56
76
|
|
|
57
77
|
async function copyPrompt() {
|
|
78
|
+
const prompt = kind === 'tools' ? toolPrompt : skillPrompt;
|
|
58
79
|
const copied = await copyToClipboard(prompt);
|
|
59
80
|
toast(copied ? COPIED_TOAST : COPY_FAILED_TOAST, copied ? 'neutral' : 'danger');
|
|
60
81
|
}
|
|
61
82
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
<>
|
|
69
|
-
<Button variant="quiet" onClick={onClose}>
|
|
70
|
-
Close
|
|
71
|
-
</Button>
|
|
72
|
-
<Button variant="primary" onClick={() => void copyPrompt()}>
|
|
73
|
-
Copy prompt
|
|
74
|
-
</Button>
|
|
75
|
-
</>
|
|
76
|
-
}
|
|
77
|
-
>
|
|
83
|
+
// Both panels are handed to `AddDialogTabs`, which mounts BOTH and hides the
|
|
84
|
+
// inactive one. The Skills half owns typed state — the new-skill name and the
|
|
85
|
+
// link search — and a tab click that unmounted it would silently throw a
|
|
86
|
+
// half-written draft away.
|
|
87
|
+
const skillsPanel = (
|
|
88
|
+
<>
|
|
78
89
|
<p className="text-ui text-ink-muted">
|
|
79
90
|
{isAdmin
|
|
80
91
|
? canWrite
|
|
@@ -85,6 +96,28 @@ export function AddToPluginDialog({
|
|
|
85
96
|
: `Use the prompt below to have your agent draft the skill and send it to ${name} as a change request for an owner to review.`}
|
|
86
97
|
</p>
|
|
87
98
|
|
|
99
|
+
{/* Linking is the MANAGER's half: it edits this plugin's manifest, and the
|
|
100
|
+
server refuses anyone else. A non-manager only gets the prompt below. */}
|
|
101
|
+
{canWrite && linkable && onLinked && (
|
|
102
|
+
<>
|
|
103
|
+
<div className="mt-3">
|
|
104
|
+
<LinkSkillPanel
|
|
105
|
+
plugin={name}
|
|
106
|
+
items={linkable}
|
|
107
|
+
onLinked={() => {
|
|
108
|
+
onLinked();
|
|
109
|
+
onClose();
|
|
110
|
+
}}
|
|
111
|
+
/>
|
|
112
|
+
</div>
|
|
113
|
+
<div className="my-3.5 flex items-center gap-3">
|
|
114
|
+
<span aria-hidden="true" className="h-px flex-1 bg-line" />
|
|
115
|
+
<span className="text-meta text-ink-faint">or</span>
|
|
116
|
+
<span aria-hidden="true" className="h-px flex-1 bg-line" />
|
|
117
|
+
</div>
|
|
118
|
+
</>
|
|
119
|
+
)}
|
|
120
|
+
|
|
88
121
|
{isAdmin && (
|
|
89
122
|
<>
|
|
90
123
|
<NewSkillPanel
|
|
@@ -108,8 +141,64 @@ export function AddToPluginDialog({
|
|
|
108
141
|
)}
|
|
109
142
|
|
|
110
143
|
<Surface tone="sunken" radius="md" elevation="none" padded className="mt-2.5">
|
|
111
|
-
<p className="font-mono text-detail text-ink">{
|
|
144
|
+
<p className="font-mono text-detail text-ink">{skillPrompt}</p>
|
|
112
145
|
</Surface>
|
|
146
|
+
</>
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
const toolsPanel = (
|
|
150
|
+
<>
|
|
151
|
+
{/* The Skills tab's owner-or-change-request note, without its
|
|
152
|
+
"Two ways in": none of the tool paths below is a form. */}
|
|
153
|
+
<p className="text-ui text-ink-muted">
|
|
154
|
+
{canWrite
|
|
155
|
+
? `Whichever way you add it, it joins ${name}. Everyone in the plugin gets it the next time their agent connects.`
|
|
156
|
+
: `Whichever way you add it, it goes to ${name} as a change request, and an owner reviews it before it joins.`}
|
|
157
|
+
</p>
|
|
158
|
+
|
|
159
|
+
<p className="mt-3 text-ui text-ink-muted">
|
|
160
|
+
{`Tell your agent what the tool should do. It drafts the tool and adds it to ${name}.`}
|
|
161
|
+
</p>
|
|
162
|
+
|
|
163
|
+
<Surface tone="sunken" radius="md" elevation="none" padded className="mt-2.5">
|
|
164
|
+
<p className="font-mono text-detail text-ink">{toolPrompt}</p>
|
|
165
|
+
</Surface>
|
|
166
|
+
|
|
167
|
+
{/* Both locations are the ones the workspace layout defines (shared
|
|
168
|
+
`kb-layout.ts`): `mcp.json` at the plugin root — the Agent Plugins
|
|
169
|
+
fixed location — and `.tool` manuals under the reverse-DNS extension
|
|
170
|
+
directory, which is where the migration writes them and where a
|
|
171
|
+
reader expects to find them. */}
|
|
172
|
+
<p className="mt-3.5 text-ui text-ink-muted">
|
|
173
|
+
{`To connect an MCP server, add it to the mcp.json in the ${name} plugin folder.`}
|
|
174
|
+
</p>
|
|
175
|
+
<p className="mt-2 text-ui text-ink-muted">
|
|
176
|
+
{`To call an API without an MCP server, add a .tool manual describing it to the ${name} plugin's software.bevel.hexis/tools/ folder.`}
|
|
177
|
+
</p>
|
|
178
|
+
</>
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
return (
|
|
182
|
+
<Dialog
|
|
183
|
+
open
|
|
184
|
+
onClose={onClose}
|
|
185
|
+
title={`Add a skill or tool to ${name}`}
|
|
186
|
+
footer={
|
|
187
|
+
<>
|
|
188
|
+
<Button variant="quiet" onClick={onClose}>
|
|
189
|
+
Close
|
|
190
|
+
</Button>
|
|
191
|
+
<Button variant="primary" onClick={() => void copyPrompt()}>
|
|
192
|
+
Copy prompt
|
|
193
|
+
</Button>
|
|
194
|
+
</>
|
|
195
|
+
}
|
|
196
|
+
>
|
|
197
|
+
<AddDialogTabs
|
|
198
|
+
selected={kind}
|
|
199
|
+
onSelect={setKind}
|
|
200
|
+
panels={{ skills: skillsPanel, tools: toolsPanel }}
|
|
201
|
+
/>
|
|
113
202
|
</Dialog>
|
|
114
203
|
);
|
|
115
204
|
}
|