@bevel-software/platform-core-frontend 0.15.1 → 0.20.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 +20 -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__/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/DirectoryGroupsPage.tsx +91 -39
- package/src/modules/admin/components/UserAccountsPage.tsx +271 -37
- package/src/modules/admin/components/group-members-path.ts +32 -0
- package/src/modules/admin/services/roles.api.ts +12 -1
- package/src/modules/audit/__tests__/AuditLogPage.test.tsx +312 -0
- package/src/modules/audit/components/AuditEventsPanel.tsx +319 -0
- package/src/modules/audit/components/AuditLogPage.tsx +373 -0
- package/src/modules/audit/components/principal-grouping.ts +49 -0
- package/src/modules/audit/services/audit.api.ts +98 -0
- 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 +7 -6
- package/src/modules/settings/services/github-facade.api.ts +23 -0
- package/src/modules/settings/settings-nav-items.tsx +13 -3
- 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 +532 -43
- package/src/modules/setup/hooks/useSetupStatus.ts +93 -0
- package/src/modules/setup/services/setup.api.ts +141 -4
- 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 +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 +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 +172 -46
- 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 +2533 -129
- package/src/modules/workspace/components/__tests__/FileRoute.test.tsx +731 -18
- package/src/modules/workspace/components/__tests__/FileViewer.test.tsx +381 -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 +134 -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,13 +1,13 @@
|
|
|
1
1
|
import { useCallback, useRef, useState } from 'react';
|
|
2
|
-
import { Link2, Plus, Trash2,
|
|
2
|
+
import { Link2, Plus, Trash2, Pencil } from 'lucide-react';
|
|
3
3
|
import { cn } from '../../../lib/utils';
|
|
4
4
|
import {
|
|
5
|
-
Button,
|
|
6
5
|
IconButton,
|
|
7
6
|
MenuItem,
|
|
8
7
|
MenuPanel,
|
|
9
8
|
useDismissableMenu,
|
|
10
9
|
} from '../../../shared/components';
|
|
10
|
+
import { ShareButton } from './ShareButton';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* The three actions beside a place's title — the prototype's `spaceActs`
|
|
@@ -65,6 +65,12 @@ export interface PageActionsProps {
|
|
|
65
65
|
onRename?: () => void;
|
|
66
66
|
/** Names the thing, for the `+` tooltip and the accessible names. */
|
|
67
67
|
addLabel?: string;
|
|
68
|
+
/**
|
|
69
|
+
* What the delete item CALLS the act. A place is deleted as a plugin; the
|
|
70
|
+
* tool page reuses this menu, and an item there reading "Delete plugin"
|
|
71
|
+
* would name the wrong thing entirely.
|
|
72
|
+
*/
|
|
73
|
+
deleteLabel?: string;
|
|
68
74
|
}
|
|
69
75
|
|
|
70
76
|
export function PageActions({
|
|
@@ -74,6 +80,7 @@ export function PageActions({
|
|
|
74
80
|
onDelete,
|
|
75
81
|
onRename,
|
|
76
82
|
addLabel = 'Add a skill or tool',
|
|
83
|
+
deleteLabel = 'Delete plugin',
|
|
77
84
|
}: PageActionsProps) {
|
|
78
85
|
const [open, setOpen] = useState(false);
|
|
79
86
|
const [copied, setCopied] = useState<null | 'ok' | 'fail'>(null);
|
|
@@ -94,12 +101,7 @@ export function PageActions({
|
|
|
94
101
|
|
|
95
102
|
return (
|
|
96
103
|
<div className="relative flex flex-none items-center gap-1.5">
|
|
97
|
-
{onShare &&
|
|
98
|
-
<Button variant="outline" size="sm" onClick={onShare}>
|
|
99
|
-
<Users size={13} />
|
|
100
|
-
Share
|
|
101
|
-
</Button>
|
|
102
|
-
)}
|
|
104
|
+
{onShare && <ShareButton onClick={onShare} />}
|
|
103
105
|
|
|
104
106
|
{onAdd && (
|
|
105
107
|
<IconButton aria-label={addLabel} title={addLabel} onClick={onAdd}>
|
|
@@ -159,7 +161,7 @@ export function PageActions({
|
|
|
159
161
|
>
|
|
160
162
|
<span className="flex items-center gap-2.5">
|
|
161
163
|
<Trash2 size={14} />
|
|
162
|
-
|
|
164
|
+
{deleteLabel}
|
|
163
165
|
</span>
|
|
164
166
|
</MenuItem>
|
|
165
167
|
)}
|
|
@@ -3,13 +3,15 @@ import { ChangeRequestDialog } from '../../change-requests/components/ChangeRequ
|
|
|
3
3
|
import { useLibrary, type LibraryItem } from '../state/library-data';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* The review surface for a skill that does not exist yet.
|
|
6
|
+
* The review surface for a skill or a tool that does not exist yet.
|
|
7
7
|
*
|
|
8
|
-
* A released
|
|
9
|
-
* off the file they touch. A PROPOSED
|
|
10
|
-
* because there is
|
|
8
|
+
* A released item opens its own page, and the change requests against it hang
|
|
9
|
+
* off the file they touch. A PROPOSED one has neither — there is no page,
|
|
10
|
+
* because there is nothing on the default branch to build one from — so the
|
|
11
11
|
* card opens the change request itself, which is the whole of what there is to
|
|
12
|
-
* read and the only place the decision can be made.
|
|
12
|
+
* read and the only place the decision can be made. That is also what keeps a
|
|
13
|
+
* proposal from being OPENED AS THE THING: a tool page would try to probe a
|
|
14
|
+
* connection for a manual the catalog has never seen.
|
|
13
15
|
*
|
|
14
16
|
* `ChangeRequestDialog` needs no adapting for this: it always lists every file
|
|
15
17
|
* the request touches and diffs each against the default branch EXCEPT the
|
|
@@ -17,8 +19,13 @@ import { useLibrary, type LibraryItem } from '../state/library-data';
|
|
|
17
19
|
* the proposal as one green document and its Apply button records the
|
|
18
20
|
* approvals and merges. No scope either — a scope only ADDS a surface's
|
|
19
21
|
* released files to the list, and a proposal has none by definition.
|
|
22
|
+
*
|
|
23
|
+
* A proposed MCP SERVER is the one case whose file is not wholly new: the
|
|
24
|
+
* server is a key added to a plugin's `mcp.json`, which may already exist. The
|
|
25
|
+
* dialog handles that as it handles any other edit — the diff against the
|
|
26
|
+
* default branch — so the reader sees the added entry in its context.
|
|
20
27
|
*/
|
|
21
|
-
export function
|
|
28
|
+
export function PendingItemReview({
|
|
22
29
|
item,
|
|
23
30
|
onClose,
|
|
24
31
|
onResolved,
|
|
@@ -49,7 +56,7 @@ function standInFor(
|
|
|
49
56
|
): PullRequestSummary {
|
|
50
57
|
return {
|
|
51
58
|
number: pending.changeRequestNumber,
|
|
52
|
-
title: `New skill: ${item.name}`,
|
|
59
|
+
title: `New ${item.kind === 'skill' ? 'skill' : 'tool'}: ${item.name}`,
|
|
53
60
|
author: { login: '', name: pending.authorName },
|
|
54
61
|
appAuthor: { name: pending.authorName },
|
|
55
62
|
branch: pending.branch,
|
|
@@ -1,6 +1,8 @@
|
|
|
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 { AddDialogTabs, type AddKind } from './AddDialogTabs';
|
|
4
6
|
import { useLibraryToast } from '../state/toast.context';
|
|
5
7
|
import { COPIED_TOAST, COPY_FAILED_TOAST, copyToClipboard } from '../utils/clipboard';
|
|
6
8
|
|
|
@@ -29,33 +31,28 @@ export interface PersonalAddDialogProps {
|
|
|
29
31
|
* first write. The folder's seeded access.md names you as its owner, so the
|
|
30
32
|
* write that follows passes the ordinary gate on its own merits — no
|
|
31
33
|
* permission special-case anywhere in this flow.
|
|
34
|
+
*
|
|
35
|
+
* Skills and tools are separate tabs, as in `AddToPluginDialog`: the Tools tab
|
|
36
|
+
* explains (a prompt, an MCP server, a `.tool` manual) rather than creates.
|
|
32
37
|
*/
|
|
33
38
|
export function PersonalAddDialog({ name, existingSkills, onClose }: PersonalAddDialogProps) {
|
|
34
39
|
const { isAdmin } = useAdmin();
|
|
35
40
|
const toast = useLibraryToast();
|
|
36
|
-
const
|
|
41
|
+
const [kind, setKind] = useState<AddKind>('skills');
|
|
42
|
+
const skillPrompt = `Help me build a new skill or tool at Bevel. Keep it to myself for now. It goes in my own list, not a plugin.`;
|
|
43
|
+
const toolPrompt = `Help me build a new tool at Bevel. Keep it to myself for now. It goes in my own list, not a plugin.`;
|
|
37
44
|
|
|
38
45
|
async function copyPrompt() {
|
|
46
|
+
const prompt = kind === 'tools' ? toolPrompt : skillPrompt;
|
|
39
47
|
const copied = await copyToClipboard(prompt);
|
|
40
48
|
toast(copied ? COPIED_TOAST : COPY_FAILED_TOAST, copied ? 'neutral' : 'danger');
|
|
41
49
|
}
|
|
42
50
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
footer={
|
|
49
|
-
<>
|
|
50
|
-
<Button variant="quiet" onClick={onClose}>
|
|
51
|
-
Close
|
|
52
|
-
</Button>
|
|
53
|
-
<Button variant="primary" onClick={() => void copyPrompt()}>
|
|
54
|
-
Copy prompt
|
|
55
|
-
</Button>
|
|
56
|
-
</>
|
|
57
|
-
}
|
|
58
|
-
>
|
|
51
|
+
// Both panels stay mounted (see `AddDialogTabs`): the Skills half holds the
|
|
52
|
+
// new-skill name an admin may already have typed, and a tab click is not a
|
|
53
|
+
// reason to lose it.
|
|
54
|
+
const skillsPanel = (
|
|
55
|
+
<>
|
|
59
56
|
<p className="text-ui text-ink-muted">
|
|
60
57
|
{`It lands in ${name}. Yours alone until you add it to a plugin.`}
|
|
61
58
|
</p>
|
|
@@ -81,8 +78,61 @@ export function PersonalAddDialog({ name, existingSkills, onClose }: PersonalAdd
|
|
|
81
78
|
</p>
|
|
82
79
|
|
|
83
80
|
<Surface tone="sunken" radius="md" elevation="none" padded className="mt-2.5">
|
|
84
|
-
<p className="font-mono text-detail text-ink">{
|
|
81
|
+
<p className="font-mono text-detail text-ink">{skillPrompt}</p>
|
|
82
|
+
</Surface>
|
|
83
|
+
</>
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
const toolsPanel = (
|
|
87
|
+
<>
|
|
88
|
+
{/* The same note as the Skills tab: your own folder has no other
|
|
89
|
+
owner, so there is no change request to mention. */}
|
|
90
|
+
<p className="text-ui text-ink-muted">
|
|
91
|
+
{`It lands in ${name}. Yours alone until you add it to a plugin.`}
|
|
92
|
+
</p>
|
|
93
|
+
|
|
94
|
+
<p className="mt-3 text-ui text-ink-muted">
|
|
95
|
+
Tell your agent what the tool should do. It drafts the tool and puts it here.
|
|
96
|
+
</p>
|
|
97
|
+
|
|
98
|
+
<Surface tone="sunken" radius="md" elevation="none" padded className="mt-2.5">
|
|
99
|
+
<p className="font-mono text-detail text-ink">{toolPrompt}</p>
|
|
85
100
|
</Surface>
|
|
101
|
+
|
|
102
|
+
{/* A personal folder is an ordinary plugin folder on disk, so it uses the
|
|
103
|
+
same two locations as any other: `mcp.json` at its root, `.tool`
|
|
104
|
+
manuals under the reverse-DNS extension directory. */}
|
|
105
|
+
<p className="mt-3.5 text-ui text-ink-muted">
|
|
106
|
+
To connect an MCP server, add it to the mcp.json in your own folder.
|
|
107
|
+
</p>
|
|
108
|
+
<p className="mt-2 text-ui text-ink-muted">
|
|
109
|
+
To call an API without an MCP server, add a .tool manual describing it under
|
|
110
|
+
software.bevel.hexis/tools/ in your own folder.
|
|
111
|
+
</p>
|
|
112
|
+
</>
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
return (
|
|
116
|
+
<Dialog
|
|
117
|
+
open
|
|
118
|
+
onClose={onClose}
|
|
119
|
+
title="Add a skill or tool"
|
|
120
|
+
footer={
|
|
121
|
+
<>
|
|
122
|
+
<Button variant="quiet" onClick={onClose}>
|
|
123
|
+
Close
|
|
124
|
+
</Button>
|
|
125
|
+
<Button variant="primary" onClick={() => void copyPrompt()}>
|
|
126
|
+
Copy prompt
|
|
127
|
+
</Button>
|
|
128
|
+
</>
|
|
129
|
+
}
|
|
130
|
+
>
|
|
131
|
+
<AddDialogTabs
|
|
132
|
+
selected={kind}
|
|
133
|
+
onSelect={setKind}
|
|
134
|
+
panels={{ skills: skillsPanel, tools: toolsPanel }}
|
|
135
|
+
/>
|
|
86
136
|
</Dialog>
|
|
87
137
|
);
|
|
88
138
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useMemo, useState } from 'react';
|
|
2
|
+
import { DEFAULT_BRANCH, type FileTreeEntry } from '@bevel-software/platform-shared';
|
|
2
3
|
import { isUngrouped } from '../utils/status';
|
|
3
4
|
import { useNavigate } from 'react-router-dom';
|
|
4
|
-
import { useAuth } from '../../auth/state/auth.context';
|
|
5
5
|
import { useLibrary, type LibraryItem } from '../state/library-data';
|
|
6
6
|
import { useLibraryToast } from '../state/toast.context';
|
|
7
7
|
import { urlForLibraryItem } from '../routes/library-paths';
|
|
@@ -11,7 +11,11 @@ import { EmptySkillsNudge, PluginBreadcrumb, PluginItemSections, PageNote,
|
|
|
11
11
|
RemoveLibraryItemDialog,
|
|
12
12
|
} from './plugin-page-parts';
|
|
13
13
|
import { PageActions } from './PageActions';
|
|
14
|
+
import { PendingItemReview } from './PendingItemReview';
|
|
15
|
+
import { cn } from '../../../lib/utils';
|
|
16
|
+
import { HEADER_BAND, PAGE_HEADER_TESTID } from '../../../shared/theme/header';
|
|
14
17
|
import { PersonalAddDialog } from './PersonalAddDialog';
|
|
18
|
+
import { ManageAccessDialog } from '../../access/components/ManageAccessDialog';
|
|
15
19
|
import { copyToClipboard } from '../utils/clipboard';
|
|
16
20
|
|
|
17
21
|
/**
|
|
@@ -27,26 +31,44 @@ import { copyToClipboard } from '../utils/clipboard';
|
|
|
27
31
|
* kind of thing — with ONE exception, and it is a real one rather than a
|
|
28
32
|
* decision:
|
|
29
33
|
*
|
|
30
|
-
* - no Share. Every other action here is a client-side
|
|
31
|
-
* needs a folder to write an `access.md` into, and
|
|
32
|
-
* the items in NO folder. There is nothing to point
|
|
33
|
-
* prototype can share its personal list because there it
|
|
34
|
-
* record (`mine:<uid>`, proto:2265); the platform has no
|
|
35
|
-
* Share button that opens an editor over nothing is
|
|
36
|
-
* Giving a person's own items a home folder is a
|
|
37
|
-
* that exists this stays absent.
|
|
34
|
+
* - no Share IN THE TITLE ROW. Every other action here is a client-side
|
|
35
|
+
* affordance, but sharing needs a folder to write an `access.md` into, and
|
|
36
|
+
* this page is defined as the items in NO folder. There is nothing to point
|
|
37
|
+
* the dialog at. The prototype can share its personal list because there it
|
|
38
|
+
* is a real space record (`mine:<uid>`, proto:2265); the platform has no
|
|
39
|
+
* such object, and a Share button that opens an editor over nothing is
|
|
40
|
+
* worse than no button. Giving a person's own items a home folder is a
|
|
41
|
+
* backend change, and until that exists this stays absent.
|
|
42
|
+
*
|
|
43
|
+
* That absence is about the SPACE, not about what is in it. A skill here is
|
|
44
|
+
* still a folder of its own with its own rules — which is exactly the
|
|
45
|
+
* standalone skill the skill page offers Share for — so each skill CARD
|
|
46
|
+
* carries the same `…` menu it carries everywhere else, pointed at its own
|
|
47
|
+
* folder. Only the page has nothing to share; the skills on it do.
|
|
38
48
|
*/
|
|
39
49
|
export function PersonalPluginPage() {
|
|
40
50
|
const data = useLibrary();
|
|
41
51
|
const navigate = useNavigate();
|
|
42
52
|
const { kbDirName } = useWorkspace();
|
|
43
|
-
const { user } = useAuth();
|
|
44
53
|
const [addOpen, setAddOpen] = useState(false);
|
|
45
54
|
const toast = useLibraryToast();
|
|
46
55
|
/** The card being removed, while its confirm dialog is up. */
|
|
47
56
|
const [removing, setRemoving] = useState<LibraryItem | null>(null);
|
|
57
|
+
/**
|
|
58
|
+
* Which folder the access dialog is open on — set only by a card's Share,
|
|
59
|
+
* since the page itself has no folder to share. Held as the dialog's own
|
|
60
|
+
* entry, exactly as the gallery and the skill page hold it, so retargeting
|
|
61
|
+
* at an ancestor is the setter itself.
|
|
62
|
+
*/
|
|
63
|
+
const [manageTarget, setManageTarget] = useState<FileTreeEntry | null>(null);
|
|
64
|
+
/**
|
|
65
|
+
* The proposal whose change request is open in the review dialog — the same
|
|
66
|
+
* arrangement the gallery and the plugin page hold it in, so a Proposed card
|
|
67
|
+
* behaves identically on all three.
|
|
68
|
+
*/
|
|
69
|
+
const [reviewing, setReviewing] = useState<LibraryItem | null>(null);
|
|
48
70
|
|
|
49
|
-
const name = personalPluginName(
|
|
71
|
+
const name = personalPluginName();
|
|
50
72
|
const items = useMemo(() => data.items.filter(isUngrouped), [data.items]);
|
|
51
73
|
/**
|
|
52
74
|
* For the add dialog's name check. Every skill, not only the ungrouped ones:
|
|
@@ -60,8 +82,23 @@ export function PersonalPluginPage() {
|
|
|
60
82
|
const skillItems = items.filter((i) => i.kind === 'skill');
|
|
61
83
|
const toolItems = items.filter((i) => i.kind === 'integration');
|
|
62
84
|
|
|
63
|
-
/**
|
|
85
|
+
/**
|
|
86
|
+
* Identical to the gallery's and the plugin page's — one behaviour per card,
|
|
87
|
+
* wherever you clicked it.
|
|
88
|
+
*
|
|
89
|
+
* A PROPOSAL has no page to navigate to (its file is on a change request's
|
|
90
|
+
* branch, and every item page reads the default branch), so it opens its
|
|
91
|
+
* change request instead — the only thing there is to read about it. This
|
|
92
|
+
* page is no exception: a proposal reaches an ungrouped card when its
|
|
93
|
+
* declaration sits in no plugin folder, and the card itself says whether it
|
|
94
|
+
* is waiting on YOU. A card that names the reader as the reviewer and then
|
|
95
|
+
* does nothing when clicked is the one arrangement that cannot be right.
|
|
96
|
+
*/
|
|
64
97
|
function openItem(item: LibraryItem) {
|
|
98
|
+
if (item.pending) {
|
|
99
|
+
setReviewing(item);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
65
102
|
if (kbDirName) navigate(urlForLibraryItem(kbDirName, item));
|
|
66
103
|
}
|
|
67
104
|
|
|
@@ -71,16 +108,26 @@ export function PersonalPluginPage() {
|
|
|
71
108
|
|
|
72
109
|
return (
|
|
73
110
|
<div className="pb-14">
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
111
|
+
{/* The same title row every plugin page has — the shared header band,
|
|
112
|
+
the height the sidebar's header row is, and the page's FIRST row:
|
|
113
|
+
the breadcrumb rides on the band, because a crumb row above it would
|
|
114
|
+
push the title bar off the line the sidebar's header row holds. The
|
|
115
|
+
description line that used to sit under it is gone: "Only you see
|
|
116
|
+
this" is what the page's own name already says, and a subtitle
|
|
117
|
+
explaining a heading is the heading admitting it did not work
|
|
118
|
+
(proto: the personal list carries no lede). */}
|
|
119
|
+
<div data-testid={PAGE_HEADER_TESTID} className={cn(HEADER_BAND, 'justify-between gap-4')}>
|
|
120
|
+
{/* Clipped, and allowed to take the row's shortfall, for the reason
|
|
121
|
+
the plugin page's is — the trail is a fixed width, so a group that
|
|
122
|
+
could only shrink would run its content across the actions beside
|
|
123
|
+
it on a narrow viewport. */}
|
|
124
|
+
<div className="flex min-w-0 flex-1 items-center gap-2 overflow-hidden">
|
|
125
|
+
<PluginBreadcrumb />
|
|
126
|
+
<h1 className="min-w-0 truncate text-display font-semibold" title={name}>
|
|
127
|
+
{name}
|
|
128
|
+
</h1>
|
|
129
|
+
</div>
|
|
130
|
+
<div className="flex-none">
|
|
84
131
|
<PageActions
|
|
85
132
|
onAdd={() => setAddOpen(true)}
|
|
86
133
|
onCopyLink={() => copyToClipboard(window.location.href)}
|
|
@@ -93,6 +140,17 @@ export function PersonalPluginPage() {
|
|
|
93
140
|
skillItems={skillItems}
|
|
94
141
|
toolItems={toolItems}
|
|
95
142
|
onOpen={openItem}
|
|
143
|
+
// The skill's own folder, not the space's — see the page's docstring.
|
|
144
|
+
onShare={
|
|
145
|
+
kbDirName
|
|
146
|
+
? (item) =>
|
|
147
|
+
setManageTarget({
|
|
148
|
+
name: item.path.split('/').pop() ?? item.path,
|
|
149
|
+
relativePath: `${kbDirName}/${item.path}`,
|
|
150
|
+
type: 'directory',
|
|
151
|
+
})
|
|
152
|
+
: undefined
|
|
153
|
+
}
|
|
96
154
|
// Your own space: everything here is yours to remove — the backend's
|
|
97
155
|
// per-path gate agrees, since your personal folder names you as owner.
|
|
98
156
|
onRemove={setRemoving}
|
|
@@ -120,6 +178,47 @@ export function PersonalPluginPage() {
|
|
|
120
178
|
/>
|
|
121
179
|
)}
|
|
122
180
|
|
|
181
|
+
{/* The same dialog the plugin page opens, on a skill's folder instead of
|
|
182
|
+
a plugin's. `kbDirName` gates the OPENER because the resolver
|
|
183
|
+
addresses files repo-relative and the dialog strips that prefix. */}
|
|
184
|
+
{manageTarget && (
|
|
185
|
+
<ManageAccessDialog
|
|
186
|
+
// Keyed on the path, so retargeting at an ancestor remounts it
|
|
187
|
+
// against that folder — the gallery's arrangement exactly.
|
|
188
|
+
key={manageTarget.relativePath}
|
|
189
|
+
// The Library speaks the DEFAULT branch: these cards list what is on
|
|
190
|
+
// it, so the rules they share are edited where they were read,
|
|
191
|
+
// whatever branch the ambient workspace happens to be on. Same choice
|
|
192
|
+
// the skill page's Share and the gallery's make.
|
|
193
|
+
workspaceId={encodeURIComponent(DEFAULT_BRANCH)}
|
|
194
|
+
entry={manageTarget}
|
|
195
|
+
// A personal skill's grant is usually its own, but one inherited from
|
|
196
|
+
// a folder above it is managed where it lives — the skill page's
|
|
197
|
+
// `Manage <Folder> →`, which a card's Share must offer too or the
|
|
198
|
+
// inherited grant is read-only here and editable there.
|
|
199
|
+
onManageAncestor={setManageTarget}
|
|
200
|
+
onClose={() => {
|
|
201
|
+
setManageTarget(null);
|
|
202
|
+
// A grant can change who sees the skill — and whether it is still
|
|
203
|
+
// in no plugin at all — so the catalog is re-read.
|
|
204
|
+
data.reload();
|
|
205
|
+
}}
|
|
206
|
+
/>
|
|
207
|
+
)}
|
|
208
|
+
|
|
209
|
+
{reviewing && (
|
|
210
|
+
<PendingItemReview
|
|
211
|
+
item={reviewing}
|
|
212
|
+
onClose={() => setReviewing(null)}
|
|
213
|
+
onResolved={() => {
|
|
214
|
+
setReviewing(null);
|
|
215
|
+
// One reload moves it off the review shelf and into the catalog —
|
|
216
|
+
// where, once merged, it is a released item of your own.
|
|
217
|
+
data.reload();
|
|
218
|
+
}}
|
|
219
|
+
/>
|
|
220
|
+
)}
|
|
221
|
+
|
|
123
222
|
{removing && (
|
|
124
223
|
<RemoveLibraryItemDialog
|
|
125
224
|
item={removing}
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react';
|
|
1
|
+
import { useEffect, useId, useState } from 'react';
|
|
2
2
|
import { useNavigate } from 'react-router-dom';
|
|
3
|
-
import {
|
|
3
|
+
import { ChevronRight } from 'lucide-react';
|
|
4
|
+
import { DEFAULT_BRANCH, PLUGINS_DIR, PLUGIN_MANIFEST_FILE, type FileTreeEntry } from '@bevel-software/platform-shared';
|
|
5
|
+
import { cn } from '../../../lib/utils';
|
|
4
6
|
import { Button } from '../../../shared/components';
|
|
5
|
-
import { listFiles } from '../../workspace/services/workspace.api';
|
|
7
|
+
import { listFiles, readFile } from '../../workspace/services/workspace.api';
|
|
6
8
|
import { useWorkspace } from '../../workspace/state/workspace.context';
|
|
7
|
-
import {
|
|
9
|
+
import { checkoutRoot } from '../../workspace/utils/fileTree';
|
|
8
10
|
import { kbFileUrl } from '../../workspace/routing/kb-routes';
|
|
9
11
|
|
|
10
12
|
/**
|
|
11
13
|
* The plugin page's two smallest sections, both pure REUSE of the Knowledge
|
|
12
|
-
*
|
|
13
|
-
* editor the tool page's "Edit the tool file" uses —
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* the
|
|
14
|
+
* file viewer: links are `kbFileUrl` + `rawFile` navigations into the same
|
|
15
|
+
* raw editor the tool page's "Edit the tool file" uses — rendered inside
|
|
16
|
+
* this app by `WorkspaceItemRoute`; no new viewer, no new backend. The one
|
|
17
|
+
* exception is a `.tool` file in a namespace listing, which drops the
|
|
18
|
+
* `rawFile` state so the item route renders its library tool page — the
|
|
19
|
+
* same destination its card in the Tools band reaches.
|
|
17
20
|
*
|
|
18
21
|
* MANIFEST: writers get a button to `plugin.json`. It is a button to the FILE,
|
|
19
22
|
* not a form, deliberately: the fields worth hand-editing (`version`,
|
|
@@ -58,6 +61,122 @@ export function ManifestButton({
|
|
|
58
61
|
);
|
|
59
62
|
}
|
|
60
63
|
|
|
64
|
+
/** The bundle dialect's manifest — read-only here; the file is edited in its own repository. */
|
|
65
|
+
const BUNDLE_MANIFEST_FILE = 'plugin.bundle.json';
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* The manifest's CONTENTS, at the bottom of the plugin page, behind a
|
|
69
|
+
* disclosure: closed, it is one line naming the file; open, it is the file —
|
|
70
|
+
* what the plugin declares (its identifier, version, the skills it links,
|
|
71
|
+
* the servers it declares) shown as the JSON it is, pretty-printed when it
|
|
72
|
+
* parses and verbatim when it does not. Read only when opened, so a page
|
|
73
|
+
* view costs no request for a section most visits never expand. A writer
|
|
74
|
+
* gets the way to the raw editor from here too.
|
|
75
|
+
*/
|
|
76
|
+
export function ManifestSection({
|
|
77
|
+
kbDirName,
|
|
78
|
+
folder,
|
|
79
|
+
managed,
|
|
80
|
+
canWrite,
|
|
81
|
+
}: {
|
|
82
|
+
kbDirName: string | null;
|
|
83
|
+
folder: string;
|
|
84
|
+
/** A native manifest (`plugin.json`); false for the bundle dialect's file. */
|
|
85
|
+
managed: boolean;
|
|
86
|
+
canWrite: boolean;
|
|
87
|
+
}) {
|
|
88
|
+
const workspaceId = encodeURIComponent(DEFAULT_BRANCH);
|
|
89
|
+
const navigate = useNavigate();
|
|
90
|
+
const panelId = useId();
|
|
91
|
+
const file = managed ? PLUGIN_MANIFEST_FILE : BUNDLE_MANIFEST_FILE;
|
|
92
|
+
const path = kbDirName ? `${kbDirName}/${PLUGINS_DIR}/${folder}/${file}` : null;
|
|
93
|
+
const [open, setOpen] = useState(false);
|
|
94
|
+
// What was read, KEYED BY THE PATH it was read from: a folder change shows
|
|
95
|
+
// nothing of the previous plugin's file while the new read is in flight,
|
|
96
|
+
// with no reset to write — a result for another path is simply not this one.
|
|
97
|
+
const [loaded, setLoaded] = useState<{ path: string; text: string | null; failed: boolean } | null>(null);
|
|
98
|
+
const current = loaded?.path === path ? loaded : null;
|
|
99
|
+
|
|
100
|
+
useEffect(() => {
|
|
101
|
+
if (!open || path === null) return;
|
|
102
|
+
let live = true;
|
|
103
|
+
readFile(workspaceId, path)
|
|
104
|
+
.then((text) => {
|
|
105
|
+
if (live) setLoaded({ path, text, failed: false });
|
|
106
|
+
})
|
|
107
|
+
.catch(() => {
|
|
108
|
+
if (live) setLoaded({ path, text: null, failed: true });
|
|
109
|
+
});
|
|
110
|
+
return () => {
|
|
111
|
+
live = false;
|
|
112
|
+
};
|
|
113
|
+
}, [open, workspaceId, path]);
|
|
114
|
+
|
|
115
|
+
if (path === null) return null;
|
|
116
|
+
|
|
117
|
+
return (
|
|
118
|
+
<section className="mt-8">
|
|
119
|
+
<button
|
|
120
|
+
type="button"
|
|
121
|
+
onClick={() => setOpen((o) => !o)}
|
|
122
|
+
aria-expanded={open}
|
|
123
|
+
aria-controls={panelId}
|
|
124
|
+
className="flex items-center gap-[7px] text-label font-semibold uppercase text-ink-faint transition-colors hover:text-ink"
|
|
125
|
+
>
|
|
126
|
+
<span className="flex w-3 flex-none items-center justify-center">
|
|
127
|
+
<ChevronRight size={11} className={cn('transition-transform duration-150', open && 'rotate-90')} />
|
|
128
|
+
</span>
|
|
129
|
+
Manifest
|
|
130
|
+
<span className="font-mono normal-case tracking-normal text-ink-faint">{file}</span>
|
|
131
|
+
</button>
|
|
132
|
+
{/* The panel is always in the tree, so the button's `aria-controls`
|
|
133
|
+
names an element that exists; only its CONTENT waits for `open`
|
|
134
|
+
(and so does the read behind it). */}
|
|
135
|
+
<div id={panelId} className={open ? 'mt-2.5' : undefined}>
|
|
136
|
+
{open && (
|
|
137
|
+
<>
|
|
138
|
+
<p className="mb-2 max-w-[62ch] text-detail text-ink-muted">
|
|
139
|
+
What the plugin declares: its identifier and version, the skills it links and the
|
|
140
|
+
servers it names.{' '}
|
|
141
|
+
{managed
|
|
142
|
+
? 'The extensions block is written by the platform; the rest is yours to edit.'
|
|
143
|
+
: 'Read from the bundle format; it is edited in its own repository.'}
|
|
144
|
+
</p>
|
|
145
|
+
{current?.failed ? (
|
|
146
|
+
<p className="text-detail text-ink-muted">Couldn't read {file}.</p>
|
|
147
|
+
) : current?.text == null ? (
|
|
148
|
+
<p className="text-detail text-ink-faint">Loading…</p>
|
|
149
|
+
) : (
|
|
150
|
+
<pre className="overflow-x-auto rounded-md border border-line bg-sunken px-3.5 py-2.5 font-mono text-detail text-ink">
|
|
151
|
+
{prettyJson(current.text)}
|
|
152
|
+
</pre>
|
|
153
|
+
)}
|
|
154
|
+
{canWrite && managed && (
|
|
155
|
+
<Button
|
|
156
|
+
variant="quiet"
|
|
157
|
+
size="sm"
|
|
158
|
+
className="mt-2"
|
|
159
|
+
onClick={() => navigate(kbFileUrl(DEFAULT_BRANCH, path), { state: { rawFile: true } })}
|
|
160
|
+
>
|
|
161
|
+
Edit the manifest
|
|
162
|
+
</Button>
|
|
163
|
+
)}
|
|
164
|
+
</>
|
|
165
|
+
)}
|
|
166
|
+
</div>
|
|
167
|
+
</section>
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/** The file as JSON, laid out — or as written, when it is not JSON. */
|
|
172
|
+
function prettyJson(text: string): string {
|
|
173
|
+
try {
|
|
174
|
+
return JSON.stringify(JSON.parse(text), null, 2);
|
|
175
|
+
} catch {
|
|
176
|
+
return text;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
61
180
|
interface NamespaceListing {
|
|
62
181
|
namespace: string;
|
|
63
182
|
files: string[]; // plugin-relative, e.g. `com.example.client/hooks/on-save.js`
|
|
@@ -97,13 +216,13 @@ export function ClientExtensionsSection({
|
|
|
97
216
|
setListings([]);
|
|
98
217
|
if (!kbDirName) return;
|
|
99
218
|
if (reusableTree) {
|
|
100
|
-
setListings(namespaceListings(reusableTree, folder));
|
|
219
|
+
setListings(namespaceListings(reusableTree, kbDirName, folder));
|
|
101
220
|
return;
|
|
102
221
|
}
|
|
103
222
|
let live = true;
|
|
104
223
|
listFiles(workspaceId)
|
|
105
224
|
.then((tree) => {
|
|
106
|
-
if (live) setListings(namespaceListings(tree, folder));
|
|
225
|
+
if (live) setListings(namespaceListings(tree, kbDirName, folder));
|
|
107
226
|
})
|
|
108
227
|
.catch(() => {
|
|
109
228
|
/* the section renders nothing — a tree fetch failure is not this page's story */
|
|
@@ -158,13 +277,17 @@ export function ClientExtensionsSection({
|
|
|
158
277
|
|
|
159
278
|
/**
|
|
160
279
|
* Walk the (already-loaded, ACL-filtered) tree down to this plugin's namespace
|
|
161
|
-
* dirs. Through `
|
|
162
|
-
* fileTree
|
|
163
|
-
*
|
|
164
|
-
*
|
|
280
|
+
* dirs. Through `checkoutRoot`, the one way anything here reaches into the
|
|
281
|
+
* repository: the fileTree roots at the workspace and carries the checkout as
|
|
282
|
+
* its `<kbDirName>/` child, and a `Plugins/` anywhere else in the workspace
|
|
283
|
+
* is not this deployment's.
|
|
165
284
|
*/
|
|
166
|
-
function namespaceListings(
|
|
167
|
-
|
|
285
|
+
function namespaceListings(
|
|
286
|
+
tree: FileTreeEntry,
|
|
287
|
+
kbDirName: string,
|
|
288
|
+
folder: string,
|
|
289
|
+
): NamespaceListing[] {
|
|
290
|
+
const kbRoot = checkoutRoot(tree, kbDirName);
|
|
168
291
|
// `folder` is the path below the plugins root — one segment for a top-level
|
|
169
292
|
// plugin, several for a nested one — and the tree is walked a segment at a time.
|
|
170
293
|
const pluginDir = kbRoot ? descend(kbRoot, [PLUGINS_DIR, ...folder.split('/')]) : null;
|