@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,31 +1,46 @@
|
|
|
1
1
|
import { useCallback, useEffect, useId, useMemo, useRef, useState, type ReactNode } from 'react';
|
|
2
2
|
import { useLocation, useNavigate, useParams } from 'react-router-dom';
|
|
3
|
+
import { cn } from '../../../../lib/utils';
|
|
4
|
+
import { HEADER_BAND, HEADER_BAND_LEAD, PAGE_HEADER_TESTID } from '../../../../shared/theme/header';
|
|
3
5
|
import { ArrowLeft, History } from 'lucide-react';
|
|
4
6
|
import {
|
|
5
7
|
DEFAULT_BRANCH,
|
|
8
|
+
type FileTreeEntry,
|
|
6
9
|
type PullRequestSummary,
|
|
7
10
|
} from '@bevel-software/platform-shared';
|
|
8
11
|
import '../../library.css';
|
|
9
12
|
import {
|
|
10
13
|
Badge,
|
|
14
|
+
Banner,
|
|
11
15
|
Button,
|
|
12
16
|
IconButton,
|
|
13
|
-
MenuItem,
|
|
14
|
-
MenuPanel,
|
|
15
17
|
Surface,
|
|
16
|
-
|
|
18
|
+
useFocusHandoff,
|
|
17
19
|
} from '../../../../shared/components';
|
|
18
20
|
import { useAuth } from '../../../auth/state/auth.context';
|
|
19
21
|
import { useWorkspace } from '../../../workspace/state/workspace.context';
|
|
20
22
|
import { useGit } from '../../../git/state/git.context';
|
|
21
23
|
import { FileHistoryPanel } from '../../../git/components/FileHistoryPanel';
|
|
22
|
-
import {
|
|
24
|
+
import {
|
|
25
|
+
kbFileUrl,
|
|
26
|
+
openExternalHref,
|
|
27
|
+
resolveKbHref,
|
|
28
|
+
useNodeIdNav,
|
|
29
|
+
} from '../../../workspace/routing/kb-routes';
|
|
30
|
+
import { useWorkspaceImageResolver } from '../../../workspace/hooks/useWorkspaceImageResolver';
|
|
23
31
|
import { cancelPullRequest } from '../../../pr/services/pr-cancel.api';
|
|
24
32
|
import { useFileAccess } from '../../../access/hooks/useFileAccess';
|
|
25
33
|
import { proposeChange, suggestionBranchFor } from '../../services/library.api';
|
|
26
|
-
import {
|
|
34
|
+
import {
|
|
35
|
+
getOrCreateWorkspace,
|
|
36
|
+
writeFile,
|
|
37
|
+
type SkillToolWarning,
|
|
38
|
+
} from '../../../workspace/services/workspace.api';
|
|
27
39
|
import { useSkillDetail } from '../../hooks/useSkillDetail';
|
|
28
|
-
import {
|
|
40
|
+
import {
|
|
41
|
+
refusalLine,
|
|
42
|
+
useApplyChangeRequest,
|
|
43
|
+
} from '../../../change-requests/hooks/useApplyChangeRequest';
|
|
29
44
|
import { useCrFileDiffs } from '../../../change-requests/hooks/useCrFileDiffs';
|
|
30
45
|
import { useDefaultBranchFile, useFileOnBranch } from '../../../change-requests/hooks/useFileOnBranch';
|
|
31
46
|
import { useLibrary } from '../../state/library-data';
|
|
@@ -40,6 +55,8 @@ import { AccessRequestsBanner } from '../AccessRequestsBanner';
|
|
|
40
55
|
import { useJoinRequests, type JoinRequestsApi } from '../../hooks/useJoinRequests';
|
|
41
56
|
import { listSkillAccessRequests, reconcileSkillAccessRequest } from '../../services/library.api';
|
|
42
57
|
import { ManageAccessDialog } from '../../../access/components/ManageAccessDialog';
|
|
58
|
+
import { offersManageAccess } from '../../../access/manage-access-affordance';
|
|
59
|
+
import { ShareButton } from '../ShareButton';
|
|
43
60
|
import { ChangeRequestDock } from '../ChangeRequestDock';
|
|
44
61
|
import { ChangeRequestDialog } from '../../../change-requests/components/ChangeRequestDialog';
|
|
45
62
|
import { SkillFileTabs } from './SkillFileTabs';
|
|
@@ -107,7 +124,7 @@ export function SkillPage({
|
|
|
107
124
|
const selected = activeFile ?? selectedState;
|
|
108
125
|
const [compareCr, setCompareCr] = useState<PullRequestSummary | null>(null);
|
|
109
126
|
/**
|
|
110
|
-
* The
|
|
127
|
+
* The clock-arrow's destination: the git log for the file on screen,
|
|
111
128
|
* rendered in place of the reading pane. Local state rather than a URL,
|
|
112
129
|
* matching the Knowledge viewer's `activeTab` — a skill's canonical address
|
|
113
130
|
* names the FILE, and history is a lens on it, not a different file.
|
|
@@ -116,25 +133,20 @@ export function SkillPage({
|
|
|
116
133
|
* matter of taste.
|
|
117
134
|
*/
|
|
118
135
|
const [historyOpen, setHistoryOpen] = useState(false);
|
|
119
|
-
const [menuOpen, setMenuOpen] = useState(false);
|
|
120
|
-
const menuTriggerRef = useRef<HTMLButtonElement>(null);
|
|
121
|
-
const closeMenu = useCallback(() => setMenuOpen(false), []);
|
|
122
|
-
const menuRef = useDismissableMenu<HTMLDivElement>({
|
|
123
|
-
open: menuOpen,
|
|
124
|
-
onClose: closeMenu,
|
|
125
|
-
returnFocusTo: menuTriggerRef,
|
|
126
|
-
});
|
|
127
136
|
/** Ties the tabs to the panel they control; unique per mounted page. */
|
|
128
137
|
const tabsId = useId();
|
|
129
138
|
const git = useGit();
|
|
130
139
|
|
|
131
|
-
// Ownership
|
|
132
|
-
//
|
|
133
|
-
//
|
|
134
|
-
|
|
135
|
-
|
|
140
|
+
// Ownership and write are properties of the CATALOG entry, not of the skill
|
|
141
|
+
// document — the provider already resolved both, so the page reads them
|
|
142
|
+
// rather than asking again. `owned` is the pill alone; every editor-side
|
|
143
|
+
// affordance goes by `canWrite`, which a writer holds without owning.
|
|
144
|
+
const entry = useMemo(
|
|
145
|
+
() => data.items.find((i) => i.kind === 'skill' && i.id === name),
|
|
136
146
|
[data.items, name],
|
|
137
147
|
);
|
|
148
|
+
const owned = entry?.owned === true;
|
|
149
|
+
const canWrite = entry?.canWrite === true;
|
|
138
150
|
|
|
139
151
|
const skill = detail.skill;
|
|
140
152
|
const skillPath = skill?.path ?? '';
|
|
@@ -155,7 +167,25 @@ export function SkillPage({
|
|
|
155
167
|
[],
|
|
156
168
|
);
|
|
157
169
|
const accessRequests = useJoinRequests(name, skillPath || null, skillRequestsApi);
|
|
158
|
-
|
|
170
|
+
/**
|
|
171
|
+
* The skill FOLDER as the access dialog addresses it — the same entry the
|
|
172
|
+
* explorer's right-click hands over for a folder. Null until both the KB dir
|
|
173
|
+
* and the skill have resolved: a half-built path would manage the wrong
|
|
174
|
+
* folder, or the KB root.
|
|
175
|
+
*/
|
|
176
|
+
const skillFolderEntry = useMemo<FileTreeEntry | null>(
|
|
177
|
+
() =>
|
|
178
|
+
kbDirName && skillPath
|
|
179
|
+
? { name, relativePath: `${kbDirName}/${skillPath}`, type: 'directory' }
|
|
180
|
+
: null,
|
|
181
|
+
[kbDirName, skillPath, name],
|
|
182
|
+
);
|
|
183
|
+
/**
|
|
184
|
+
* What the ONE access dialog is open on. Share and the access-requests
|
|
185
|
+
* banner both set it to the skill folder; the dialog's own "Manage <Folder>"
|
|
186
|
+
* link retargets it at an ancestor (the plugin), as it does in the explorer.
|
|
187
|
+
*/
|
|
188
|
+
const [manageTarget, setManageTarget] = useState<FileTreeEntry | null>(null);
|
|
159
189
|
|
|
160
190
|
/**
|
|
161
191
|
* Who has to say yes. A skill has no owner of its own — it inherits its plugin
|
|
@@ -264,7 +294,28 @@ export function SkillPage({
|
|
|
264
294
|
Boolean((location.state as { startEditing?: boolean } | null)?.startEditing),
|
|
265
295
|
);
|
|
266
296
|
const [busyCr, setBusyCr] = useState<number | null>(null);
|
|
297
|
+
/**
|
|
298
|
+
* What the last save on this page said about the skill's `allowed-tools`
|
|
299
|
+
* (entries that look like platform tools but name none the saver can see),
|
|
300
|
+
* or `null` while nothing has been saved here — then the banner speaks from
|
|
301
|
+
* the loaded skill's own `warnings`, so a skill left pointing at a manual
|
|
302
|
+
* that was since retired says so on open. Advisory either way: a save has
|
|
303
|
+
* already landed. A save's answer wins over the load's because a proposal's
|
|
304
|
+
* content lives on another branch than the skill on screen; an approval
|
|
305
|
+
* rewrites the skill underneath (see `onApplied`) and hands the word back to
|
|
306
|
+
* the reload. Per-page state, and the route mounts this component with
|
|
307
|
+
* `key={name}`, so moving to another skill starts from that skill's own.
|
|
308
|
+
*/
|
|
309
|
+
const [savedWarnings, setSavedWarnings] = useState<SkillToolWarning[] | null>(null);
|
|
310
|
+
const toolWarnings = savedWarnings ?? skill?.warnings ?? [];
|
|
267
311
|
|
|
312
|
+
/**
|
|
313
|
+
* The file on screen as a workspace path, `<kbDirName>/<skill>/<file>`: the
|
|
314
|
+
* base every relative link and image in it resolves against, and the path
|
|
315
|
+
* the history panel reads. Null until the workspace and the skill have both
|
|
316
|
+
* resolved.
|
|
317
|
+
*/
|
|
318
|
+
const fileWorkspacePath = kbDirName && skillPath ? `${kbDirName}/${fileRepoPath}` : null;
|
|
268
319
|
/**
|
|
269
320
|
* The workspace-relative path `FileHistoryPanel` reads the git log for — the
|
|
270
321
|
* same string the Knowledge viewer hands it, so a skill file's history is
|
|
@@ -273,7 +324,7 @@ export function SkillPage({
|
|
|
273
324
|
* asks immediately, so handing it a half-built one would ask about
|
|
274
325
|
* `undefined/SKILL.md`.
|
|
275
326
|
*/
|
|
276
|
-
const historyPath =
|
|
327
|
+
const historyPath = fileWorkspacePath;
|
|
277
328
|
/**
|
|
278
329
|
* Whether `⋯` has anything behind it. Git not ready means there is no log to
|
|
279
330
|
* show, and an overflow that opens onto an empty panel is worse than no
|
|
@@ -308,20 +359,42 @@ export function SkillPage({
|
|
|
308
359
|
// log back over the file minutes after the reader returned to reading. Once
|
|
309
360
|
// it is gone they ask for it again, which is one click.
|
|
310
361
|
//
|
|
311
|
-
//
|
|
312
|
-
// `historyAvailable`
|
|
313
|
-
//
|
|
314
|
-
// fixed the panel and left the menu to spring open by itself on the next
|
|
315
|
-
// good poll.
|
|
316
|
-
//
|
|
317
|
-
// `editing` is the second door into the same state, and it is reachable
|
|
318
|
-
// without a mouse: `useDismissableMenu` dismisses on outside POINTERDOWN, so
|
|
319
|
-
// tabbing from the open menu to Edit and pressing Enter never dismisses it.
|
|
320
|
-
// The editor then withdraws `historyAvailable`, and Cancel used to hand the
|
|
321
|
-
// menu back open.
|
|
362
|
+
// `editing` is the second door into the same state: the editor withdraws
|
|
363
|
+
// `historyAvailable` (its draft would be discarded under the panel), and
|
|
364
|
+
// Cancel must not hand the log back open over the file.
|
|
322
365
|
if (historyOpen && !historyAvailable) setHistoryOpen(false);
|
|
323
|
-
if (menuOpen && !historyAvailable) setMenuOpen(false);
|
|
324
366
|
const viewingHistory = historyAvailable && historyOpen;
|
|
367
|
+
/**
|
|
368
|
+
* The clock that opens the log sits in the file bar, and the bar unmounts
|
|
369
|
+
* with the file; the pressed clock that closes it sits in the history row,
|
|
370
|
+
* which unmounts with the log. Either way the control a keyboard user just
|
|
371
|
+
* activated is gone from the DOM, so the two clocks hand focus to each
|
|
372
|
+
* other (`useFocusHandoff`): opening lands on the pressed clock, closing
|
|
373
|
+
* lands on the bar's. Only for a swap the USER made; the log closing
|
|
374
|
+
* because git stopped answering names no target and moves nothing.
|
|
375
|
+
*
|
|
376
|
+
* The bar's clock is not guaranteed to come back: `historyAvailable`
|
|
377
|
+
* withdraws it, and a failed status poll can land in the same commit as the
|
|
378
|
+
* click. The page's own title is named last for that, since it is on screen
|
|
379
|
+
* in every state and names the skill the user came back to.
|
|
380
|
+
*
|
|
381
|
+
* Knowledge states the same rule with its document title, where the case is
|
|
382
|
+
* routine rather than a race: a comparison outlives `historyAvailable` on
|
|
383
|
+
* purpose, so leaving one while git is silent finds no clock at all. See
|
|
384
|
+
* `FileViewer.backToDocument` and the test beside it.
|
|
385
|
+
*/
|
|
386
|
+
const paneClockRef = useRef<HTMLButtonElement>(null);
|
|
387
|
+
const pressedClockRef = useRef<HTMLButtonElement>(null);
|
|
388
|
+
const titleRef = useRef<HTMLHeadingElement>(null);
|
|
389
|
+
const handoff = useFocusHandoff(viewingHistory);
|
|
390
|
+
const openHistory = () => {
|
|
391
|
+
handoff(true, pressedClockRef);
|
|
392
|
+
setHistoryOpen(true);
|
|
393
|
+
};
|
|
394
|
+
const closeHistory = () => {
|
|
395
|
+
handoff(false, paneClockRef, titleRef);
|
|
396
|
+
setHistoryOpen(false);
|
|
397
|
+
};
|
|
325
398
|
/**
|
|
326
399
|
* Change requests a merge attempt has REFUSED as unmergeable. Git is the only
|
|
327
400
|
* thing that can answer "does this still apply?", and it answers when asked
|
|
@@ -341,6 +414,10 @@ export function SkillPage({
|
|
|
341
414
|
onApplied() {
|
|
342
415
|
toast('Approved: the skill now reads with that change.');
|
|
343
416
|
setRevision((r) => r + 1);
|
|
417
|
+
// The merge just rewrote the skill, `allowed-tools` included, so the
|
|
418
|
+
// advisory from this page's last save is about text that is no longer
|
|
419
|
+
// there. The reload below answers for the merged skill instead.
|
|
420
|
+
setSavedWarnings(null);
|
|
344
421
|
data.reload();
|
|
345
422
|
// The pane renders `skill.body`, which this hook holds and the merge just
|
|
346
423
|
// changed. Without re-reading it the page keeps showing the pre-merge
|
|
@@ -379,7 +456,7 @@ export function SkillPage({
|
|
|
379
456
|
const raw = active === 'SKILL.md' ? rawOnMain : detail.fileContent(active);
|
|
380
457
|
|
|
381
458
|
/** Every open change request's version of the file on screen. */
|
|
382
|
-
const crDiffs = useCrFileDiffs(skillCrs, fileRepoPath,
|
|
459
|
+
const crDiffs = useCrFileDiffs(skillCrs, fileRepoPath, revision);
|
|
383
460
|
|
|
384
461
|
/** The change requests with something to say about THIS file. */
|
|
385
462
|
const boxes = useMemo(
|
|
@@ -411,11 +488,39 @@ export function SkillPage({
|
|
|
411
488
|
// reads it. Only the propose flow stacks on the caller's own branch copy.
|
|
412
489
|
const editorBase = !canEditDirectly && ownCr ? ownBranchBase : rawOnMain;
|
|
413
490
|
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
491
|
+
/**
|
|
492
|
+
* Follow a link out of the rendered file. The same grammar as the Knowledge
|
|
493
|
+
* view (`resolveKbHref`): the destination is decoded, so a link to
|
|
494
|
+
* `Some File.md` opens `Some File.md` and not `Some%20File.md`; an absolute
|
|
495
|
+
* app URL keeps its own branch; anything else opens on the default branch,
|
|
496
|
+
* where skills live.
|
|
497
|
+
*/
|
|
498
|
+
const openLinkInEditor = useCallback(
|
|
499
|
+
(href: string) => {
|
|
500
|
+
if (!fileWorkspacePath) return;
|
|
501
|
+
const target = resolveKbHref(href, { basePath: fileWorkspacePath, kbDirName });
|
|
502
|
+
// Same rule as `openLink`: the anchor's default was cancelled to get
|
|
503
|
+
// here, so an external destination has nobody left to open it.
|
|
504
|
+
if (target?.kind === 'external') {
|
|
505
|
+
openExternalHref(href);
|
|
506
|
+
return;
|
|
507
|
+
}
|
|
508
|
+
if (target?.kind !== 'workspace') return;
|
|
509
|
+
navigate(kbFileUrl(target.branch ?? DEFAULT_BRANCH, target.path) + target.hash);
|
|
510
|
+
},
|
|
511
|
+
[fileWorkspacePath, kbDirName, navigate],
|
|
417
512
|
);
|
|
418
513
|
|
|
514
|
+
/**
|
|
515
|
+
* Images in the file, served from the DEFAULT branch's workspace: that is
|
|
516
|
+
* the tree this pane renders (`rawOnMain`), and where `headingLink` and the
|
|
517
|
+
* link handler above point. The checked-out branch may be somebody's draft
|
|
518
|
+
* with another copy of the picture, or none. The revision keeps an open page
|
|
519
|
+
* current when a teammate replaces a screenshot under the same name.
|
|
520
|
+
*/
|
|
521
|
+
const skillWorkspaceId = encodeURIComponent(DEFAULT_BRANCH);
|
|
522
|
+
const resolveImage = useWorkspaceImageResolver(skillWorkspaceId, fileWorkspacePath);
|
|
523
|
+
|
|
419
524
|
/**
|
|
420
525
|
* A heading's citation deep-link — the file's KNOWLEDGE URL plus `#slug`,
|
|
421
526
|
* because that is the surface that scrolls to a heading fragment. Same
|
|
@@ -439,7 +544,10 @@ export function SkillPage({
|
|
|
439
544
|
*/
|
|
440
545
|
async function saveDirect(content: string) {
|
|
441
546
|
const { workspace } = await getOrCreateWorkspace(DEFAULT_BRANCH);
|
|
442
|
-
await writeFile(workspace.id, `${workspace.kbDirName}/${fileRepoPath}`, content);
|
|
547
|
+
const saved = await writeFile(workspace.id, `${workspace.kbDirName}/${fileRepoPath}`, content);
|
|
548
|
+
// Only a SKILL.md save has a say: a bundled file's answer carries no
|
|
549
|
+
// warnings, and taking it as "none" would hide the loaded skill's.
|
|
550
|
+
if (active === 'SKILL.md') setSavedWarnings(saved?.warnings ?? []);
|
|
443
551
|
setEditing(false);
|
|
444
552
|
setRevision((r) => r + 1);
|
|
445
553
|
toast('Saved: the skill now reads with your change.');
|
|
@@ -448,7 +556,7 @@ export function SkillPage({
|
|
|
448
556
|
|
|
449
557
|
async function submitProposal(content: string) {
|
|
450
558
|
if (!user) throw new Error('Sign in to propose a change.');
|
|
451
|
-
await proposeChange({
|
|
559
|
+
const proposed = await proposeChange({
|
|
452
560
|
skillName: name,
|
|
453
561
|
repoRelativePath: fileRepoPath,
|
|
454
562
|
content,
|
|
@@ -456,6 +564,7 @@ export function SkillPage({
|
|
|
456
564
|
userName: user.name,
|
|
457
565
|
existingCr: ownCr,
|
|
458
566
|
});
|
|
567
|
+
if (active === 'SKILL.md') setSavedWarnings(proposed?.warnings ?? []);
|
|
459
568
|
setEditing(false);
|
|
460
569
|
setRevision((r) => r + 1);
|
|
461
570
|
toast(`Sent to ${ownerName}: nothing changes until they approve it.`);
|
|
@@ -548,60 +657,44 @@ export function SkillPage({
|
|
|
548
657
|
// second layout when the detail request settles.
|
|
549
658
|
return (
|
|
550
659
|
<Article>
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
660
|
+
<header>
|
|
661
|
+
{/* The shared header band — one height for this title bar and the
|
|
662
|
+
sidebar's header row beside it, so a skill page opens on the same
|
|
663
|
+
line a file page and the Library's own pages do. The way back
|
|
664
|
+
rides ON the band, as its leading item: a back link in a row above
|
|
665
|
+
would push this row down off that line, which is the whole seam.
|
|
666
|
+
(The error and not-found returns above still lead with it on its
|
|
667
|
+
own row — they have no title bar to hold a line with.) */}
|
|
668
|
+
<div data-testid={PAGE_HEADER_TESTID} className={cn(HEADER_BAND, 'gap-3')}>
|
|
669
|
+
<div className={HEADER_BAND_LEAD}>{backLink}</div>
|
|
670
|
+
{/* `tabIndex={-1}` keeps the heading out of the tab order while
|
|
671
|
+
letting `.focus()` land on it — where focus goes when closing
|
|
672
|
+
the log finds no clock to hand back to. No focus ring: it is a
|
|
673
|
+
programmatic landing after the user's own click. */}
|
|
674
|
+
<h1
|
|
675
|
+
ref={titleRef}
|
|
676
|
+
tabIndex={-1}
|
|
677
|
+
// `title` because `truncate` hides the rest of a long skill name,
|
|
678
|
+
// and a heading you cannot finish reading needs somewhere to say it.
|
|
679
|
+
title={skill?.name ?? name}
|
|
680
|
+
className="min-w-0 truncate text-display font-semibold text-ink focus:outline-none"
|
|
681
|
+
>
|
|
682
|
+
{skill?.name ?? name}
|
|
683
|
+
</h1>
|
|
556
684
|
{skill && owned && (
|
|
557
685
|
<Badge tone="outline" size="xs" className="shrink-0 uppercase">
|
|
558
686
|
Owner
|
|
559
687
|
</Badge>
|
|
560
688
|
)}
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
only
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
Version history is the whole menu, so the trigger goes where the
|
|
572
|
-
menu goes — see `historyAvailable`. */}
|
|
573
|
-
{historyAvailable && (
|
|
574
|
-
<div className="relative ml-auto flex-none">
|
|
575
|
-
<IconButton
|
|
576
|
-
ref={menuTriggerRef}
|
|
577
|
-
aria-label="More actions"
|
|
578
|
-
aria-haspopup="menu"
|
|
579
|
-
aria-expanded={menuOpen}
|
|
580
|
-
active={menuOpen}
|
|
581
|
-
onClick={() => setMenuOpen((v) => !v)}
|
|
582
|
-
>
|
|
583
|
-
<span aria-hidden className="text-strong leading-none">
|
|
584
|
-
⋯
|
|
585
|
-
</span>
|
|
586
|
-
</IconButton>
|
|
587
|
-
{menuOpen && (
|
|
588
|
-
<div ref={menuRef} className="absolute right-0 top-[calc(100%+5px)] z-40">
|
|
589
|
-
<MenuPanel role="menu" aria-label="More actions" className="min-w-[212px]">
|
|
590
|
-
<MenuItem
|
|
591
|
-
role="menuitem"
|
|
592
|
-
onClick={() => {
|
|
593
|
-
closeMenu();
|
|
594
|
-
setHistoryOpen(true);
|
|
595
|
-
}}
|
|
596
|
-
>
|
|
597
|
-
<span className="flex items-center gap-2.5">
|
|
598
|
-
<History size={14} />
|
|
599
|
-
Version history
|
|
600
|
-
</span>
|
|
601
|
-
</MenuItem>
|
|
602
|
-
</MenuPanel>
|
|
603
|
-
</div>
|
|
604
|
-
)}
|
|
689
|
+
{/* Share IS the manage-access dialog, on the skill's own folder —
|
|
690
|
+
standalone or inside a plugin. A rule written here sits beside
|
|
691
|
+
the plugin's, and the resolver reads both at their depths. Shown
|
|
692
|
+
wherever the explorer would offer `Manage access` on the same
|
|
693
|
+
folder; for someone who cannot change the rules the dialog
|
|
694
|
+
renders read-only, and the grant route refuses regardless. */}
|
|
695
|
+
{skillFolderEntry && offersManageAccess(skillFolderEntry) && (
|
|
696
|
+
<div className="ml-auto flex flex-none items-center gap-1.5">
|
|
697
|
+
<ShareButton onClick={() => setManageTarget(skillFolderEntry)} />
|
|
605
698
|
</div>
|
|
606
699
|
)}
|
|
607
700
|
</div>
|
|
@@ -609,32 +702,35 @@ export function SkillPage({
|
|
|
609
702
|
and its frontmatter panel already says what the skill is for.
|
|
610
703
|
Repeating it above the pane said the same sentence twice on the
|
|
611
704
|
first screenful. */}
|
|
612
|
-
{/* No `Manage access` here, deliberately — a skill inherits its plugin
|
|
613
|
-
folder's `access.md`, and the plugin's Share panel is the one place
|
|
614
|
-
those rules are decided. Same call the tool page made. */}
|
|
615
705
|
</header>
|
|
616
706
|
|
|
707
|
+
<ToolWarningsBanner warnings={toolWarnings} />
|
|
708
|
+
|
|
617
709
|
{/* Not before the folder is known: Accept grants ON the folder and
|
|
618
710
|
Manage access opens it, and both are no-ops against ''. */}
|
|
619
|
-
{
|
|
711
|
+
{canWrite && skillFolderEntry && (
|
|
620
712
|
<AccessRequestsBanner
|
|
621
713
|
plugin={name}
|
|
622
714
|
folders={[skillPath]}
|
|
623
715
|
requests={accessRequests.requests}
|
|
624
|
-
onManage={() =>
|
|
716
|
+
onManage={() => setManageTarget(skillFolderEntry)}
|
|
625
717
|
onAccept={(r, p) => void accessRequests.accept(r, p)}
|
|
626
718
|
onDecline={(r) => void accessRequests.decline(r)}
|
|
627
719
|
/>
|
|
628
720
|
)}
|
|
629
|
-
{
|
|
721
|
+
{manageTarget && (
|
|
630
722
|
<ManageAccessDialog
|
|
723
|
+
// Keyed on the path, so retargeting at an ancestor remounts it
|
|
724
|
+
// against that folder — the explorer's arrangement exactly.
|
|
725
|
+
key={manageTarget.relativePath}
|
|
631
726
|
// The Library speaks the DEFAULT branch: a skill's rules are edited
|
|
632
727
|
// where the catalog reads them, whatever branch the ambient
|
|
633
728
|
// workspace happens to be on.
|
|
634
729
|
workspaceId={encodeURIComponent(DEFAULT_BRANCH)}
|
|
635
|
-
entry={
|
|
730
|
+
entry={manageTarget}
|
|
731
|
+
onManageAncestor={setManageTarget}
|
|
636
732
|
onClose={() => {
|
|
637
|
-
|
|
733
|
+
setManageTarget(null);
|
|
638
734
|
accessRequests.reload();
|
|
639
735
|
data.reload();
|
|
640
736
|
}}
|
|
@@ -648,7 +744,7 @@ export function SkillPage({
|
|
|
648
744
|
skillName={name}
|
|
649
745
|
skillPath={skillPath}
|
|
650
746
|
memberships={memberships}
|
|
651
|
-
|
|
747
|
+
canWrite={canWrite}
|
|
652
748
|
onChanged={() => {
|
|
653
749
|
data.reload();
|
|
654
750
|
data.reloadPlugins();
|
|
@@ -687,17 +783,33 @@ export function SkillPage({
|
|
|
687
783
|
{viewingHistory && historyPath !== null ? (
|
|
688
784
|
<>
|
|
689
785
|
{/* An explicit way back. Without it the only route to the file would
|
|
690
|
-
be reopening it, since history is not in the URL.
|
|
786
|
+
be reopening it, since history is not in the URL. The clock that
|
|
787
|
+
opened the log sits in the file bar, and the bar leaves with the
|
|
788
|
+
file, so the same clock is drawn here PRESSED: the control that
|
|
789
|
+
opened the view stays on screen showing that it is open, and a
|
|
790
|
+
second click on it is the other way back. Same shape as the
|
|
791
|
+
Knowledge header while its log is open. */}
|
|
691
792
|
<div className="mb-3 mt-4 flex items-center gap-2">
|
|
692
793
|
<Button
|
|
693
794
|
variant="quiet"
|
|
694
795
|
size="sm"
|
|
695
796
|
leadingIcon={<ArrowLeft size={13} />}
|
|
696
|
-
onClick={
|
|
797
|
+
onClick={closeHistory}
|
|
697
798
|
>
|
|
698
799
|
Back to the file
|
|
699
800
|
</Button>
|
|
700
801
|
<span className="text-detail text-ink-faint">{`Version history: ${active}`}</span>
|
|
802
|
+
<IconButton
|
|
803
|
+
ref={pressedClockRef}
|
|
804
|
+
aria-label="Version history"
|
|
805
|
+
aria-pressed
|
|
806
|
+
title="Back to the file"
|
|
807
|
+
active
|
|
808
|
+
className="ml-auto"
|
|
809
|
+
onClick={closeHistory}
|
|
810
|
+
>
|
|
811
|
+
<History size={14} />
|
|
812
|
+
</IconButton>
|
|
701
813
|
</div>
|
|
702
814
|
{/* A DEFINITE height, and a flex column to hold it. The panel is
|
|
703
815
|
built for the Knowledge viewer's full-height pane: its list and
|
|
@@ -735,12 +847,12 @@ export function SkillPage({
|
|
|
735
847
|
file={active}
|
|
736
848
|
raw={raw}
|
|
737
849
|
suggestion={null}
|
|
738
|
-
onOpenLink={
|
|
739
|
-
if (!kbDirName) return;
|
|
740
|
-
openInEditor(resolveRelativePath(`${kbDirName}/${skillPath}/${active}`, href));
|
|
741
|
-
}}
|
|
850
|
+
onOpenLink={openLinkInEditor}
|
|
742
851
|
onOpenNodeId={openNodeId}
|
|
743
852
|
headingLink={headingLink}
|
|
853
|
+
// No workspace yet means no base to resolve against: images render
|
|
854
|
+
// as plain tags, exactly as before the resolver existed.
|
|
855
|
+
resolveImage={fileWorkspacePath ? resolveImage : undefined}
|
|
744
856
|
/*
|
|
745
857
|
* ONE action, decided by the ACL. An `Edit` used to sit beside
|
|
746
858
|
* `Propose changes` for EVERYONE and jump to the Knowledge editor —
|
|
@@ -763,11 +875,32 @@ export function SkillPage({
|
|
|
763
875
|
* fork, never a silent restart from the published text.
|
|
764
876
|
*/
|
|
765
877
|
actions={
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
878
|
+
<>
|
|
879
|
+
{/* "Who changed this, when" — the clock-arrow beside Edit, where
|
|
880
|
+
Google Docs keeps it. This page is the only surface a
|
|
881
|
+
`Plugins/` file has: the shell routes those URLs here
|
|
882
|
+
(`isLibraryLocation`) and the Knowledge tree does not list
|
|
883
|
+
`Plugins/`, so this button is the deployment's one way into a
|
|
884
|
+
skill's git log. It used to be the lone item behind a ⋯ in
|
|
885
|
+
the page header — two clicks and a menu for a question people
|
|
886
|
+
ask often. Withdrawn with `historyAvailable`: git not
|
|
887
|
+
answering, or no path to ask about. */}
|
|
888
|
+
{historyAvailable && (
|
|
889
|
+
<IconButton
|
|
890
|
+
ref={paneClockRef}
|
|
891
|
+
aria-label="Version history"
|
|
892
|
+
title="Version history"
|
|
893
|
+
onClick={openHistory}
|
|
894
|
+
>
|
|
895
|
+
<History size={14} />
|
|
896
|
+
</IconButton>
|
|
897
|
+
)}
|
|
898
|
+
{/* Only a RESOLVED verdict earns a write button: `null` (lookup
|
|
899
|
+
in flight) briefly shows none rather than an Edit that might
|
|
900
|
+
open the wrong mode — a writer's text must never ride the
|
|
901
|
+
proposal path just because they clicked before the ACL
|
|
902
|
+
answered. */}
|
|
903
|
+
{fileAccess.canWrite === true
|
|
771
904
|
? rawOnMain !== null && (
|
|
772
905
|
<Button
|
|
773
906
|
variant="outline"
|
|
@@ -791,7 +924,8 @@ export function SkillPage({
|
|
|
791
924
|
>
|
|
792
925
|
Propose changes
|
|
793
926
|
</Button>
|
|
794
|
-
)
|
|
927
|
+
)}
|
|
928
|
+
</>
|
|
795
929
|
}
|
|
796
930
|
/>
|
|
797
931
|
)}
|
|
@@ -808,7 +942,8 @@ export function SkillPage({
|
|
|
808
942
|
// `[]` is the hook's "overtaken" answer — the proposal and the file
|
|
809
943
|
// now say the same thing — and is distinct from `null`, which only
|
|
810
944
|
// means a side has not arrived yet.
|
|
811
|
-
const
|
|
945
|
+
const read = crDiffs.get(cr.number) ?? null;
|
|
946
|
+
const fileDiff = read === 'unreadable' ? null : read;
|
|
812
947
|
return (
|
|
813
948
|
<ChangeBox
|
|
814
949
|
key={cr.number}
|
|
@@ -816,26 +951,21 @@ export function SkillPage({
|
|
|
816
951
|
author={changeAuthorName(cr)}
|
|
817
952
|
when={formatWhen(cr.createdAt)}
|
|
818
953
|
mine={mine}
|
|
819
|
-
canDecide={
|
|
954
|
+
canDecide={canWrite && !mine}
|
|
820
955
|
diff={fileDiff}
|
|
821
956
|
binary={isBinaryFile(active)}
|
|
957
|
+
unreadable={read === 'unreadable'}
|
|
822
958
|
upToDate={fileDiff !== null && fileDiff.length === 0}
|
|
823
959
|
blocked={blockedCrs.has(cr.number)}
|
|
824
960
|
conflictPrompt={conflictResolutionPrompt(cr)}
|
|
825
|
-
|
|
826
|
-
// refusal line would say the same thing twice in one box.
|
|
827
|
-
refusal={
|
|
828
|
-
applying.refusals.get(cr.number)?.conflicts === false
|
|
829
|
-
? (applying.refusals.get(cr.number)?.reason ?? null)
|
|
830
|
-
: null
|
|
831
|
-
}
|
|
961
|
+
refusal={refusalLine(cr, applying.refusals)}
|
|
832
962
|
owner={ownerName}
|
|
833
963
|
busy={busyCr === cr.number || applying.activeCr === cr.number}
|
|
834
964
|
phase={applying.activeCr === cr.number ? applying.phase : 'idle'}
|
|
835
965
|
onApprove={() => applying.apply(cr)}
|
|
836
966
|
onDecline={() => void decline(cr)}
|
|
837
967
|
onWithdraw={() => void withdraw(cr)}
|
|
838
|
-
onOpenFull={
|
|
968
|
+
onOpenFull={canWrite ? () => setCompareCr(cr) : undefined}
|
|
839
969
|
/>
|
|
840
970
|
);
|
|
841
971
|
})}
|
|
@@ -844,8 +974,10 @@ export function SkillPage({
|
|
|
844
974
|
{/* Outside the panel: the dock lists change requests touching ANY file of
|
|
845
975
|
the skill, so it is not about the selected tab. The boxes above only
|
|
846
976
|
cover the file on screen, and without this a proposal to a file you
|
|
847
|
-
are not looking at has no way to reach you.
|
|
848
|
-
|
|
977
|
+
are not looking at has no way to reach you. Gated by write, not
|
|
978
|
+
ownership, like Approve itself: the server takes an approval from
|
|
979
|
+
anyone who can write the file, so a writer reviews the whole change. */}
|
|
980
|
+
{skill && canWrite && <ChangeRequestDock crs={skillCrs} onSelect={setCompareCr} />}
|
|
849
981
|
</Article>
|
|
850
982
|
);
|
|
851
983
|
}
|
|
@@ -920,6 +1052,26 @@ function IntegrationsSection({
|
|
|
920
1052
|
);
|
|
921
1053
|
}
|
|
922
1054
|
|
|
1055
|
+
/**
|
|
1056
|
+
* The skill page's status line for `allowed-tools` entries the platform could
|
|
1057
|
+
* not resolve. A warning, never a block: the list also names the client's own
|
|
1058
|
+
* tools, which the server cannot know, so it only speaks about names that look
|
|
1059
|
+
* like its own.
|
|
1060
|
+
*/
|
|
1061
|
+
function ToolWarningsBanner({ warnings }: { warnings: SkillToolWarning[] }) {
|
|
1062
|
+
if (warnings.length === 0) return null;
|
|
1063
|
+
return (
|
|
1064
|
+
<Banner tone="wait" role="status" className="mt-4">
|
|
1065
|
+
<p className="font-semibold">Some tools this skill lists are not available</p>
|
|
1066
|
+
<ul className="mt-1 list-disc pl-5">
|
|
1067
|
+
{warnings.map((w) => (
|
|
1068
|
+
<li key={w.entry}>{w.message}</li>
|
|
1069
|
+
))}
|
|
1070
|
+
</ul>
|
|
1071
|
+
</Banner>
|
|
1072
|
+
);
|
|
1073
|
+
}
|
|
1074
|
+
|
|
923
1075
|
/** A malformed escape is a bad link, not a crash — fall back to the raw segment. */
|
|
924
1076
|
function safeDecode(raw: string): string {
|
|
925
1077
|
try {
|