@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
|
@@ -3,13 +3,14 @@ import { ChevronRight, Check, X, Clock } from 'lucide-react';
|
|
|
3
3
|
import type { PullRequestSummary } from '@bevel-software/platform-shared';
|
|
4
4
|
import { cn } from '../../../lib/utils';
|
|
5
5
|
import { Badge } from '../../../shared/components';
|
|
6
|
+
import { SIDEBAR_CHILD_INDENT, SIDEBAR_ROW_INSET } from '../../layout/components/SidebarFrame';
|
|
6
7
|
import { listPullRequestsForMe } from '../services/pr.api';
|
|
7
8
|
import { friendlyGitError } from '../services/error-messages';
|
|
8
9
|
import { useGit } from '../state/git.context';
|
|
9
10
|
import { ChangeRequestDialog } from '../../change-requests/components/ChangeRequestDialog';
|
|
10
|
-
import { PR_STALE_EVENT } from '../../../core/events';
|
|
11
|
+
import { PR_STALE_EVENT, PR_STALE_FALLBACK_MS, subscribePrStale } from '../../../core/events';
|
|
11
12
|
|
|
12
|
-
const POLL_INTERVAL_MS =
|
|
13
|
+
const POLL_INTERVAL_MS = PR_STALE_FALLBACK_MS;
|
|
13
14
|
|
|
14
15
|
export function PullRequestsForMe() {
|
|
15
16
|
const git = useGit();
|
|
@@ -133,12 +134,12 @@ export function PullRequestsForMe() {
|
|
|
133
134
|
console.error('[PullRequestsForMe] initial load failed', e);
|
|
134
135
|
});
|
|
135
136
|
document.addEventListener('visibilitychange', handleVisibility);
|
|
136
|
-
|
|
137
|
+
const offStale = subscribePrStale(handlePrStale);
|
|
137
138
|
|
|
138
139
|
return () => {
|
|
139
140
|
cancelled = true;
|
|
140
141
|
document.removeEventListener('visibilitychange', handleVisibility);
|
|
141
|
-
|
|
142
|
+
offStale();
|
|
142
143
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
143
144
|
};
|
|
144
145
|
}, [available, deleteBranch, refreshBranches]);
|
|
@@ -156,7 +157,14 @@ export function PullRequestsForMe() {
|
|
|
156
157
|
// one hairline, a disclosure header with an amber count, and rows in the
|
|
157
158
|
// same two type sizes the tree above and the Library nav use, so the whole
|
|
158
159
|
// sidebar is one typographic system rather than three.
|
|
159
|
-
|
|
160
|
+
//
|
|
161
|
+
// The hairline and the space above it are the FRAME's now
|
|
162
|
+
// (`SIDEBAR_FOOTER_SLOT`): this dock shares the footer with the Library's
|
|
163
|
+
// setup reminder, and a dock that drew its own rule put a second one
|
|
164
|
+
// directly under the reminder's. What is left here is the dock, and it
|
|
165
|
+
// sits flush in the column so its rows can take the sidebar's row inset
|
|
166
|
+
// exactly as the tree rows above do.
|
|
167
|
+
<div className="flex max-h-60 shrink-0 flex-col">
|
|
160
168
|
<button
|
|
161
169
|
type="button"
|
|
162
170
|
onClick={() => setExpanded((v) => !v)}
|
|
@@ -165,7 +173,10 @@ export function PullRequestsForMe() {
|
|
|
165
173
|
// SCOPE in words, because this queue is deliberately narrower than the
|
|
166
174
|
// dots in the tree — it is the requests that are yours to act on.
|
|
167
175
|
aria-label="Change requests for you"
|
|
168
|
-
className=
|
|
176
|
+
className={cn(
|
|
177
|
+
'flex items-center gap-[7px] pt-2.5 pb-2 text-label uppercase text-ink-faint transition-colors hover:text-ink',
|
|
178
|
+
SIDEBAR_ROW_INSET,
|
|
179
|
+
)}
|
|
169
180
|
>
|
|
170
181
|
<span className="flex w-3 flex-none items-center justify-center">
|
|
171
182
|
<ChevronRight
|
|
@@ -173,9 +184,13 @@ export function PullRequestsForMe() {
|
|
|
173
184
|
className={cn('transition-transform duration-150', expanded && 'rotate-90')}
|
|
174
185
|
/>
|
|
175
186
|
</span>
|
|
176
|
-
|
|
187
|
+
{/* `min-w-0` + `truncate`, so the count keeps its place. A flex item's
|
|
188
|
+
automatic minimum is its own content, so at 180px — the narrowest
|
|
189
|
+
the sidebar goes — the label refused to give way and pushed the
|
|
190
|
+
badge past the right edge of the row instead. */}
|
|
191
|
+
<span className="min-w-0 flex-1 truncate text-left">Change requests</span>
|
|
177
192
|
{prs.length > 0 && (
|
|
178
|
-
<Badge tone="wait" size="xs">
|
|
193
|
+
<Badge tone="wait" size="xs" className="flex-none">
|
|
179
194
|
{prs.length}
|
|
180
195
|
</Badge>
|
|
181
196
|
)}
|
|
@@ -183,7 +198,11 @@ export function PullRequestsForMe() {
|
|
|
183
198
|
|
|
184
199
|
{expanded && (
|
|
185
200
|
<div className="flex flex-col gap-px overflow-y-auto pb-1.5">
|
|
186
|
-
{error &&
|
|
201
|
+
{error && (
|
|
202
|
+
<div className={cn('py-2', SIDEBAR_ROW_INSET)}>
|
|
203
|
+
<div className={cn('text-meta text-danger', SIDEBAR_CHILD_INDENT)}>{error}</div>
|
|
204
|
+
</div>
|
|
205
|
+
)}
|
|
187
206
|
{!error &&
|
|
188
207
|
prs.map((pr) => <PrRow key={pr.number} pr={pr} onOpen={() => setOpenCr(pr)} />)}
|
|
189
208
|
</div>
|
|
@@ -228,23 +247,31 @@ function PrRow({ pr, onOpen }: { pr: PullRequestSummary; onOpen(): void }) {
|
|
|
228
247
|
onOpen();
|
|
229
248
|
}
|
|
230
249
|
}}
|
|
231
|
-
className=
|
|
250
|
+
className={cn(
|
|
251
|
+
'group block cursor-pointer rounded-sm py-1.5 transition-colors hover:bg-hover',
|
|
252
|
+
SIDEBAR_ROW_INSET,
|
|
253
|
+
)}
|
|
232
254
|
title={pr.title}
|
|
233
255
|
>
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
<
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
256
|
+
{/* The indent is on the CONTENT, not on the row: the row keeps the
|
|
257
|
+
sidebar's own inset, so it spans the full column the way a tree row
|
|
258
|
+
does and its hover fill starts where theirs does. */}
|
|
259
|
+
<div className={SIDEBAR_CHILD_INDENT}>
|
|
260
|
+
<div className="flex min-w-0 gap-1.5 text-ui text-ink-muted group-hover:text-ink">
|
|
261
|
+
<span className="flex-none tabular-nums text-ink-faint">#{pr.number}</span>
|
|
262
|
+
{/* The ellipsis has to live on the TEXT, not on the flex row — a flex
|
|
263
|
+
container clips its children without ever drawing one. */}
|
|
264
|
+
<span className="min-w-0 truncate">{pr.title}</span>
|
|
265
|
+
</div>
|
|
266
|
+
<div className="mt-px flex items-center gap-2 text-meta text-ink-faint">
|
|
267
|
+
<span className="truncate">{who}</span>
|
|
268
|
+
<ReviewBadge review={pr.review} />
|
|
269
|
+
{touched > 0 && (
|
|
270
|
+
<span className="flex-none">
|
|
271
|
+
{touched} file{touched === 1 ? '' : 's'}
|
|
272
|
+
</span>
|
|
273
|
+
)}
|
|
274
|
+
</div>
|
|
248
275
|
</div>
|
|
249
276
|
</div>
|
|
250
277
|
);
|
|
@@ -54,6 +54,35 @@ describe('friendlyGitError: translates raw backend git messages', () => {
|
|
|
54
54
|
expect(friendlyGitError(err)).toBe('something completely new went wrong');
|
|
55
55
|
});
|
|
56
56
|
|
|
57
|
+
it('rewrites the read-before-write refusal to name the folder the person cannot read', () => {
|
|
58
|
+
// The backend's `AccessDeniedError` with `unreadable` set: the folder a
|
|
59
|
+
// new file would land in, or the file itself when it exists.
|
|
60
|
+
const folder = new GitApiError(
|
|
61
|
+
403,
|
|
62
|
+
'You don\'t have permission to write to "knowledge-base/KnowledgeBase/Sales/brief.pdf". You don\'t have read access to "KnowledgeBase/Sales"; only what you can read can be created, changed or removed.',
|
|
63
|
+
);
|
|
64
|
+
expect(friendlyGitError(folder)).toBe(
|
|
65
|
+
'You can\'t add or change anything in "KnowledgeBase/Sales" because you don\'t have read access to it. Ask an admin or the folder\'s owners to share it with you first.',
|
|
66
|
+
);
|
|
67
|
+
const root = new GitApiError(
|
|
68
|
+
403,
|
|
69
|
+
'You don\'t have permission to write to "knowledge-base/notes.md". You don\'t have read access to the top level; only what you can read can be created, changed or removed.',
|
|
70
|
+
);
|
|
71
|
+
expect(friendlyGitError(root)).toBe(
|
|
72
|
+
'You can\'t add or change anything in the top level because you don\'t have read access to it. Ask an admin or the folder\'s owners to share it with you first.',
|
|
73
|
+
);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it('still rewrites the write-grant refusal, which shares the same lead', () => {
|
|
77
|
+
const err = new GitApiError(
|
|
78
|
+
403,
|
|
79
|
+
'You don\'t have permission to write to "knowledge-base/KnowledgeBase/Sales/brief.md". Eligible: Sales; Ana <ana@x.io>.',
|
|
80
|
+
);
|
|
81
|
+
expect(friendlyGitError(err)).toBe(
|
|
82
|
+
'You don\'t have permission to edit "knowledge-base/KnowledgeBase/Sales/brief.md". Editing is restricted to Sales; Ana <ana@x.io>. Ask one of them to make the change, or to broaden access for this folder.',
|
|
83
|
+
);
|
|
84
|
+
});
|
|
85
|
+
|
|
57
86
|
it('rewrites raw "no history in common" CLI errors when pre-flight is bypassed', () => {
|
|
58
87
|
const err = new GitApiError(
|
|
59
88
|
500,
|
|
@@ -139,6 +139,18 @@ export function friendlyGitError(err: unknown): string {
|
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
+
// The read-before-write refusal (the AccessDeniedError the backend throws
|
|
143
|
+
// when the caller cannot READ where a change would land — a folder they
|
|
144
|
+
// cannot see, or a file they cannot open). Matched before the write-grant
|
|
145
|
+
// shape below because both open with the same lead.
|
|
146
|
+
const unreadableMatch = raw.match(
|
|
147
|
+
/^You don't have permission to write to "([^"]+)"\. You don't have read access to (the top level|"[^"]+"); only what you can read can be created, changed or removed\.$/,
|
|
148
|
+
);
|
|
149
|
+
if (unreadableMatch) {
|
|
150
|
+
const [, , place] = unreadableMatch;
|
|
151
|
+
return `You can't add or change anything in ${place} because you don't have read access to it. Ask an admin or the folder's owners to share it with you first.`;
|
|
152
|
+
}
|
|
153
|
+
|
|
142
154
|
// Access-control rejections (the AccessDeniedError thrown by the backend
|
|
143
155
|
// when the caller lacks the `write` role on a touched path).
|
|
144
156
|
const accessMatch = raw.match(
|
|
@@ -72,10 +72,10 @@ export interface ProposeDraftPromptInput {
|
|
|
72
72
|
/**
|
|
73
73
|
* Seed text the chat composer receives when applying a change request hits
|
|
74
74
|
* conflicts. The agent reads it as a user request to resolve the
|
|
75
|
-
* disagreement
|
|
76
|
-
* the workspace's plain-language
|
|
77
|
-
* already knows the underlying git
|
|
78
|
-
* `commit_change` + `
|
|
75
|
+
* disagreement, then hand the apply back to the user — an agent proposes and
|
|
76
|
+
* syncs, a person merges. Phrased in the workspace's plain-language
|
|
77
|
+
* vocabulary; the agent's system prompt already knows the underlying git
|
|
78
|
+
* mechanics (which branches, which paths, `commit_change` + `merge_branch`).
|
|
79
79
|
*/
|
|
80
80
|
export function buildResolveApplyConflictsPrompt(input: {
|
|
81
81
|
/** The change request number being applied. */
|
|
@@ -97,7 +97,7 @@ export function buildResolveApplyConflictsPrompt(input: {
|
|
|
97
97
|
return [
|
|
98
98
|
`I tried to apply change request #${changeRequestNumber} into \`${base}\` and the two sides have differences that couldn't be reconciled automatically.${pathBlurb}`,
|
|
99
99
|
'',
|
|
100
|
-
"Please look at each affected file, decide what the merged version should look like for the process to remain consistent, and apply your resolution to the change request's source branch. Then
|
|
100
|
+
"Please look at each affected file, decide what the merged version should look like for the process to remain consistent, and apply your resolution to the change request's source branch. Then tell me it's ready, so I can apply the change request again in the app. If you genuinely can't tell which version should win on a particular file, ask me about that specific case in plain language. But resolve everything you can on your own first.",
|
|
101
101
|
].join('\n');
|
|
102
102
|
}
|
|
103
103
|
|
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The seam: the sidebar's header row and a page's title bar, measured.
|
|
3
|
+
*
|
|
4
|
+
* `shared/theme/__tests__/header-band.test.ts` checks that both sides go
|
|
5
|
+
* through `HEADER_BAND`. That is the contract; this is the consequence — the
|
|
6
|
+
* two rows RENDER to the same height, with the real token, in the same
|
|
7
|
+
* document, at the widths the ticket names.
|
|
8
|
+
*
|
|
9
|
+
* The stylesheet under these assertions is the PRODUCTION one. `src/index.css`
|
|
10
|
+
* — the app's real entry, Tailwind and the design tokens and the typography
|
|
11
|
+
* plugin — is handed to Tailwind's own compiler here and the CSS it emits is
|
|
12
|
+
* what the document is measured against. Nothing about the height is restated
|
|
13
|
+
* in this file: not the token's value, not the `.h-header` rule. A token
|
|
14
|
+
* renamed, a token moved out of `@theme`, a `@import` dropped from the entry,
|
|
15
|
+
* an upgrade that changes how a `--spacing-*` token compiles — each of those
|
|
16
|
+
* is a real regression of this seam, and each of them fails here, because the
|
|
17
|
+
* rule the browser would get is the rule this test gets.
|
|
18
|
+
*/
|
|
19
|
+
import { describe, it, expect, beforeAll, beforeEach, afterAll } from 'vitest';
|
|
20
|
+
import { render, screen } from '@testing-library/react';
|
|
21
|
+
import { readFileSync } from 'node:fs';
|
|
22
|
+
import { createRequire } from 'node:module';
|
|
23
|
+
import { dirname, join, resolve } from 'node:path';
|
|
24
|
+
import { fileURLToPath } from 'node:url';
|
|
25
|
+
import { compile } from 'tailwindcss';
|
|
26
|
+
import { SidebarFrame } from '../components/SidebarFrame';
|
|
27
|
+
import {
|
|
28
|
+
SIDEBAR_DEFAULT_WIDTH,
|
|
29
|
+
SIDEBAR_MAX_WIDTH,
|
|
30
|
+
SIDEBAR_MIN_WIDTH,
|
|
31
|
+
setSidebarCollapsed,
|
|
32
|
+
setSidebarNarrow,
|
|
33
|
+
setSidebarWidth,
|
|
34
|
+
toggleSidebar,
|
|
35
|
+
} from '../state/sidebar';
|
|
36
|
+
import { KbPageHeader } from '../../workspace/components/KbPageHeader';
|
|
37
|
+
import { KbDocumentShell } from '../../workspace/components/KbDocumentShell';
|
|
38
|
+
import {
|
|
39
|
+
HEADER_BAND,
|
|
40
|
+
HEADER_COLUMN_TOP,
|
|
41
|
+
PAGE_HEADER_TESTID,
|
|
42
|
+
SIDEBAR_HEADER_TESTID,
|
|
43
|
+
} from '../../../shared/theme/header';
|
|
44
|
+
|
|
45
|
+
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
46
|
+
/** `src/`, three levels up from `modules/layout/__tests__`. */
|
|
47
|
+
const SRC = join(HERE, '..', '..', '..');
|
|
48
|
+
/** The application's real stylesheet entry — what `apps/web` imports. */
|
|
49
|
+
const APP_STYLESHEET = join(SRC, 'index.css');
|
|
50
|
+
/** Resolved from the package root, so pnpm's symlinked tree answers. */
|
|
51
|
+
const requirePackage = createRequire(join(SRC, '..', 'package.json'));
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* The app's CSS, compiled by Tailwind exactly as the build does it.
|
|
55
|
+
*
|
|
56
|
+
* `build()` takes the class names the app uses; a utility nobody names is a
|
|
57
|
+
* utility Tailwind does not emit, which is the whole point of the engine and
|
|
58
|
+
* the reason this has to be told what the band wears. It is told by READING
|
|
59
|
+
* `HEADER_BAND` — so the classes compiled here can never drift from the
|
|
60
|
+
* classes rendered below.
|
|
61
|
+
*/
|
|
62
|
+
async function compileAppStylesheet(candidates: string[]): Promise<string> {
|
|
63
|
+
const compiler = await compile(readFileSync(APP_STYLESHEET, 'utf8'), {
|
|
64
|
+
base: dirname(APP_STYLESHEET),
|
|
65
|
+
loadStylesheet: async (id, base) => {
|
|
66
|
+
// `@import 'tailwindcss'` is a package, not a path; everything else in
|
|
67
|
+
// this tree is relative to the file that imported it.
|
|
68
|
+
const path =
|
|
69
|
+
id === 'tailwindcss' ? requirePackage.resolve('tailwindcss/index.css') : resolve(base, id);
|
|
70
|
+
return { path, base: dirname(path), content: readFileSync(path, 'utf8') };
|
|
71
|
+
},
|
|
72
|
+
loadModule: async (id, base) => {
|
|
73
|
+
const path = requirePackage.resolve(id, { paths: [base] });
|
|
74
|
+
const loaded: { default?: unknown } = await import(path);
|
|
75
|
+
return { path, base: dirname(path), module: loaded.default ?? loaded };
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
return compiler.build(candidates);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Unwrap `@layer` — the one edit this file makes to the compiler's output.
|
|
83
|
+
*
|
|
84
|
+
* happy-dom does not implement cascade layers: it parses `@layer utilities {
|
|
85
|
+
* … }` and then matches nothing inside it, so every rule Tailwind emits would
|
|
86
|
+
* be invisible and every height would read `''`. Unwrapping is safe to do
|
|
87
|
+
* here and nowhere else, because the compiled sheet is the ONLY stylesheet in
|
|
88
|
+
* the document — layers order rules against each other, and with one sheet
|
|
89
|
+
* and one rule per property there is nothing to order. The declarations
|
|
90
|
+
* themselves are untouched; this moves braces, never values.
|
|
91
|
+
*/
|
|
92
|
+
function flattenCascadeLayers(css: string): string {
|
|
93
|
+
// `@layer theme, base, components, utilities;` — the ordering statement,
|
|
94
|
+
// which has no block and nothing to unwrap.
|
|
95
|
+
let out = css.replace(/@layer[^;{]*;/g, '');
|
|
96
|
+
for (;;) {
|
|
97
|
+
const opener = /@layer[^;{]*\{/.exec(out);
|
|
98
|
+
if (!opener) return out;
|
|
99
|
+
// Walk to the matching close brace: the block holds nested rules, so the
|
|
100
|
+
// first `}` after it is almost never the right one.
|
|
101
|
+
let depth = 0;
|
|
102
|
+
let end = -1;
|
|
103
|
+
for (let i = opener.index + opener[0].length - 1; i < out.length; i++) {
|
|
104
|
+
if (out[i] === '{') depth++;
|
|
105
|
+
else if (out[i] === '}' && --depth === 0) {
|
|
106
|
+
end = i;
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
if (end === -1) throw new Error('unbalanced @layer block in the compiled stylesheet');
|
|
111
|
+
out =
|
|
112
|
+
out.slice(0, opener.index) +
|
|
113
|
+
out.slice(opener.index + opener[0].length, end) +
|
|
114
|
+
out.slice(end + 1);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* `--spacing-header` as the BUILD resolves it, read back out of the compiled
|
|
120
|
+
* CSS. Not out of `tokens.css`: a value a test parses from source is a value
|
|
121
|
+
* the test has decided for itself, and what the seam depends on is the one
|
|
122
|
+
* the browser is served. Every assertion below compares against this, so
|
|
123
|
+
* there is no second copy of the number anywhere in the file.
|
|
124
|
+
*/
|
|
125
|
+
function tokenHeightIn(css: string): string {
|
|
126
|
+
const match = css.match(/--spacing-header:\s*([^;]+);/);
|
|
127
|
+
if (!match) throw new Error('the compiled stylesheet declares no --spacing-header');
|
|
128
|
+
return match[1]!.trim();
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
let headerHeight: string;
|
|
132
|
+
|
|
133
|
+
/** The ticket's three desktop widths. */
|
|
134
|
+
const WIDTHS = [1280, 1440, 1920];
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Move the viewport. happy-dom answers `matchMedia` out of `innerWidth`, so
|
|
138
|
+
* this is how a test reaches a given desktop width — there is no window to
|
|
139
|
+
* resize. Same helper `SidebarFrameResponsive` uses to cross the narrow
|
|
140
|
+
* breakpoint.
|
|
141
|
+
*/
|
|
142
|
+
function setViewportWidth(width: number): void {
|
|
143
|
+
const testWindow = window as typeof window & {
|
|
144
|
+
happyDOM: { setInnerWidth(value: number): void };
|
|
145
|
+
};
|
|
146
|
+
testWindow.happyDOM.setInnerWidth(width);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
let stylesheet: HTMLStyleElement;
|
|
150
|
+
|
|
151
|
+
beforeAll(async () => {
|
|
152
|
+
// The candidates are the band's own classes, read off the constant the app
|
|
153
|
+
// renders — `flex h-header flex-none items-center` today, whatever it says
|
|
154
|
+
// tomorrow. `HEADER_COLUMN_TOP` rides along because the column's offset is
|
|
155
|
+
// the other half of the seam.
|
|
156
|
+
const css = await compileAppStylesheet(`${HEADER_BAND} ${HEADER_COLUMN_TOP}`.split(/\s+/));
|
|
157
|
+
|
|
158
|
+
// The compiled output has to CONTAIN the height utility, or the rest of
|
|
159
|
+
// this file is measuring an element with no rule behind it and every
|
|
160
|
+
// `auto === auto` comparison passes. This is the assertion that catches a
|
|
161
|
+
// Tailwind or configuration regression rather than a markup one.
|
|
162
|
+
expect(css).toMatch(/\.h-header\s*\{[^}]*height:\s*var\(--spacing-header\)/);
|
|
163
|
+
headerHeight = tokenHeightIn(css);
|
|
164
|
+
|
|
165
|
+
stylesheet = document.createElement('style');
|
|
166
|
+
stylesheet.textContent = flattenCascadeLayers(css);
|
|
167
|
+
document.head.appendChild(stylesheet);
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
afterAll(() => stylesheet.remove());
|
|
171
|
+
|
|
172
|
+
beforeEach(() => {
|
|
173
|
+
// A desktop width, an open sidebar, the default column — the state the seam
|
|
174
|
+
// is about. The store is module-global, so a case that collapses or drags
|
|
175
|
+
// the sidebar would otherwise hand the next one a narrow drawer.
|
|
176
|
+
setViewportWidth(WIDTHS[1]!);
|
|
177
|
+
setSidebarNarrow(false);
|
|
178
|
+
setSidebarCollapsed(false);
|
|
179
|
+
setSidebarWidth(SIDEBAR_DEFAULT_WIDTH);
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Both sides of the seam, each in the frame that owns it.
|
|
184
|
+
*
|
|
185
|
+
* The page header goes through `KbDocumentShell`, not straight into the
|
|
186
|
+
* document. That is not ceremony: the header rendered bare is exactly what
|
|
187
|
+
* this file used to assert, and it is why a 54px misalignment on the file
|
|
188
|
+
* page reached staging. A bare header has no column above it, so it cannot
|
|
189
|
+
* be anything but the first row — the test could not see the tab strip that
|
|
190
|
+
* was pushing it down, because in the test the tab strip did not exist.
|
|
191
|
+
*
|
|
192
|
+
* `children` is a stand-in for that tab strip: something the page renders
|
|
193
|
+
* inside the column BESIDE the title bar. If the band ever stops opening the
|
|
194
|
+
* column, this is where it shows.
|
|
195
|
+
*/
|
|
196
|
+
function renderSeam() {
|
|
197
|
+
return render(
|
|
198
|
+
<>
|
|
199
|
+
<SidebarFrame label="File explorer" header={<div>Connect your agent</div>}>
|
|
200
|
+
<nav>tree</nav>
|
|
201
|
+
</SidebarFrame>
|
|
202
|
+
<KbDocumentShell header={<PageHeader />}>
|
|
203
|
+
<div role="tablist" aria-label="Open files">
|
|
204
|
+
<span>Onboarding.md</span>
|
|
205
|
+
</div>
|
|
206
|
+
<p>The document</p>
|
|
207
|
+
</KbDocumentShell>
|
|
208
|
+
</>,
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
function PageHeader() {
|
|
213
|
+
return (
|
|
214
|
+
<KbPageHeader
|
|
215
|
+
path="Knowledge/Onboarding.md"
|
|
216
|
+
canWrite
|
|
217
|
+
editMode={false}
|
|
218
|
+
entering={false}
|
|
219
|
+
proposeMode={false}
|
|
220
|
+
proposalBusy={false}
|
|
221
|
+
onPropose={() => {}}
|
|
222
|
+
onSendProposal={() => {}}
|
|
223
|
+
onDiscardProposal={() => {}}
|
|
224
|
+
lockedBy={null}
|
|
225
|
+
historyAvailable
|
|
226
|
+
isDirty={false}
|
|
227
|
+
waitingOnAgentUpdate={false}
|
|
228
|
+
isReviewingPending={false}
|
|
229
|
+
activeTab="content"
|
|
230
|
+
onEdit={() => {}}
|
|
231
|
+
onDone={() => {}}
|
|
232
|
+
onOpenHistory={() => {}}
|
|
233
|
+
onShare={() => {}}
|
|
234
|
+
onCopyLink={async () => true}
|
|
235
|
+
/>
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
const heightOf = (testId: string) =>
|
|
240
|
+
window.getComputedStyle(screen.getByTestId(testId)).height;
|
|
241
|
+
|
|
242
|
+
/** The column a band opens — the element the band is the first row of. */
|
|
243
|
+
const columnOf = (testId: string) => screen.getByTestId(testId).parentElement!;
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Everything drawn above a band inside its own column.
|
|
247
|
+
*
|
|
248
|
+
* Zero is the contract. Anything here is vertical space between the column's
|
|
249
|
+
* top edge and the band's, which moves the band down by exactly that much and
|
|
250
|
+
* breaks the seam however precisely the two heights agree.
|
|
251
|
+
*/
|
|
252
|
+
function drawnAbove(testId: string): Element[] {
|
|
253
|
+
const band = screen.getByTestId(testId);
|
|
254
|
+
const siblings: Element[] = [];
|
|
255
|
+
for (let node = band.previousElementSibling; node; node = node.previousElementSibling) {
|
|
256
|
+
siblings.push(node);
|
|
257
|
+
}
|
|
258
|
+
return siblings;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
describe('the sidebar header row and the page title bar', () => {
|
|
262
|
+
it.each(WIDTHS)('are the same height at %ipx wide', (width) => {
|
|
263
|
+
setViewportWidth(width);
|
|
264
|
+
renderSeam();
|
|
265
|
+
|
|
266
|
+
expect(heightOf(SIDEBAR_HEADER_TESTID)).toBe(heightOf(PAGE_HEADER_TESTID));
|
|
267
|
+
// And it is the TOKEN's height, not two elements agreeing on `auto`:
|
|
268
|
+
// `auto === auto` would pass the line above while the page rendered as
|
|
269
|
+
// broken as it did before the fix.
|
|
270
|
+
expect(heightOf(SIDEBAR_HEADER_TESTID)).toBe(headerHeight);
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
it('keeps the page title bar the same height while the sidebar collapses and reopens', () => {
|
|
274
|
+
renderSeam();
|
|
275
|
+
const open = heightOf(PAGE_HEADER_TESTID);
|
|
276
|
+
|
|
277
|
+
// Collapsing is a WIDTH change on the frame; nothing about it may reach
|
|
278
|
+
// the height of either header. The sidebar's own row goes with it, so the
|
|
279
|
+
// assertion that matters on the way through is the page's.
|
|
280
|
+
toggleSidebar();
|
|
281
|
+
expect(heightOf(PAGE_HEADER_TESTID)).toBe(open);
|
|
282
|
+
expect(heightOf(SIDEBAR_HEADER_TESTID)).toBe(open);
|
|
283
|
+
|
|
284
|
+
toggleSidebar();
|
|
285
|
+
expect(heightOf(PAGE_HEADER_TESTID)).toBe(open);
|
|
286
|
+
expect(heightOf(SIDEBAR_HEADER_TESTID)).toBe(open);
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
it('keeps both heights while the sidebar is being resized', () => {
|
|
290
|
+
renderSeam();
|
|
291
|
+
|
|
292
|
+
// The narrowest the frame allows, a width in the middle, and the widest —
|
|
293
|
+
// the span a drag covers. The header row is `w-full` inside the column,
|
|
294
|
+
// so a width that changed its height would mean the row had started
|
|
295
|
+
// wrapping: the failure the band and the title's `truncate` prevent.
|
|
296
|
+
// `false` is the mid-drag write, the one that does not persist.
|
|
297
|
+
for (const width of [SIDEBAR_MIN_WIDTH, SIDEBAR_DEFAULT_WIDTH, SIDEBAR_MAX_WIDTH]) {
|
|
298
|
+
setSidebarWidth(width, false);
|
|
299
|
+
expect(heightOf(SIDEBAR_HEADER_TESTID)).toBe(heightOf(PAGE_HEADER_TESTID));
|
|
300
|
+
expect(heightOf(SIDEBAR_HEADER_TESTID)).toBe(headerHeight);
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
it('reserves the row for a header that draws nothing', () => {
|
|
305
|
+
// Knowledge and the Library both pass the connect-your-agent pill, which
|
|
306
|
+
// renders NOTHING once onboarding is done. If the row collapsed with it,
|
|
307
|
+
// the page's title bar would be left lined up against a nav that had
|
|
308
|
+
// moved a band's height up — the seam would break for exactly the people
|
|
309
|
+
// who have finished setting the product up.
|
|
310
|
+
const DismissedPill = () => null;
|
|
311
|
+
render(
|
|
312
|
+
<SidebarFrame label="File explorer" header={<DismissedPill />}>
|
|
313
|
+
<nav>tree</nav>
|
|
314
|
+
</SidebarFrame>,
|
|
315
|
+
);
|
|
316
|
+
expect(heightOf(SIDEBAR_HEADER_TESTID)).toBe(headerHeight);
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
it('renders no band for a surface that declares no header', () => {
|
|
320
|
+
// Settings fills the same frame with no header slot and has no title bar
|
|
321
|
+
// on the other side of the seam. A band there would be a band's worth of
|
|
322
|
+
// empty space above its nav, holding a line with nothing.
|
|
323
|
+
render(
|
|
324
|
+
<SidebarFrame label="Settings">
|
|
325
|
+
<nav>settings</nav>
|
|
326
|
+
</SidebarFrame>,
|
|
327
|
+
);
|
|
328
|
+
expect(screen.queryByTestId(SIDEBAR_HEADER_TESTID)).toBeNull();
|
|
329
|
+
});
|
|
330
|
+
});
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* The other half of AC1, and the half that reached staging: the two bands
|
|
334
|
+
* have to START at the same place, not merely be the same height.
|
|
335
|
+
*
|
|
336
|
+
* These assertions are STRUCTURAL, and deliberately so. happy-dom has no
|
|
337
|
+
* layout engine — `getBoundingClientRect` answers an all-zero rect for every
|
|
338
|
+
* element — so a top edge is not a thing this suite can measure, and a test
|
|
339
|
+
* that pretended to would compare 0 with 0 and pass through anything. What
|
|
340
|
+
* IS checkable is the two facts that together fix the top edge: each column
|
|
341
|
+
* opens on the same offset, and the band is the first thing in it. Break
|
|
342
|
+
* either and the seam moves; hold both and it cannot.
|
|
343
|
+
*
|
|
344
|
+
* A real browser measured the consequence: Staging Testing put the sidebar
|
|
345
|
+
* band and the library band at y=61 and the file page's at y=115.13, because
|
|
346
|
+
* the file page held the second fact and nothing checked it.
|
|
347
|
+
*/
|
|
348
|
+
describe('the two bands open at the same offset', () => {
|
|
349
|
+
it('each opens the column it is in — nothing is drawn above either', () => {
|
|
350
|
+
renderSeam();
|
|
351
|
+
expect(drawnAbove(SIDEBAR_HEADER_TESTID)).toEqual([]);
|
|
352
|
+
expect(drawnAbove(PAGE_HEADER_TESTID)).toEqual([]);
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
it('the page column holds what used to sit above the band, below it', () => {
|
|
356
|
+
renderSeam();
|
|
357
|
+
const band = screen.getByTestId(PAGE_HEADER_TESTID);
|
|
358
|
+
const tabs = screen.getByRole('tablist', { name: 'Open files' });
|
|
359
|
+
// Same column — the tab strip did not move out of the measure, it moved
|
|
360
|
+
// under the title (proto:700-705 keeps one column; this changes the order
|
|
361
|
+
// inside it).
|
|
362
|
+
expect(tabs.parentElement).toBe(band.parentElement);
|
|
363
|
+
expect(band.compareDocumentPosition(tabs) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
it('both columns open on the one shared offset', () => {
|
|
367
|
+
renderSeam();
|
|
368
|
+
// Not "both contain pt-3": both contain the SAME constant, read from the
|
|
369
|
+
// module the app renders, so a change to it moves this test with it.
|
|
370
|
+
for (const testId of [SIDEBAR_HEADER_TESTID, PAGE_HEADER_TESTID]) {
|
|
371
|
+
expect(columnOf(testId).className.split(/\s+/)).toContain(HEADER_COLUMN_TOP);
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
|
|
375
|
+
it('a full-bleed page opens on that offset too', () => {
|
|
376
|
+
// The variant a PDF, an image or a spreadsheet gets. It gives up the
|
|
377
|
+
// measure and the gutters — it used to give up the offset with them, and
|
|
378
|
+
// its title bar sat a column-offset higher than the sidebar's row.
|
|
379
|
+
render(
|
|
380
|
+
<KbDocumentShell variant="full-bleed" header={<PageHeader />}>
|
|
381
|
+
<iframe title="A PDF" />
|
|
382
|
+
</KbDocumentShell>,
|
|
383
|
+
);
|
|
384
|
+
expect(drawnAbove(PAGE_HEADER_TESTID)).toEqual([]);
|
|
385
|
+
expect(columnOf(PAGE_HEADER_TESTID).className.split(/\s+/)).toContain(HEADER_COLUMN_TOP);
|
|
386
|
+
});
|
|
387
|
+
|
|
388
|
+
it('a page with a rail opens on it as well', () => {
|
|
389
|
+
render(
|
|
390
|
+
<KbDocumentShell header={<PageHeader />} rail={<p>About this file</p>}>
|
|
391
|
+
<p>The document</p>
|
|
392
|
+
</KbDocumentShell>,
|
|
393
|
+
);
|
|
394
|
+
expect(drawnAbove(PAGE_HEADER_TESTID)).toEqual([]);
|
|
395
|
+
// Here the offset is on the grid the article sits in, so the band's own
|
|
396
|
+
// parent is the article and the offset is one level up.
|
|
397
|
+
const article = columnOf(PAGE_HEADER_TESTID);
|
|
398
|
+
expect(article.tagName).toBe('ARTICLE');
|
|
399
|
+
expect(article.parentElement!.className.split(/\s+/)).toContain(HEADER_COLUMN_TOP);
|
|
400
|
+
});
|
|
401
|
+
});
|