@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
|
@@ -8,11 +8,12 @@ import {
|
|
|
8
8
|
/**
|
|
9
9
|
* The ways an agent connects, named by PRODUCT rather than surface —
|
|
10
10
|
* someone knows which assistant they use before they know which build of it
|
|
11
|
-
* they are in (prototype `AGENT_CLIENTS`).
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
11
|
+
* they are in (prototype `AGENT_CLIENTS`). Claude and ChatGPT lead, and
|
|
12
|
+
* Claude is the page's default: they are what most people arriving here
|
|
13
|
+
* already use, and Claude's is the one connection that is a single click.
|
|
14
|
+
* Desktop agents follow — the local server still serves everything the hosted
|
|
15
|
+
* endpoint does PLUS the plugins' local-only tools, but it asks for Node and a
|
|
16
|
+
* config file, which is the wrong first thing to put in front of everyone.
|
|
16
17
|
*
|
|
17
18
|
* This file is now the welcome page's PICKER and nothing else: which clients
|
|
18
19
|
* to offer, what to call them, and how to say where the snippet goes. The
|
|
@@ -31,42 +32,73 @@ import {
|
|
|
31
32
|
export interface AgentClient {
|
|
32
33
|
id: 'claude' | 'chatgpt' | 'other' | 'local';
|
|
33
34
|
label: string;
|
|
34
|
-
/**
|
|
35
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Where the snippet goes, said as the path through that client's own UI. A
|
|
37
|
+
* list renders as numbered steps — for a path with enough turns that one
|
|
38
|
+
* sentence of arrows loses people halfway.
|
|
39
|
+
*/
|
|
40
|
+
hint: string | string[];
|
|
36
41
|
/** What the copy button carries for this client. */
|
|
37
42
|
snip(mcpUrl: string): string;
|
|
38
43
|
}
|
|
39
44
|
|
|
40
45
|
export const AGENT_CLIENTS: AgentClient[] = [
|
|
41
|
-
{
|
|
42
|
-
id: 'local',
|
|
43
|
-
label: 'Desktop agents',
|
|
44
|
-
hint: 'Recommended for Claude Code, Claude Desktop, Cursor, Windsurf, Cline and any agent that runs on your machine: everything the options below give, plus your plugins’ local-only tools. Needs Node. The first time it starts, your browser opens so you can sign in.',
|
|
45
|
-
// The passed endpoint is deliberately unused: the local server takes the
|
|
46
|
-
// WORKSPACE address and asks it for the MCP endpoint itself
|
|
47
|
-
// (`GET /api/config`), so the URL every other client pastes is the wrong
|
|
48
|
-
// value here — see `workspaceBaseUrl`.
|
|
49
|
-
snip: () => hexisMcpJsonSnippet(workspaceBaseUrl()),
|
|
50
|
-
},
|
|
51
46
|
{
|
|
52
47
|
id: 'claude',
|
|
53
48
|
label: 'Claude',
|
|
54
|
-
hint: 'For claude.ai
|
|
49
|
+
hint: 'For claude.ai and Claude Desktop: Settings → Connectors → Add custom connector, then paste this. (For your plugins’ local-only tools, pick Desktop agents.)',
|
|
55
50
|
snip: (url) => url,
|
|
56
51
|
},
|
|
57
52
|
{
|
|
58
53
|
id: 'chatgpt',
|
|
59
54
|
label: 'ChatGPT',
|
|
60
|
-
//
|
|
61
|
-
//
|
|
55
|
+
// ChatGPT renamed the page under our feet: as of 2026-09 it is Plugins
|
|
56
|
+
// (Plugin Management, Browse plugins, Developer Mode), where it used to be
|
|
57
|
+
// Apps & Connectors with Developer mode under Advanced. Each step names
|
|
58
|
+
// both, so whichever build someone is on, the words on their screen are in
|
|
59
|
+
// the steps. Developer Mode comes before Create because it is off by
|
|
60
|
+
// default and hides that button. The name is spelled out because, unlike
|
|
62
61
|
// Claude, ChatGPT has no link that prefills it.
|
|
63
|
-
hint:
|
|
62
|
+
hint: [
|
|
63
|
+
'Open Settings in ChatGPT.',
|
|
64
|
+
'Open Plugins (called Apps & Connectors in older versions).',
|
|
65
|
+
'Turn on Developer Mode (under Advanced in older versions).',
|
|
66
|
+
'Go back and choose Create (or Add).',
|
|
67
|
+
`Name it “${MCP_DISPLAY_NAME}”.`,
|
|
68
|
+
'Paste the address below, then save.',
|
|
69
|
+
],
|
|
64
70
|
snip: (url) => url,
|
|
65
71
|
},
|
|
72
|
+
{
|
|
73
|
+
id: 'local',
|
|
74
|
+
label: 'Desktop agents',
|
|
75
|
+
// The PATH sentence is the second half of this hint because it is the
|
|
76
|
+
// failure people actually hit. A GUI-launched app — Cursor, or Claude
|
|
77
|
+
// Desktop on macOS — is started by the window server rather than by a
|
|
78
|
+
// login shell, so it never sources the profile that put Homebrew's or
|
|
79
|
+
// nvm's `npx` on PATH: the configuration is correct and the client still
|
|
80
|
+
// reports that npx was not found. The way out is a substitution the
|
|
81
|
+
// READER makes in their own copy, which is why the snippet itself stays
|
|
82
|
+
// the plain `npx` that works everywhere else. The absolute path alone is
|
|
83
|
+
// not always enough: `npx` is a script whose `#!/usr/bin/env node` line
|
|
84
|
+
// hits the SAME gap, so the PATH sentence has to name that second failure
|
|
85
|
+
// and its fix (the client config's own "env") rather than stop at the
|
|
86
|
+
// first.
|
|
87
|
+
hint: 'For Claude Code, Claude Desktop, Cursor, Windsurf, Cline and any agent that runs on your machine: everything the hosted address gives, plus your plugins’ local-only tools. Needs Node 22.13+ or 24. The first time it starts, your browser opens so you can sign in. If the client reports that npx was not found, it was launched from the Dock or a desktop icon and cannot see your shell’s PATH — run `which npx` in a terminal (`where.exe npx` in PowerShell) and put the full path it prints in place of "npx" in the configuration below (on Windows, double each backslash or use forward slashes — the field is JSON); if it then reports `env: node: No such file or directory`, that folder holds `node` too, so add it to the configuration’s "env" PATH — in front of the usual system folders, not instead of them, since the sign-in opens your browser through them.',
|
|
88
|
+
// The passed endpoint is deliberately unused: the local server takes the
|
|
89
|
+
// WORKSPACE address and asks it for the MCP endpoint itself
|
|
90
|
+
// (`GET /api/config`), so the URL every other client pastes is the wrong
|
|
91
|
+
// value here — see `workspaceBaseUrl`.
|
|
92
|
+
snip: () => hexisMcpJsonSnippet(workspaceBaseUrl()),
|
|
93
|
+
},
|
|
66
94
|
{
|
|
67
95
|
id: 'other',
|
|
68
|
-
label: 'Other',
|
|
69
|
-
|
|
96
|
+
label: 'Other tools',
|
|
97
|
+
// What to DO with the config, not what kind of client reads it: the reader
|
|
98
|
+
// is a business user for whom "a JSON config" says nothing. The page puts
|
|
99
|
+
// the bare address right after this, because plenty of tools take a URL
|
|
100
|
+
// and nothing else.
|
|
101
|
+
hint: 'For any other AI tool that supports MCP servers. Open the tool’s settings, find MCP servers (also called connectors or integrations), choose add, and paste this configuration. If the tool asks for an address only, paste this instead:',
|
|
70
102
|
snip: (url) => jsonConfigSnippet(url),
|
|
71
103
|
},
|
|
72
104
|
];
|
|
@@ -82,7 +82,11 @@ function RoutedConnectAgentPill() {
|
|
|
82
82
|
return (
|
|
83
83
|
<div
|
|
84
84
|
className={cn(
|
|
85
|
-
|
|
85
|
+
// No margin of its own: this fills `SidebarFrame`'s header band,
|
|
86
|
+
// whose height is the shared `--spacing-header` token. A margin here
|
|
87
|
+
// would be a second number deciding how tall the sidebar's header
|
|
88
|
+
// row is, which is exactly the drift the band removes.
|
|
89
|
+
'group/pill flex w-full min-w-0 flex-none items-center rounded-full transition-colors',
|
|
86
90
|
selected
|
|
87
91
|
? 'bg-accent/15'
|
|
88
92
|
: 'bg-accent/8 hover:bg-accent/15 motion-safe:animate-onboarding-pulse-slow',
|
|
@@ -38,8 +38,7 @@ export function WelcomePage() {
|
|
|
38
38
|
const onboarding = useOnboarding();
|
|
39
39
|
const toast = useLibraryToast();
|
|
40
40
|
const navigate = useNavigate();
|
|
41
|
-
const [clientId, setClientId] = useState<AgentClient['id']>('
|
|
42
|
-
const [copied, setCopied] = useState<'idle' | 'ok' | 'fail'>('idle');
|
|
41
|
+
const [clientId, setClientId] = useState<AgentClient['id']>('claude');
|
|
43
42
|
|
|
44
43
|
// Once, on arrival — this is what makes the welcome redirect one-time.
|
|
45
44
|
const { markWelcomed } = onboarding;
|
|
@@ -154,9 +153,8 @@ export function WelcomePage() {
|
|
|
154
153
|
// The deployment's own address, not the browser's — see `shared/mcp`.
|
|
155
154
|
const mcpUrl = mcpEndpointUrl();
|
|
156
155
|
const snippet = client.snip(mcpUrl);
|
|
157
|
-
// Capitalized
|
|
158
|
-
//
|
|
159
|
-
// to their face on the one page addressed to them.
|
|
156
|
+
// Capitalized here rather than at the call site — "Welcome, juan" is the app
|
|
157
|
+
// misspelling someone to their face on the one page addressed to them.
|
|
160
158
|
const firstName = displayFirstName(user?.name) || 'there';
|
|
161
159
|
|
|
162
160
|
const radios = useRef<(HTMLButtonElement | null)[]>([]);
|
|
@@ -171,7 +169,7 @@ export function WelcomePage() {
|
|
|
171
169
|
* Selection FOLLOWS focus, which is the pattern's default for a plugin this
|
|
172
170
|
* cheap to change — picking a client re-renders one snippet, nothing is
|
|
173
171
|
* submitted, so there is no cost to arriving on an option and no reason to
|
|
174
|
-
* make people confirm. Wraps at both ends:
|
|
172
|
+
* make people confirm. Wraps at both ends: four options in a row have no
|
|
175
173
|
* meaningful edge to stop at.
|
|
176
174
|
*
|
|
177
175
|
* Paired with the roving `tabIndex` below — one stop for the whole plugin,
|
|
@@ -191,30 +189,6 @@ export function WelcomePage() {
|
|
|
191
189
|
radios.current[next]?.focus();
|
|
192
190
|
}
|
|
193
191
|
|
|
194
|
-
// One timer, cleared before it is replaced: a second copy inside the 1.5s
|
|
195
|
-
// window would otherwise inherit the FIRST copy's expiry and blank the
|
|
196
|
-
// checkmark almost immediately.
|
|
197
|
-
const resetTimer = useRef<number | undefined>(undefined);
|
|
198
|
-
useEffect(() => () => window.clearTimeout(resetTimer.current), []);
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* Copy the snippet currently on screen, and say so — as a checkmark for
|
|
202
|
-
* anyone watching and as a live-region announcement for anyone not. A
|
|
203
|
-
* failure is reported, never swallowed: the toast names the alternative
|
|
204
|
-
* (select the text) instead of leaving a button that silently did nothing.
|
|
205
|
-
*/
|
|
206
|
-
async function copySnippet() {
|
|
207
|
-
const ok = await copyToClipboard(snippet);
|
|
208
|
-
if (!ok) toast(COPY_FAILED_TOAST, 'danger');
|
|
209
|
-
window.clearTimeout(resetTimer.current);
|
|
210
|
-
// Back to idle FIRST, so a repeat copy is a real state change and the
|
|
211
|
-
// live region announces it again — setting 'ok' over 'ok' is a no-op that
|
|
212
|
-
// says nothing to a screen reader.
|
|
213
|
-
setCopied('idle');
|
|
214
|
-
window.setTimeout(() => setCopied(ok ? 'ok' : 'fail'), 0);
|
|
215
|
-
resetTimer.current = window.setTimeout(() => setCopied('idle'), 1500);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
192
|
// Both exits land in the same place. Whether you connected an agent or
|
|
219
193
|
// walked past it, where you want to be next is somewhere you can start —
|
|
220
194
|
// by default your own shelf, not the whole company's catalog. A deep link
|
|
@@ -312,7 +286,15 @@ export function WelcomePage() {
|
|
|
312
286
|
))}
|
|
313
287
|
</div>
|
|
314
288
|
|
|
315
|
-
|
|
289
|
+
{Array.isArray(client.hint) ? (
|
|
290
|
+
<ol className="mt-2.5 list-decimal space-y-0.5 pl-5 text-meta leading-normal text-ink-faint">
|
|
291
|
+
{client.hint.map((step) => (
|
|
292
|
+
<li key={step}>{step}</li>
|
|
293
|
+
))}
|
|
294
|
+
</ol>
|
|
295
|
+
) : (
|
|
296
|
+
<p className="mt-2.5 text-meta leading-normal text-ink-faint">{client.hint}</p>
|
|
297
|
+
)}
|
|
316
298
|
|
|
317
299
|
{/* The web assistants only: Claude's link prefills the connector,
|
|
318
300
|
ChatGPT's opens the settings pane it is created in. Both render
|
|
@@ -324,37 +306,16 @@ export function WelcomePage() {
|
|
|
324
306
|
{client.id === 'claude' && <ClaudeInstallLink mcpUrl={mcpUrl} className="mt-3.5" />}
|
|
325
307
|
{client.id === 'chatgpt' && <ChatGptInstallLink mcpUrl={mcpUrl} className="mt-3.5" />}
|
|
326
308
|
|
|
327
|
-
{/*
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
</div>
|
|
338
|
-
<IconButton
|
|
339
|
-
size={24}
|
|
340
|
-
aria-label="Copy"
|
|
341
|
-
title="Copy"
|
|
342
|
-
onClick={() => void copySnippet()}
|
|
343
|
-
className="absolute right-2 top-2"
|
|
344
|
-
>
|
|
345
|
-
{copied === 'ok' ? (
|
|
346
|
-
<Check size={13} className="text-ok" />
|
|
347
|
-
) : copied === 'fail' ? (
|
|
348
|
-
<X size={13} className="text-danger" />
|
|
349
|
-
) : (
|
|
350
|
-
<Copy size={13} />
|
|
351
|
-
)}
|
|
352
|
-
</IconButton>
|
|
353
|
-
{/* The icon's answer, said out loud for anyone not watching it. */}
|
|
354
|
-
<span role="status" aria-live="polite" className="sr-only">
|
|
355
|
-
{copied === 'ok' ? 'Copied' : copied === 'fail' ? 'Copy failed' : ''}
|
|
356
|
-
</span>
|
|
357
|
-
</div>
|
|
309
|
+
{/* Other tools: the hint ends on "paste this instead:", so the bare
|
|
310
|
+
address comes first, then the configuration it points back to.
|
|
311
|
+
Many tools take a URL and nothing else. */}
|
|
312
|
+
{client.id === 'other' && (
|
|
313
|
+
<SnippetBlock value={mcpUrl} copyLabel="Copy address" className="mt-3.5" />
|
|
314
|
+
)}
|
|
315
|
+
|
|
316
|
+
{/* Keyed by client, so a checkmark earned on one option does not
|
|
317
|
+
linger on the next option's snippet. */}
|
|
318
|
+
<SnippetBlock key={client.id} value={snippet} copyLabel="Copy" className="mt-3.5" />
|
|
358
319
|
|
|
359
320
|
<div className="mt-5 flex items-center gap-4">
|
|
360
321
|
<Button
|
|
@@ -382,3 +343,78 @@ export function WelcomePage() {
|
|
|
382
343
|
</div>
|
|
383
344
|
);
|
|
384
345
|
}
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* One snippet and the button that copies it — the copy rides the block it
|
|
349
|
+
* copies. Its own component so a tab can carry two (Other tools shows the
|
|
350
|
+
* bare address AND the configuration), each with its own checkmark.
|
|
351
|
+
*
|
|
352
|
+
* Copying says so as a checkmark for anyone watching and as a live-region
|
|
353
|
+
* announcement for anyone not. A failure is reported, never swallowed: the
|
|
354
|
+
* toast names the alternative (select the text) instead of leaving a button
|
|
355
|
+
* that silently did nothing.
|
|
356
|
+
*/
|
|
357
|
+
function SnippetBlock({
|
|
358
|
+
value,
|
|
359
|
+
copyLabel,
|
|
360
|
+
className,
|
|
361
|
+
}: {
|
|
362
|
+
value: string;
|
|
363
|
+
/** The button's accessible name — distinct per block when a tab has two. */
|
|
364
|
+
copyLabel: string;
|
|
365
|
+
className?: string;
|
|
366
|
+
}) {
|
|
367
|
+
const toast = useLibraryToast();
|
|
368
|
+
const [copied, setCopied] = useState<'idle' | 'ok' | 'fail'>('idle');
|
|
369
|
+
|
|
370
|
+
// One timer, cleared before it is replaced: a second copy inside the 1.5s
|
|
371
|
+
// window would otherwise inherit the FIRST copy's expiry and blank the
|
|
372
|
+
// checkmark almost immediately.
|
|
373
|
+
const resetTimer = useRef<number | undefined>(undefined);
|
|
374
|
+
useEffect(() => () => window.clearTimeout(resetTimer.current), []);
|
|
375
|
+
|
|
376
|
+
async function copy() {
|
|
377
|
+
const ok = await copyToClipboard(value);
|
|
378
|
+
if (!ok) toast(COPY_FAILED_TOAST, 'danger');
|
|
379
|
+
window.clearTimeout(resetTimer.current);
|
|
380
|
+
// Back to idle FIRST, so a repeat copy is a real state change and the
|
|
381
|
+
// live region announces it again — setting 'ok' over 'ok' is a no-op that
|
|
382
|
+
// says nothing to a screen reader.
|
|
383
|
+
setCopied('idle');
|
|
384
|
+
window.setTimeout(() => setCopied(ok ? 'ok' : 'fail'), 0);
|
|
385
|
+
resetTimer.current = window.setTimeout(() => setCopied('idle'), 1500);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
return (
|
|
389
|
+
<div className={cn('relative', className)}>
|
|
390
|
+
<div
|
|
391
|
+
className={cn(
|
|
392
|
+
'overflow-x-auto rounded-lg border border-line bg-sunken py-2.5 pl-3 pr-10',
|
|
393
|
+
'font-mono text-detail text-ink',
|
|
394
|
+
value.includes('\n') ? 'whitespace-pre' : 'whitespace-nowrap',
|
|
395
|
+
)}
|
|
396
|
+
>
|
|
397
|
+
{value}
|
|
398
|
+
</div>
|
|
399
|
+
<IconButton
|
|
400
|
+
size={24}
|
|
401
|
+
aria-label={copyLabel}
|
|
402
|
+
title={copyLabel}
|
|
403
|
+
onClick={() => void copy()}
|
|
404
|
+
className="absolute right-2 top-2"
|
|
405
|
+
>
|
|
406
|
+
{copied === 'ok' ? (
|
|
407
|
+
<Check size={13} className="text-ok" />
|
|
408
|
+
) : copied === 'fail' ? (
|
|
409
|
+
<X size={13} className="text-danger" />
|
|
410
|
+
) : (
|
|
411
|
+
<Copy size={13} />
|
|
412
|
+
)}
|
|
413
|
+
</IconButton>
|
|
414
|
+
{/* The icon's answer, said out loud for anyone not watching it. */}
|
|
415
|
+
<span role="status" aria-live="polite" className="sr-only">
|
|
416
|
+
{copied === 'ok' ? 'Copied' : copied === 'fail' ? 'Copy failed' : ''}
|
|
417
|
+
</span>
|
|
418
|
+
</div>
|
|
419
|
+
);
|
|
420
|
+
}
|
|
@@ -9,7 +9,8 @@ export interface MergeAccepted {
|
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Trigger the server-side merge. `bypass: true` tells the gate to proceed
|
|
12
|
-
* despite
|
|
12
|
+
* despite missing approvals (unapproved files of any type that have an
|
|
13
|
+
* eligible approver); the bypassed list
|
|
13
14
|
* is inlined in the merge commit body for audit. Hard blocks (PR closed,
|
|
14
15
|
* no files) are refused regardless.
|
|
15
16
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
import Markdown from 'react-markdown';
|
|
3
|
-
import type
|
|
3
|
+
import { isFrontmatterFence, type FileDiffPayload } from '@bevel-software/platform-shared';
|
|
4
4
|
import { computeDiff, type DiffLine } from '../../workspace/utils/diff';
|
|
5
5
|
import { parseFrontmatter, labelFor, type FrontmatterData } from '../../workspace/utils/frontmatter';
|
|
6
6
|
import { escapeSpacesInLinkDestinations } from '../../../shared/markdown/Markdown';
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
KB_REMARK_PLUGINS,
|
|
9
9
|
KB_DIFF_REHYPE_PLUGINS,
|
|
10
10
|
useKbMarkdownComponents,
|
|
11
|
+
type KbImageResolver,
|
|
11
12
|
} from '../../workspace/components/renderers/kbMarkdownPipeline';
|
|
12
13
|
|
|
13
14
|
const MAX_RENDERED_LINES = 5000;
|
|
@@ -29,6 +30,15 @@ interface MarkdownDiffViewerProps {
|
|
|
29
30
|
onOpenFile?: (href: string) => void;
|
|
30
31
|
/** Same contract as {@link onOpenFile}, for bare node-id links. */
|
|
31
32
|
onOpenNodeId?: (id: string) => void;
|
|
33
|
+
/**
|
|
34
|
+
* Resolves a workspace image in the diff to the URL that serves it from the
|
|
35
|
+
* CHECKED-OUT tree. It applies to unchanged and added fragments only; a
|
|
36
|
+
* removed fragment never fetches (see `DiffPreview`). Omitted → every
|
|
37
|
+
* workspace image is named rather than shown, which is the honest default
|
|
38
|
+
* for a view of another revision: the change-request dialog and the file
|
|
39
|
+
* history pass none.
|
|
40
|
+
*/
|
|
41
|
+
resolveImage?: KbImageResolver;
|
|
32
42
|
/**
|
|
33
43
|
* Whether this view owns a scroller and its own padding. `true` (the
|
|
34
44
|
* default) keeps the self-contained box the change-request dialog and the
|
|
@@ -67,7 +77,7 @@ interface MarkdownDiffViewerProps {
|
|
|
67
77
|
* routes, which sit outside those providers entirely. A `useNavigate()` in
|
|
68
78
|
* here would be a runtime crash in all three.
|
|
69
79
|
*/
|
|
70
|
-
export function MarkdownDiffViewer({ payload, onOpenFile, onOpenNodeId, scroll = true }: MarkdownDiffViewerProps) {
|
|
80
|
+
export function MarkdownDiffViewer({ payload, onOpenFile, onOpenNodeId, resolveImage, scroll = true }: MarkdownDiffViewerProps) {
|
|
71
81
|
const data = useMemo(() => {
|
|
72
82
|
const baseline = payload.baseline ?? '';
|
|
73
83
|
const current = payload.current ?? '';
|
|
@@ -124,6 +134,7 @@ export function MarkdownDiffViewer({ payload, onOpenFile, onOpenNodeId, scroll =
|
|
|
124
134
|
blocks={data.bodyBlocks}
|
|
125
135
|
onOpenFile={onOpenFile}
|
|
126
136
|
onOpenNodeId={onOpenNodeId}
|
|
137
|
+
resolveImage={resolveImage}
|
|
127
138
|
/>
|
|
128
139
|
</div>
|
|
129
140
|
);
|
|
@@ -145,10 +156,13 @@ function countNewlines(s: string): number {
|
|
|
145
156
|
* frontmatter so callers can skip the frontmatter-split logic.
|
|
146
157
|
*/
|
|
147
158
|
function frontmatterLineCount(content: string): number {
|
|
148
|
-
|
|
149
|
-
|
|
159
|
+
// The platform's fence rule, not a second one: `parseFrontmatter` (the panel
|
|
160
|
+
// beside this diff) splits with the same rule, so a near-miss fence cannot
|
|
161
|
+
// fill the panel while its lines are rendered as body.
|
|
162
|
+
const lines = content.split('\n');
|
|
163
|
+
if (!isFrontmatterFence(lines[0])) return 0;
|
|
150
164
|
for (let i = 1; i < lines.length; i++) {
|
|
151
|
-
if (lines[i]
|
|
165
|
+
if (isFrontmatterFence(lines[i])) return i + 1;
|
|
152
166
|
}
|
|
153
167
|
return 0;
|
|
154
168
|
}
|
|
@@ -281,11 +295,35 @@ function DiffPreview({
|
|
|
281
295
|
blocks,
|
|
282
296
|
onOpenFile,
|
|
283
297
|
onOpenNodeId,
|
|
298
|
+
resolveImage,
|
|
284
299
|
}: {
|
|
285
300
|
blocks: DisplayBlock[];
|
|
286
301
|
onOpenFile?: (href: string) => void;
|
|
287
302
|
onOpenNodeId?: (id: string) => void;
|
|
303
|
+
resolveImage?: KbImageResolver;
|
|
288
304
|
}) {
|
|
305
|
+
// Images, per fragment. The caller's resolver serves the CURRENT tree, which
|
|
306
|
+
// is right for an unchanged or an added image and wrong for a removed one: a
|
|
307
|
+
// screenshot replaced under the same name would show the new bytes on both
|
|
308
|
+
// sides, a picture of no change. Removed fragments therefore never fetch;
|
|
309
|
+
// they name the file. With no resolver at all (the change-request dialog and
|
|
310
|
+
// the file history, both views of a revision other than the checked-out
|
|
311
|
+
// tree) every workspace image is named rather than fetched. Serving bytes at
|
|
312
|
+
// a ref is the `?ref=` item in TODOS.md. External images pass through on
|
|
313
|
+
// every side; the pipeline never consults a resolver for those.
|
|
314
|
+
const liveImages = useMemo<KbImageResolver>(
|
|
315
|
+
() => resolveImage ?? ((src) => ({ src: null, path: src, note: 'Image not shown' })),
|
|
316
|
+
[resolveImage],
|
|
317
|
+
);
|
|
318
|
+
const baselineImages = useMemo<KbImageResolver>(
|
|
319
|
+
() => (src) => ({
|
|
320
|
+
src: null,
|
|
321
|
+
path: resolveImage?.(src)?.path ?? src,
|
|
322
|
+
note: 'Baseline image not shown',
|
|
323
|
+
}),
|
|
324
|
+
[resolveImage],
|
|
325
|
+
);
|
|
326
|
+
|
|
289
327
|
// `'source'`: a diagram whose ```mermaid fence straddles a change boundary
|
|
290
328
|
// reaches the renderer truncated and cannot parse, so the error box would
|
|
291
329
|
// replace the red/green source — the only useful content in that block — on
|
|
@@ -298,15 +336,22 @@ function DiffPreview({
|
|
|
298
336
|
onOpenFile,
|
|
299
337
|
onOpenNodeId,
|
|
300
338
|
onMermaidError: 'source',
|
|
339
|
+
resolveImage: liveImages,
|
|
340
|
+
});
|
|
341
|
+
const baselineComponents = useKbMarkdownComponents({
|
|
342
|
+
onOpenFile,
|
|
343
|
+
onOpenNodeId,
|
|
344
|
+
onMermaidError: 'source',
|
|
345
|
+
resolveImage: baselineImages,
|
|
301
346
|
});
|
|
302
347
|
|
|
303
348
|
// Each block is parsed as a standalone document, so the space-escaping that
|
|
304
349
|
// makes `[Foo](Some File.md)` resolve has to be applied per fragment.
|
|
305
|
-
const fragment = (text: string) => (
|
|
350
|
+
const fragment = (text: string, fragmentComponents = components) => (
|
|
306
351
|
<Markdown
|
|
307
352
|
remarkPlugins={KB_REMARK_PLUGINS}
|
|
308
353
|
rehypePlugins={KB_DIFF_REHYPE_PLUGINS}
|
|
309
|
-
components={
|
|
354
|
+
components={fragmentComponents}
|
|
310
355
|
>
|
|
311
356
|
{escapeSpacesInLinkDestinations(text)}
|
|
312
357
|
</Markdown>
|
|
@@ -322,7 +367,7 @@ function DiffPreview({
|
|
|
322
367
|
<div key={i} className="my-2">
|
|
323
368
|
{block.removed.length > 0 && (
|
|
324
369
|
<div className="bg-red-50 border-l-2 border-red-700 px-3 py-1 rounded-sm">
|
|
325
|
-
{fragment(block.removed.join('\n'))}
|
|
370
|
+
{fragment(block.removed.join('\n'), baselineComponents)}
|
|
326
371
|
</div>
|
|
327
372
|
)}
|
|
328
373
|
{block.added.length > 0 && (
|
|
@@ -6,10 +6,9 @@ import { useWorkspace } from '../../workspace/state/workspace.context';
|
|
|
6
6
|
import {
|
|
7
7
|
useFileNav,
|
|
8
8
|
useNodeIdNav,
|
|
9
|
-
resolveRelativePath,
|
|
10
9
|
stripJunkBeforeKbDir,
|
|
11
|
-
KB_ROUTE_PREFIX,
|
|
12
10
|
} from '../../workspace/routing/kb-routes';
|
|
11
|
+
import { useWorkspaceImageResolver } from '../../workspace/hooks/useWorkspaceImageResolver';
|
|
13
12
|
import { pluginOfPath, DEFAULT_BRANCH } from '@bevel-software/platform-shared';
|
|
14
13
|
import { cn } from '../../../lib/utils';
|
|
15
14
|
import { DOCUMENT_COLUMN, documentGutters } from '../../../shared/theme/measure';
|
|
@@ -110,8 +109,8 @@ function kindLabel(kind: PendingChange['kind']): string {
|
|
|
110
109
|
*/
|
|
111
110
|
export function ReviewPanel({ onClose }: { onClose?: () => void }) {
|
|
112
111
|
const review = useReview();
|
|
113
|
-
const { refreshFileTree, kbDirName } = useWorkspace();
|
|
114
|
-
const { openFile } = useFileNav();
|
|
112
|
+
const { refreshFileTree, kbDirName, workspaceId } = useWorkspace();
|
|
113
|
+
const { openFile, openLink } = useFileNav();
|
|
115
114
|
// Links inside a rendered diff. Both resolvers navigate relative to
|
|
116
115
|
// `git.status.branch`, which is CORRECT here and only here: this panel
|
|
117
116
|
// reviews the agent's uncommitted changes on the branch you are already
|
|
@@ -120,21 +119,19 @@ export function ReviewPanel({ onClose }: { onClose?: () => void }) {
|
|
|
120
119
|
// passes no resolvers — see the comment at its MarkdownDiffViewer call.)
|
|
121
120
|
const { openNodeId } = useNodeIdNav();
|
|
122
121
|
const diffPath = review.fileDiff?.path ?? '';
|
|
122
|
+
// Resolved against the diffed file by `openLink`: decoded, an absolute URL
|
|
123
|
+
// keeping its own branch. The same grammar MarkdownRenderer uses.
|
|
123
124
|
const openDiffLink = useCallback(
|
|
124
|
-
(href: string) =>
|
|
125
|
-
|
|
126
|
-
// resolveRelativePath would treat them as relative to the diffed file
|
|
127
|
-
// and mangle the path. Same guard as MarkdownRenderer's handleFileLink.
|
|
128
|
-
if (href.startsWith(`${KB_ROUTE_PREFIX}/`)) {
|
|
129
|
-
openFile(href);
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
let decoded = href;
|
|
133
|
-
try { decoded = decodeURIComponent(href); } catch { /* leave as-is */ }
|
|
134
|
-
openFile(resolveRelativePath(diffPath, decoded));
|
|
135
|
-
},
|
|
136
|
-
[openFile, diffPath],
|
|
125
|
+
(href: string) => openLink(href, diffPath),
|
|
126
|
+
[openLink, diffPath],
|
|
137
127
|
);
|
|
128
|
+
// Images inside a rendered diff, bound to the CHECKED-OUT workspace for the
|
|
129
|
+
// reason above: the working tree IS the diff's new state, so an image the
|
|
130
|
+
// agent added is on disk and can be shown. The viewer applies this to the
|
|
131
|
+
// unchanged and added sides only; a removed image is named, never fetched.
|
|
132
|
+
// The revision keeps the panel current when the agent replaces a picture
|
|
133
|
+
// while it is open.
|
|
134
|
+
const resolveDiffImage = useWorkspaceImageResolver(workspaceId, diffPath);
|
|
138
135
|
const [busy, setBusy] = useState(false);
|
|
139
136
|
// `busy` alone is not re-entrant-safe: two rapid clicks (or a click + a
|
|
140
137
|
// keyboard activation of the same button) can both read `busy === false`
|
|
@@ -377,6 +374,7 @@ export function ReviewPanel({ onClose }: { onClose?: () => void }) {
|
|
|
377
374
|
payload={fileDiff}
|
|
378
375
|
onOpenFile={openDiffLink}
|
|
379
376
|
onOpenNodeId={openNodeId}
|
|
377
|
+
resolveImage={resolveDiffImage}
|
|
380
378
|
scroll={false}
|
|
381
379
|
/>
|
|
382
380
|
</div>
|
|
@@ -154,4 +154,68 @@ describe('MarkdownDiffViewer', () => {
|
|
|
154
154
|
);
|
|
155
155
|
expect(screen.getByText('visible body text')).toBeInTheDocument();
|
|
156
156
|
});
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* The per-fragment image rule. The caller's resolver serves the checked-out
|
|
160
|
+
* tree, which is the truth for the unchanged and the added side and a lie
|
|
161
|
+
* for the removed side of a replaced screenshot.
|
|
162
|
+
*/
|
|
163
|
+
describe('images', () => {
|
|
164
|
+
const resolveImage = (src: string) => ({ src: `/raw/${src}`, path: `KB/${src}` });
|
|
165
|
+
|
|
166
|
+
it('serves an unchanged image through the resolver', () => {
|
|
167
|
+
render(
|
|
168
|
+
<MarkdownDiffViewer
|
|
169
|
+
payload={payload('\n', '\n')}
|
|
170
|
+
resolveImage={resolveImage}
|
|
171
|
+
/>,
|
|
172
|
+
);
|
|
173
|
+
expect(screen.getByRole('img', { name: 'Same' })).toHaveAttribute('src', '/raw/same.png');
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
it('serves an added image through the resolver', () => {
|
|
177
|
+
render(
|
|
178
|
+
<MarkdownDiffViewer
|
|
179
|
+
payload={payload('text\n', 'text\n\n\n')}
|
|
180
|
+
resolveImage={resolveImage}
|
|
181
|
+
/>,
|
|
182
|
+
);
|
|
183
|
+
expect(screen.getByRole('img', { name: 'Added' })).toHaveAttribute('src', '/raw/added.png');
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
it('names a removed image instead of fetching it', () => {
|
|
187
|
+
const { container } = render(
|
|
188
|
+
<MarkdownDiffViewer
|
|
189
|
+
payload={payload('\n', 'text\n')}
|
|
190
|
+
resolveImage={resolveImage}
|
|
191
|
+
/>,
|
|
192
|
+
);
|
|
193
|
+
expect(
|
|
194
|
+
screen.getByRole('img', { name: /Baseline image not shown: KB\/old.png/ }),
|
|
195
|
+
).toBeInTheDocument();
|
|
196
|
+
expect(container.querySelector('img')).toBeNull();
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
it('names every workspace image when no resolver is supplied (another revision, not this tree)', () => {
|
|
200
|
+
const { container } = render(
|
|
201
|
+
<MarkdownDiffViewer payload={payload('\n', '\n')} />,
|
|
202
|
+
);
|
|
203
|
+
expect(screen.getByRole('img', { name: /Baseline image not shown: old.png/ })).toBeInTheDocument();
|
|
204
|
+
expect(screen.getByRole('img', { name: /Image not shown: new.png/ })).toBeInTheDocument();
|
|
205
|
+
expect(container.querySelector('img')).toBeNull();
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
it('passes an external image through on either side, resolver or not', () => {
|
|
209
|
+
const external = payload(
|
|
210
|
+
'\n',
|
|
211
|
+
'\n',
|
|
212
|
+
);
|
|
213
|
+
for (const resolver of [undefined, resolveImage]) {
|
|
214
|
+
const { unmount } = render(<MarkdownDiffViewer payload={external} resolveImage={resolver} />);
|
|
215
|
+
expect(screen.getByRole('img', { name: 'Old' })).toHaveAttribute('src', 'https://cdn.example.com/old.png');
|
|
216
|
+
expect(screen.getByRole('img', { name: 'New' })).toHaveAttribute('src', 'https://cdn.example.com/new.png');
|
|
217
|
+
unmount();
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
});
|
|
157
221
|
});
|
|
@@ -3,7 +3,7 @@ import { render, screen, waitFor } from '@testing-library/react';
|
|
|
3
3
|
import userEvent from '@testing-library/user-event';
|
|
4
4
|
import { MemoryRouter } from 'react-router-dom';
|
|
5
5
|
import type { ReactNode } from 'react';
|
|
6
|
-
import type { ReviewSession } from '@bevel-software/platform-shared';
|
|
6
|
+
import type { FileDiffPayload, ReviewSession } from '@bevel-software/platform-shared';
|
|
7
7
|
import { ReviewPanel } from '../ReviewPanel';
|
|
8
8
|
import { ReviewContext, type ReviewContextValue } from '../../state/review.context';
|
|
9
9
|
import { WorkspaceContext, type WorkspaceContextValue } from '../../../workspace/state/workspace.context';
|
|
@@ -42,6 +42,7 @@ function renderPanel(review: ReviewContextValue) {
|
|
|
42
42
|
const workspace = {
|
|
43
43
|
refreshFileTree: vi.fn(async () => null),
|
|
44
44
|
kbDirName: 'knowledge-base',
|
|
45
|
+
workspaceId: 'ws-1',
|
|
45
46
|
} as unknown as WorkspaceContextValue;
|
|
46
47
|
const git = { status: { branch: session.branchName } } as unknown as GitContextValue;
|
|
47
48
|
const wrapper = ({ children }: { children: ReactNode }) => (
|
|
@@ -108,3 +109,26 @@ describe('ReviewPanel top-bar actions (BEVA-77)', () => {
|
|
|
108
109
|
expect((screen.getByRole('button', { name: 'Delete' }) as HTMLButtonElement).disabled).toBe(true);
|
|
109
110
|
});
|
|
110
111
|
});
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* This panel reviews the working tree of the branch you are standing on, so
|
|
115
|
+
* the checked-out workspace IS the diff's new state: an image the agent added
|
|
116
|
+
* is on disk and can be shown. Bound to that workspace and resolved against
|
|
117
|
+
* the diffed file.
|
|
118
|
+
*/
|
|
119
|
+
describe('ReviewPanel images in the diff', () => {
|
|
120
|
+
it('serves a relative image from the checked-out workspace, resolved against the diffed file', () => {
|
|
121
|
+
const fileDiff = {
|
|
122
|
+
path: 'processes/onboarding.md',
|
|
123
|
+
kind: 'modified',
|
|
124
|
+
isBinary: false,
|
|
125
|
+
baseline: 'intro\n',
|
|
126
|
+
current: 'intro\n\n\n',
|
|
127
|
+
} as FileDiffPayload;
|
|
128
|
+
renderPanel(makeReview({ fileDiff }));
|
|
129
|
+
expect(screen.getByRole('img', { name: 'Approval screen' })).toHaveAttribute(
|
|
130
|
+
'src',
|
|
131
|
+
'/api/workspace/ws-1/file/raw?path=processes%2Fassets%2Fapproval.png',
|
|
132
|
+
);
|
|
133
|
+
});
|
|
134
|
+
});
|