@bevel-software/platform-core-frontend 0.4.1 → 0.5.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/package.json +5 -3
- package/src/core/CoreAppShell.tsx +195 -56
- package/src/core/__tests__/AppChrome.test.tsx +125 -0
- package/src/core/__tests__/ShellRoutes.test.tsx +37 -2
- package/src/core/__tests__/bootstrap.test.ts +63 -0
- package/src/core/bootstrap.ts +73 -0
- package/src/core/events.ts +12 -0
- package/src/core/registry.ts +58 -9
- package/src/index.css +100 -11
- package/src/index.ts +24 -23
- package/src/lib/utils.ts +93 -117
- package/src/modules/access/__tests__/ManageAccessDialog.placement.test.tsx +281 -0
- package/src/modules/access/__tests__/ManageAccessDialog.test.tsx +166 -1
- package/src/modules/access/api.ts +49 -0
- package/src/modules/access/components/ManageAccessDialog.tsx +786 -481
- package/src/modules/access/hooks/useFileAccess.ts +1 -1
- package/src/modules/admin/__tests__/AdminRolesPage.suggest.test.tsx +86 -0
- package/src/modules/admin/__tests__/UserAccountsPage.test.tsx +17 -1
- package/src/modules/admin/__tests__/admin.unread.test.tsx +61 -0
- package/src/modules/admin/components/AdminRolesPage.tsx +44 -38
- package/src/modules/admin/components/RolesCorruptedBanner.tsx +11 -10
- package/src/modules/admin/components/UserAccountsPage.tsx +36 -28
- package/src/modules/admin/state/admin.context.tsx +15 -6
- package/src/modules/auth/components/AccountPage.tsx +11 -11
- package/src/modules/auth/components/LoginScreen.tsx +12 -12
- package/src/modules/auth/services/sso.ts +47 -1
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.test.tsx +277 -0
- package/src/modules/change-requests/__tests__/author.test.ts +48 -0
- package/src/modules/change-requests/__tests__/conflict.test.ts +73 -0
- package/src/modules/change-requests/__tests__/diff.test.ts +134 -0
- package/src/modules/change-requests/__tests__/propose.test.ts +93 -0
- package/src/modules/change-requests/__tests__/useFileOnBranch.test.tsx +72 -0
- package/src/modules/change-requests/change-requests.css +22 -0
- package/src/modules/change-requests/components/ChangeBox.tsx +277 -0
- package/src/modules/change-requests/components/ChangeRequestDialog.tsx +713 -0
- package/src/modules/change-requests/components/ConflictHelp.tsx +47 -0
- package/src/modules/change-requests/components/CrFileTree.tsx +398 -0
- package/src/modules/change-requests/components/FileChangeBoxes.tsx +168 -0
- package/src/modules/change-requests/hooks/useApplyChangeRequest.ts +236 -0
- package/src/modules/change-requests/hooks/useCrFileDiffs.ts +79 -0
- package/src/modules/change-requests/hooks/useFileOnBranch.ts +80 -0
- package/src/modules/change-requests/services/change-requests.api.ts +45 -0
- package/src/modules/change-requests/services/propose.api.ts +162 -0
- package/src/modules/change-requests/utils/author.ts +47 -0
- package/src/modules/change-requests/utils/conflict.ts +38 -0
- package/src/modules/change-requests/utils/diff.ts +80 -0
- package/src/modules/git/__tests__/BranchSwitcher.test.tsx +27 -18
- package/src/modules/git/__tests__/FileHistoryPanel.test.tsx +36 -83
- package/src/modules/git/__tests__/PullNeededBanner.test.tsx +5 -5
- package/src/modules/git/__tests__/PullRequestsForMe.test.tsx +147 -0
- package/src/modules/git/__tests__/useAutoPullUpdates.test.tsx +2 -8
- package/src/modules/git/components/BranchSwitcher.tsx +68 -31
- package/src/modules/git/components/DiffView.tsx +4 -4
- package/src/modules/git/components/FileComparisonPanel.tsx +20 -20
- package/src/modules/git/components/FileHistoryPanel.tsx +71 -107
- package/src/modules/git/components/PullNeededBanner.tsx +6 -13
- package/src/modules/git/components/PullRequestsForMe.tsx +71 -36
- package/src/modules/git/components/UnifiedDiffView.tsx +4 -4
- package/src/modules/git/hooks/__tests__/useGitState.deleteBranch.test.tsx +2 -2
- package/src/modules/git/hooks/useGitState.ts +15 -14
- package/src/modules/git/services/__tests__/error-messages.test.ts +4 -4
- package/src/modules/git/services/error-messages.ts +7 -7
- package/src/modules/git/services/git.api.ts +17 -11
- package/src/modules/git/services/pr-prompts.ts +2 -2
- package/src/modules/git/state/git.context.ts +10 -1
- package/src/modules/layout/__tests__/SidebarFrameResponsive.test.tsx +224 -0
- package/src/modules/layout/__tests__/SidebarToggle.test.tsx +242 -0
- package/src/modules/layout/__tests__/breakpoints.test.ts +56 -0
- package/src/modules/layout/breakpoints.ts +6 -0
- package/src/modules/layout/components/AppLayout.tsx +17 -5
- package/src/modules/layout/components/DemoBanner.tsx +10 -1
- package/src/modules/layout/components/MaintenanceOverlay.tsx +3 -3
- package/src/modules/layout/components/MobileChatLayout.tsx +31 -26
- package/src/modules/layout/components/ResizableThreePaneLayout.tsx +59 -24
- package/src/modules/layout/components/SidebarFrame.tsx +317 -0
- package/src/modules/layout/components/SidebarToggle.tsx +86 -0
- package/src/modules/layout/components/SlideOverlay.tsx +1 -1
- package/src/modules/layout/components/__tests__/MobileChatLayout.test.tsx +40 -2
- package/src/modules/layout/components/__tests__/ResizableThreePaneLayout.test.tsx +19 -3
- package/src/modules/layout/state/sidebar.ts +200 -0
- package/src/modules/library/__tests__/AddToGroupDialog.test.tsx +313 -0
- package/src/modules/library/__tests__/ChangeRequestDock.test.tsx +84 -0
- package/src/modules/library/__tests__/GroupJoinRequests.test.tsx +178 -0
- package/src/modules/library/__tests__/GroupPage.test.tsx +479 -0
- package/src/modules/library/__tests__/GroupsIndexPage.test.tsx +283 -0
- package/src/modules/library/__tests__/GroupsSidebar.contextmenu.test.tsx +175 -0
- package/src/modules/library/__tests__/GroupsSidebar.locked.test.tsx +96 -0
- package/src/modules/library/__tests__/GroupsSidebar.test.tsx +142 -0
- package/src/modules/library/__tests__/GroupsSidebarMenu.test.tsx +142 -0
- package/src/modules/library/__tests__/LibraryCard.test.tsx +149 -0
- package/src/modules/library/__tests__/LibraryRoutes.test.tsx +378 -0
- package/src/modules/library/__tests__/LibrarySidebarMenu.test.tsx +347 -0
- package/src/modules/library/__tests__/LockedGroupView.test.tsx +203 -0
- package/src/modules/library/__tests__/NewGroupDialog.test.tsx +114 -0
- package/src/modules/library/__tests__/PersonalAddDialog.test.tsx +177 -0
- package/src/modules/library/__tests__/SkillPage.test.tsx +1063 -0
- package/src/modules/library/__tests__/ToolConnectionSection.test.tsx +259 -0
- package/src/modules/library/__tests__/ToolLogo.test.tsx +63 -0
- package/src/modules/library/__tests__/ToolPage.test.tsx +315 -0
- package/src/modules/library/__tests__/ToolSharePanel.test.tsx +36 -0
- package/src/modules/library/__tests__/ToolVarRow.test.tsx +260 -0
- package/src/modules/library/__tests__/WorkspaceItemRoute.test.tsx +197 -0
- package/src/modules/library/__tests__/auth-harness.tsx +37 -0
- package/src/modules/library/__tests__/oauth-fragment.test.ts +48 -0
- package/src/modules/library/__tests__/status.test.ts +113 -20
- package/src/modules/library/__tests__/useSkillDetail.test.tsx +102 -0
- package/src/modules/library/__tests__/useToolPage.test.tsx +146 -0
- package/src/modules/library/components/AccessRequestsBanner.tsx +101 -0
- package/src/modules/library/components/AddToGroupDialog.tsx +115 -0
- package/src/modules/library/components/ChangeRequestDock.tsx +52 -28
- package/src/modules/library/components/DeleteGroupDialog.tsx +87 -0
- package/src/modules/library/components/GroupIndexRow.tsx +63 -0
- package/src/modules/library/components/GroupJoinRequests.tsx +56 -0
- package/src/modules/library/components/GroupPage.tsx +373 -0
- package/src/modules/library/components/GroupsIndexPage.tsx +222 -0
- package/src/modules/library/components/GroupsSidebar.tsx +338 -0
- package/src/modules/library/components/GroupsSidebarMenu.tsx +160 -0
- package/src/modules/library/components/LibraryCard.tsx +123 -102
- package/src/modules/library/components/LibraryLayout.tsx +344 -0
- package/src/modules/library/components/LibraryPage.tsx +111 -227
- package/src/modules/library/components/LockGlyph.tsx +31 -0
- package/src/modules/library/components/LockedGroupView.tsx +159 -0
- package/src/modules/library/components/ManagedGroupRequests.tsx +70 -0
- package/src/modules/library/components/NewGroupDialog.tsx +112 -0
- package/src/modules/library/components/NewSkillPanel.tsx +151 -0
- package/src/modules/library/components/PageActions.tsx +156 -0
- package/src/modules/library/components/PendingSkillReview.tsx +63 -0
- package/src/modules/library/components/PersonalAddDialog.tsx +88 -0
- package/src/modules/library/components/PersonalGroupPage.tsx +125 -0
- package/src/modules/library/components/StatusDot.tsx +25 -0
- package/src/modules/library/components/ToolLogo.tsx +171 -0
- package/src/modules/library/components/group-page-parts.tsx +419 -0
- package/src/modules/library/components/skill-page/SkillFileEditor.tsx +134 -0
- package/src/modules/library/components/skill-page/SkillFilePane.tsx +117 -0
- package/src/modules/library/components/skill-page/SkillFileTabs.tsx +112 -0
- package/src/modules/library/components/skill-page/SkillPage.tsx +673 -0
- package/src/modules/library/components/skill-page/tab-ids.ts +33 -0
- package/src/modules/library/components/tool-page/ToolConnectionSection.tsx +175 -0
- package/src/modules/library/components/tool-page/ToolPage.tsx +228 -0
- package/src/modules/library/components/tool-page/ToolSharePanel.tsx +45 -0
- package/src/modules/library/components/tool-page/ToolVarRow.tsx +289 -0
- package/src/modules/library/hooks/useJoinRequests.ts +114 -0
- package/src/modules/library/hooks/useLibraryData.ts +134 -119
- package/src/modules/library/hooks/useSkillDetail.ts +119 -74
- package/src/modules/library/hooks/useToolPage.ts +145 -0
- package/src/modules/library/library.css +33 -245
- package/src/modules/library/routes/LibraryRoutes.tsx +134 -0
- package/src/modules/library/routes/WorkspaceItemRoute.tsx +74 -0
- package/src/modules/library/routes/library-paths.ts +191 -0
- package/src/modules/library/services/groups.api.ts +189 -0
- package/src/modules/library/services/library.api.ts +291 -164
- package/src/modules/library/services/tools.api.ts +60 -0
- package/src/modules/library/state/library-context.ts +22 -0
- package/src/modules/library/state/library-data.tsx +223 -0
- package/src/modules/library/state/toast.context.ts +32 -0
- package/src/modules/library/state/toast.tsx +84 -42
- package/src/modules/library/utils/clipboard.ts +33 -0
- package/src/modules/library/utils/group-summary.ts +68 -0
- package/src/modules/library/utils/names.ts +30 -0
- package/src/modules/library/utils/navigate-external.ts +15 -0
- package/src/modules/library/utils/oauth-fragment.ts +32 -0
- package/src/modules/library/utils/personal-group.ts +36 -0
- package/src/modules/library/utils/status.ts +108 -25
- package/src/modules/library/utils/toast-duration.ts +16 -0
- package/src/modules/onboarding/__tests__/onboarding.test.tsx +533 -0
- package/src/modules/onboarding/agent-clients.ts +48 -0
- package/src/modules/onboarding/components/ConnectAgentPill.tsx +133 -0
- package/src/modules/onboarding/components/RootLanding.tsx +54 -0
- package/src/modules/onboarding/components/WelcomePage.tsx +364 -0
- package/src/modules/onboarding/paths.ts +9 -0
- package/src/modules/onboarding/state/onboarding.ts +191 -0
- package/src/modules/pr/components/OpenChangeRequestDialog.tsx +10 -10
- package/src/modules/pr/services/pr-approvals.api.ts +19 -0
- package/src/modules/pr/services/pr-cancel.api.ts +11 -0
- package/src/modules/review/components/BinaryChangePlaceholder.tsx +3 -3
- package/src/modules/review/components/DiffViewer.tsx +4 -4
- package/src/modules/review/components/MarkdownDiffViewer.tsx +84 -26
- package/src/modules/review/components/ReviewFileRow.tsx +10 -10
- package/src/modules/review/components/ReviewPanel.tsx +49 -17
- package/src/modules/review/components/ReviewPanelSurface.tsx +1 -1
- package/src/modules/review/components/__tests__/MarkdownDiffViewer.test.tsx +122 -0
- package/src/modules/review/hooks/__tests__/useReviewState.test.ts +1 -1
- package/src/modules/secrets-vault/components/ConnectToolsPage.tsx +273 -171
- package/src/modules/secrets-vault/components/SecretsPage.tsx +147 -110
- package/src/modules/secrets-vault/components/ToolSecretsPanel.tsx +109 -92
- package/src/modules/secrets-vault/components/__tests__/SecretsPage.test.tsx +35 -4
- package/src/modules/secrets-vault/services/connect.api.ts +24 -3
- package/src/modules/settings/components/DeploymentPage.tsx +90 -0
- package/src/modules/settings/components/SettingsLayout.tsx +135 -0
- package/src/modules/settings/components/SettingsNav.tsx +114 -0
- package/src/modules/settings/components/__tests__/DeploymentPage.test.tsx +110 -0
- package/src/modules/settings/components/__tests__/SettingsLayout.test.tsx +249 -0
- package/src/modules/settings/settings-nav-items.tsx +166 -0
- package/src/modules/setup/__tests__/setup.test.tsx +540 -0
- package/src/modules/setup/components/SetupGate.tsx +67 -0
- package/src/modules/setup/components/SetupScreen.tsx +573 -0
- package/src/modules/setup/services/setup.api.ts +106 -0
- package/src/modules/setup/utils/git-host.ts +34 -0
- package/src/modules/toolbar/components/AppSwitcher.tsx +38 -15
- package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +50 -50
- package/src/modules/toolbar/components/ProfileMenu.tsx +294 -0
- package/src/modules/toolbar/components/Toolbar.tsx +56 -54
- package/src/modules/toolbar/components/__tests__/AppSwitcher.test.tsx +176 -122
- package/src/modules/toolbar/components/__tests__/Toolbar.test.tsx +252 -77
- package/src/modules/tools/ToolsExplorerPage.tsx +45 -40
- package/src/modules/workspace/__tests__/design-system-parity.test.ts +133 -0
- package/src/modules/workspace/__tests__/testFixtures.ts +2 -0
- package/src/modules/workspace/components/EditorTabs.tsx +82 -50
- package/src/modules/workspace/components/FileExplorer.tsx +413 -189
- package/src/modules/workspace/components/FilePaneCard.tsx +53 -0
- package/src/modules/workspace/components/FileRoute.tsx +89 -84
- package/src/modules/workspace/components/FileViewer.tsx +700 -294
- package/src/modules/workspace/components/KbDocumentShell.tsx +138 -0
- package/src/modules/workspace/components/KbFileRail.tsx +128 -0
- package/src/modules/workspace/components/KbPageHeader.tsx +390 -0
- package/src/modules/workspace/components/__tests__/EditorTabs.test.tsx +87 -3
- package/src/modules/workspace/components/__tests__/FileExplorer.test.tsx +293 -39
- package/src/modules/workspace/components/__tests__/FileRoute.test.tsx +1 -16
- package/src/modules/workspace/components/__tests__/FileViewer.test.tsx +462 -44
- package/src/modules/workspace/components/__tests__/KbDocumentShell.test.tsx +84 -0
- package/src/modules/workspace/components/__tests__/KbFileRail.test.tsx +83 -0
- package/src/modules/workspace/components/__tests__/KbPageHeader.test.tsx +192 -0
- package/src/modules/workspace/components/renderers/CopyAnchorButton.tsx +64 -0
- package/src/modules/workspace/components/renderers/CsvRenderer.tsx +8 -8
- package/src/modules/workspace/components/renderers/DocxRenderer.tsx +18 -9
- package/src/modules/workspace/components/renderers/HtmlRenderer.tsx +14 -14
- package/src/modules/workspace/components/renderers/ImageRenderer.tsx +2 -2
- package/src/modules/workspace/components/renderers/KbMarkdownView.tsx +31 -165
- package/src/modules/workspace/components/renderers/MarkdownRenderer.tsx +18 -5
- package/src/modules/workspace/components/renderers/MermaidDiagram.tsx +27 -10
- package/src/modules/workspace/components/renderers/PdfRenderer.tsx +2 -2
- package/src/modules/workspace/components/renderers/TextRenderer.tsx +11 -5
- package/src/modules/workspace/components/renderers/ToolForm.tsx +24 -24
- package/src/modules/workspace/components/renderers/ToolRenderer.tsx +27 -27
- package/src/modules/workspace/components/renderers/XlsxRenderer.tsx +11 -11
- package/src/modules/workspace/components/renderers/__tests__/DocxRenderer.test.tsx +66 -0
- package/src/modules/workspace/components/renderers/__tests__/KbMarkdownView.test.tsx +17 -1
- package/src/modules/workspace/components/renderers/__tests__/MarkdownRenderer.test.tsx +1 -1
- package/src/modules/workspace/components/renderers/__tests__/MermaidDiagram.test.tsx +58 -0
- package/src/modules/workspace/components/renderers/__tests__/lazyRenderer.test.tsx +68 -0
- package/src/modules/workspace/components/renderers/__tests__/rendererLayout.test.ts +64 -0
- package/src/modules/workspace/components/renderers/__tests__/sanitizeDocxHtml.test.ts +0 -0
- package/src/modules/workspace/components/renderers/chunk-boundary.tsx +71 -0
- package/src/modules/workspace/components/renderers/index.ts +78 -2
- package/src/modules/workspace/components/renderers/kbMarkdownPipeline.tsx +241 -0
- package/src/modules/workspace/components/renderers/lazyRenderer.tsx +59 -0
- package/src/modules/workspace/components/renderers/sanitizeDocxHtml.ts +91 -0
- package/src/modules/workspace/hooks/__tests__/useLinksOut.test.ts +59 -0
- package/src/modules/workspace/hooks/__tests__/useOpenChangeRequests.test.tsx +237 -0
- package/src/modules/workspace/hooks/__tests__/useWorkspaceState.test.tsx +185 -0
- package/src/modules/workspace/hooks/useAutoGrowTextarea.ts +30 -0
- package/src/modules/workspace/hooks/useLastCommit.ts +66 -0
- package/src/modules/workspace/hooks/useLinksOut.ts +56 -0
- package/src/modules/workspace/hooks/useOpenChangeRequests.ts +20 -0
- package/src/modules/workspace/hooks/useWorkspaceState.ts +123 -14
- package/src/modules/workspace/routing/__tests__/kb-routes.test.tsx +1 -1
- package/src/modules/workspace/services/workspace.api.ts +9 -2
- package/src/modules/workspace/state/open-change-requests.context.ts +35 -0
- package/src/modules/workspace/state/open-change-requests.tsx +185 -0
- package/src/modules/workspace/state/workspace.context.ts +9 -0
- package/src/modules/workspace/utils/__tests__/diff.test.ts +87 -0
- package/src/modules/workspace/utils/diff.ts +130 -53
- package/src/modules/workspace/utils/fileTree.ts +7 -4
- package/src/modules/workspace/workspace.css +28 -0
- package/src/shared/components/Badge.tsx +62 -0
- package/src/shared/components/Banner.tsx +58 -0
- package/src/shared/components/Button.tsx +90 -0
- package/src/shared/components/Dialog.tsx +6 -6
- package/src/shared/components/Field.tsx +45 -0
- package/src/shared/components/IconButton.tsx +74 -0
- package/src/shared/components/ListRow.tsx +96 -0
- package/src/shared/components/Menu.tsx +88 -0
- package/src/shared/components/PageShell.tsx +8 -5
- package/src/shared/components/Surface.tsx +86 -0
- package/src/shared/components/__tests__/primitives.test.tsx +333 -0
- package/src/shared/components/index.ts +48 -0
- package/src/shared/components/useDismissableMenu.ts +71 -0
- package/src/shared/theme/__tests__/accent-contrast.test.ts +84 -0
- package/src/shared/theme/index.css +12 -0
- package/src/shared/theme/measure.ts +64 -0
- package/src/shared/theme/shadows.css +34 -0
- package/src/shared/theme/tokens.css +193 -0
- package/src/test-setup.ts +9 -0
- package/src/modules/access/components/AccessRestrictedBanner.tsx +0 -31
- package/src/modules/access/components/NodeOwnersBanner.tsx +0 -30
- package/src/modules/git/__tests__/ProtectedBranchBanner.test.tsx +0 -82
- package/src/modules/git/components/ProtectedBranchBanner.tsx +0 -42
- package/src/modules/library/__tests__/DetailDialog.test.tsx +0 -200
- package/src/modules/library/__tests__/diff.test.ts +0 -62
- package/src/modules/library/__tests__/loadout.test.tsx +0 -72
- package/src/modules/library/components/CompareView.tsx +0 -357
- package/src/modules/library/components/DetailDialog.tsx +0 -566
- package/src/modules/library/components/GearIcon.tsx +0 -12
- package/src/modules/library/components/LoadoutSidebar.tsx +0 -156
- package/src/modules/library/components/StatusGem.tsx +0 -21
- package/src/modules/library/components/SuggestChange.tsx +0 -171
- package/src/modules/library/components/particles.ts +0 -50
- package/src/modules/library/state/loadout.tsx +0 -129
- package/src/modules/library/utils/diff.ts +0 -102
- package/src/modules/pr/__tests__/PrApprovalBadge.test.tsx +0 -93
- package/src/modules/pr/__tests__/PrCancelButton.test.tsx +0 -158
- package/src/modules/pr/__tests__/PrCancelConfirmDialog.test.tsx +0 -44
- package/src/modules/pr/__tests__/PrMergeButton.test.tsx +0 -360
- package/src/modules/pr/__tests__/bucketize-comments.test.ts +0 -85
- package/src/modules/pr/__tests__/parsePatch.test.ts +0 -104
- package/src/modules/pr/__tests__/usePrViewerState.test.ts +0 -72
- package/src/modules/pr/components/PrApprovalBadge.tsx +0 -80
- package/src/modules/pr/components/PrCancelButton.tsx +0 -99
- package/src/modules/pr/components/PrCancelConfirmDialog.tsx +0 -119
- package/src/modules/pr/components/PrCommentComposer.tsx +0 -92
- package/src/modules/pr/components/PrCommentThread.tsx +0 -168
- package/src/modules/pr/components/PrCommentsPanel.tsx +0 -143
- package/src/modules/pr/components/PrDiffPane.tsx +0 -425
- package/src/modules/pr/components/PrFileRow.tsx +0 -164
- package/src/modules/pr/components/PrFilesList.tsx +0 -53
- package/src/modules/pr/components/PrHeader.tsx +0 -45
- package/src/modules/pr/components/PrHeaderOverflowMenu.tsx +0 -58
- package/src/modules/pr/components/PrMergeButton.tsx +0 -268
- package/src/modules/pr/components/PrMergeConfirmDialog.tsx +0 -112
- package/src/modules/pr/components/PrRefreshFromTargetButton.tsx +0 -110
- package/src/modules/pr/components/PrViewer.tsx +0 -364
- package/src/modules/pr/hooks/usePrViewerState.ts +0 -150
- package/src/modules/pr/state/pr-viewer.context.ts +0 -34
- package/src/modules/pr/utils/bucketize-comments.ts +0 -55
- package/src/modules/pr/utils/parsePatch.ts +0 -57
- package/src/modules/toolbar/components/AdminMenu.tsx +0 -271
|
@@ -1,566 +0,0 @@
|
|
|
1
|
-
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
-
import { useNavigate } from 'react-router-dom';
|
|
3
|
-
import {
|
|
4
|
-
DEFAULT_BRANCH,
|
|
5
|
-
type FileTreeEntry,
|
|
6
|
-
type PullRequestSummary,
|
|
7
|
-
} from '@bevel-software/platform-shared';
|
|
8
|
-
import { Dialog } from '../../../shared/components/Dialog';
|
|
9
|
-
import { useWorkspace } from '../../workspace/state/workspace.context';
|
|
10
|
-
import { useAuth } from '../../auth/state/auth.context';
|
|
11
|
-
import { kbFileUrl, resolveRelativePath } from '../../workspace/routing/kb-routes';
|
|
12
|
-
import { KbMarkdownView } from '../../workspace/components/renderers/KbMarkdownView';
|
|
13
|
-
import { ManageAccessDialog } from '../../access/components/ManageAccessDialog';
|
|
14
|
-
import { cancelPullRequest } from '../../pr/services/pr-cancel.api';
|
|
15
|
-
import type { ToolSecrets } from '../../secrets-vault/services/tool-secrets.api';
|
|
16
|
-
import { readFileOnBranch, suggestChange, type LibrarySkillSummary } from '../services/library.api';
|
|
17
|
-
import { useSkillDetail } from '../hooks/useSkillDetail';
|
|
18
|
-
import { useLibraryToast } from '../state/toast';
|
|
19
|
-
import {
|
|
20
|
-
neededToolsFor,
|
|
21
|
-
toolStatus,
|
|
22
|
-
toolVariableStatuses,
|
|
23
|
-
} from '../utils/status';
|
|
24
|
-
import { diffLines, hasChanges, type DiffLine } from '../utils/diff';
|
|
25
|
-
import { StatusGem } from './StatusGem';
|
|
26
|
-
import { ChangeRequestDock } from './ChangeRequestDock';
|
|
27
|
-
import { CompareView } from './CompareView';
|
|
28
|
-
import { SuggestChange } from './SuggestChange';
|
|
29
|
-
|
|
30
|
-
export type DetailTarget =
|
|
31
|
-
| { kind: 'skill'; skill: LibrarySkillSummary; owned: boolean }
|
|
32
|
-
| { kind: 'integration'; tool: ToolSecrets };
|
|
33
|
-
|
|
34
|
-
export interface DetailDialogProps {
|
|
35
|
-
target: DetailTarget;
|
|
36
|
-
tools: ToolSecrets[];
|
|
37
|
-
skills: LibrarySkillSummary[];
|
|
38
|
-
allowedToolsBySkill: Map<string, string[]>;
|
|
39
|
-
/** Open change requests (all authors). */
|
|
40
|
-
crs: PullRequestSummary[];
|
|
41
|
-
/** Numbers of the caller's own change requests. */
|
|
42
|
-
myCrNumbers: Set<number>;
|
|
43
|
-
inLoadout: boolean;
|
|
44
|
-
onToggleLoadout(): void;
|
|
45
|
-
onClose(): void;
|
|
46
|
-
/** Something durable changed (merge, send back, withdraw, new suggestion). */
|
|
47
|
-
onDataChanged(): void;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/** Does this change request touch anything inside the skill folder? */
|
|
51
|
-
function touchesSkill(cr: PullRequestSummary, skillPath: string): boolean {
|
|
52
|
-
return cr.touchedNodePaths.some((p) => p === skillPath || p.startsWith(`${skillPath}/`));
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const OWNER_TAG = (
|
|
56
|
-
<span className="rounded-full border border-[#f0dda6] bg-[#fdf3d8] px-1.5 text-[9.5px] font-bold tracking-[.05em] text-[#92600a]">
|
|
57
|
-
OWNER
|
|
58
|
-
</span>
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* The ⓘ detail dialog from the approved mock, on the shared Dialog primitive
|
|
63
|
-
* (Esc / backdrop close come with it). Skills: description, needed
|
|
64
|
-
* integrations with per-connection state + Connect, clickable file browser
|
|
65
|
-
* (SKILL.md tagged MAIN), owner-only Manage access + Edit, the change-request
|
|
66
|
-
* layer (owner dock → side-by-side compare; own pending suggestions inline
|
|
67
|
-
* with withdraw; select-text → suggest). Integrations: per-connection status
|
|
68
|
-
* rows and the skills that use it.
|
|
69
|
-
*/
|
|
70
|
-
export function DetailDialog(props: DetailDialogProps) {
|
|
71
|
-
const { target, inLoadout, onToggleLoadout, onClose } = props;
|
|
72
|
-
const name = target.kind === 'skill' ? target.skill.name : target.tool.name;
|
|
73
|
-
const owned = target.kind === 'skill' ? target.owned : target.tool.canWrite;
|
|
74
|
-
const [compareCr, setCompareCr] = useState<PullRequestSummary | null>(null);
|
|
75
|
-
|
|
76
|
-
const loadoutButton = (
|
|
77
|
-
<button
|
|
78
|
-
type="button"
|
|
79
|
-
className={
|
|
80
|
-
inLoadout
|
|
81
|
-
? 'rounded-[10px] border border-[#f5c2c2] bg-[#fdecec] px-3.5 py-1.5 text-xs font-bold text-[#c53030]'
|
|
82
|
-
: 'rounded-[10px] bg-gradient-to-br from-[#0d9488] to-[#0f766e] px-3.5 py-1.5 text-xs font-bold text-white shadow-[0_4px_14px_rgba(13,148,136,0.22)]'
|
|
83
|
-
}
|
|
84
|
-
onClick={onToggleLoadout}
|
|
85
|
-
>
|
|
86
|
-
{inLoadout ? 'In loadout — remove' : '+ Add to loadout'}
|
|
87
|
-
</button>
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
return (
|
|
91
|
-
<>
|
|
92
|
-
<div className={compareCr ? 'hidden' : undefined}>
|
|
93
|
-
<Dialog
|
|
94
|
-
open
|
|
95
|
-
onClose={onClose}
|
|
96
|
-
size="2xl"
|
|
97
|
-
title={
|
|
98
|
-
<span className="flex items-center gap-2 text-[15px]">
|
|
99
|
-
{name}
|
|
100
|
-
{owned && OWNER_TAG}
|
|
101
|
-
<span className="text-[10.5px] font-normal uppercase tracking-[.08em] text-slate-400">
|
|
102
|
-
{target.kind === 'skill' ? 'Skill' : 'Integration'}
|
|
103
|
-
</span>
|
|
104
|
-
</span>
|
|
105
|
-
}
|
|
106
|
-
headerActions={loadoutButton}
|
|
107
|
-
bodyClassName="min-h-[16rem]"
|
|
108
|
-
>
|
|
109
|
-
{target.kind === 'skill' ? (
|
|
110
|
-
<SkillDetailBody {...props} skillSummary={target.skill} owned={target.owned} onCompare={setCompareCr} />
|
|
111
|
-
) : (
|
|
112
|
-
<ToolDetailBody {...props} tool={target.tool} />
|
|
113
|
-
)}
|
|
114
|
-
</Dialog>
|
|
115
|
-
</div>
|
|
116
|
-
{target.kind === 'skill' && compareCr && (
|
|
117
|
-
<SkillCompareHost
|
|
118
|
-
{...props}
|
|
119
|
-
skillSummary={target.skill}
|
|
120
|
-
cr={compareCr}
|
|
121
|
-
onExit={() => setCompareCr(null)}
|
|
122
|
-
/>
|
|
123
|
-
)}
|
|
124
|
-
</>
|
|
125
|
-
);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/* ── skill body ── */
|
|
129
|
-
|
|
130
|
-
interface SkillBodyProps extends DetailDialogProps {
|
|
131
|
-
skillSummary: LibrarySkillSummary;
|
|
132
|
-
owned: boolean;
|
|
133
|
-
onCompare(cr: PullRequestSummary): void;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
function SkillDetailBody({
|
|
137
|
-
skillSummary,
|
|
138
|
-
owned,
|
|
139
|
-
tools,
|
|
140
|
-
crs,
|
|
141
|
-
myCrNumbers,
|
|
142
|
-
onCompare,
|
|
143
|
-
onDataChanged,
|
|
144
|
-
}: SkillBodyProps) {
|
|
145
|
-
const navigate = useNavigate();
|
|
146
|
-
const toast = useLibraryToast();
|
|
147
|
-
const { kbDirName } = useWorkspace();
|
|
148
|
-
const { user } = useAuth();
|
|
149
|
-
const detail = useSkillDetail(skillSummary.name);
|
|
150
|
-
const [selected, setSelected] = useState('SKILL.md');
|
|
151
|
-
const [accessOpen, setAccessOpen] = useState(false);
|
|
152
|
-
const fileViewRef = useRef<HTMLDivElement>(null);
|
|
153
|
-
|
|
154
|
-
const prefix = `${skillSummary.path}/`;
|
|
155
|
-
const relFiles = useMemo(
|
|
156
|
-
() => ['SKILL.md', ...(detail.skill?.files ?? []).map((f) => f.slice(prefix.length))],
|
|
157
|
-
[detail.skill, prefix],
|
|
158
|
-
);
|
|
159
|
-
|
|
160
|
-
useEffect(() => {
|
|
161
|
-
if (selected !== 'SKILL.md') detail.loadFile(selected);
|
|
162
|
-
// detail.loadFile is stable enough per (name, contents); keep deps minimal.
|
|
163
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
164
|
-
}, [selected, detail.skill]);
|
|
165
|
-
|
|
166
|
-
const raw = selected === 'SKILL.md' ? (detail.skill?.body ?? null) : detail.fileContent(selected);
|
|
167
|
-
|
|
168
|
-
const needed = useMemo(
|
|
169
|
-
() => (detail.skill ? neededToolsFor(detail.skill, tools) : []),
|
|
170
|
-
[detail.skill, tools],
|
|
171
|
-
);
|
|
172
|
-
|
|
173
|
-
const skillCrs = useMemo(
|
|
174
|
-
() => crs.filter((c) => touchesSkill(c, skillSummary.path)),
|
|
175
|
-
[crs, skillSummary.path],
|
|
176
|
-
);
|
|
177
|
-
const ownCr = useMemo(
|
|
178
|
-
() => skillCrs.find((c) => myCrNumbers.has(c.number)) ?? null,
|
|
179
|
-
[skillCrs, myCrNumbers],
|
|
180
|
-
);
|
|
181
|
-
|
|
182
|
-
// Own pending suggestions render inline: diff main → own suggestion branch.
|
|
183
|
-
const [branchRaw, setBranchRaw] = useState<string | null>(null);
|
|
184
|
-
const [branchRevision, setBranchRevision] = useState(0);
|
|
185
|
-
const fileRepoPath = `${skillSummary.path}/${selected}`;
|
|
186
|
-
const ownCrTouchesFile = ownCr !== null && ownCr.touchedNodePaths.includes(fileRepoPath);
|
|
187
|
-
useEffect(() => {
|
|
188
|
-
setBranchRaw(null);
|
|
189
|
-
if (!ownCr || !ownCrTouchesFile) return;
|
|
190
|
-
let cancelled = false;
|
|
191
|
-
readFileOnBranch(ownCr.branch, fileRepoPath)
|
|
192
|
-
.then((content) => {
|
|
193
|
-
if (!cancelled) setBranchRaw(content);
|
|
194
|
-
})
|
|
195
|
-
.catch(() => {
|
|
196
|
-
/* branch unreadable — fall back to the clean main view */
|
|
197
|
-
});
|
|
198
|
-
return () => {
|
|
199
|
-
cancelled = true;
|
|
200
|
-
};
|
|
201
|
-
}, [ownCr, ownCrTouchesFile, fileRepoPath, branchRevision]);
|
|
202
|
-
|
|
203
|
-
const suggestionDiff: DiffLine[] | null = useMemo(() => {
|
|
204
|
-
if (raw === null || branchRaw === null) return null;
|
|
205
|
-
const d = diffLines(raw, branchRaw);
|
|
206
|
-
return hasChanges(d) ? d : null;
|
|
207
|
-
}, [raw, branchRaw]);
|
|
208
|
-
|
|
209
|
-
const openInEditor = useCallback(
|
|
210
|
-
(wsRelative: string) => {
|
|
211
|
-
navigate(kbFileUrl(DEFAULT_BRANCH, wsRelative));
|
|
212
|
-
},
|
|
213
|
-
[navigate],
|
|
214
|
-
);
|
|
215
|
-
|
|
216
|
-
const handleSuggest = useCallback(
|
|
217
|
-
async (find: string, replace: string, note: string) => {
|
|
218
|
-
if (!user) throw new Error('Sign in to suggest a change.');
|
|
219
|
-
await suggestChange({
|
|
220
|
-
skillName: skillSummary.name,
|
|
221
|
-
repoRelativePath: fileRepoPath,
|
|
222
|
-
find,
|
|
223
|
-
replace,
|
|
224
|
-
note: note || undefined,
|
|
225
|
-
userEmail: user.email,
|
|
226
|
-
userName: user.name,
|
|
227
|
-
existingCr: ownCr,
|
|
228
|
-
});
|
|
229
|
-
toast('Suggestion saved to your draft');
|
|
230
|
-
setBranchRevision((r) => r + 1);
|
|
231
|
-
onDataChanged();
|
|
232
|
-
},
|
|
233
|
-
[user, skillSummary.name, fileRepoPath, ownCr, toast, onDataChanged],
|
|
234
|
-
);
|
|
235
|
-
|
|
236
|
-
async function withdrawOwn() {
|
|
237
|
-
if (!ownCr) return;
|
|
238
|
-
try {
|
|
239
|
-
await cancelPullRequest(ownCr.number);
|
|
240
|
-
toast('Suggestion withdrawn');
|
|
241
|
-
setBranchRaw(null);
|
|
242
|
-
onDataChanged();
|
|
243
|
-
} catch (err) {
|
|
244
|
-
toast(err instanceof Error ? err.message : "Couldn't withdraw the suggestion.");
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
if (detail.loading) {
|
|
249
|
-
return <div className="py-8 text-center text-sm text-slate-400">Loading…</div>;
|
|
250
|
-
}
|
|
251
|
-
if (detail.error || !detail.skill) {
|
|
252
|
-
return <div className="py-8 text-center text-sm text-[#c53030]">{detail.error ?? "Couldn't load this skill."}</div>;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
const accessEntry: FileTreeEntry | null = kbDirName
|
|
256
|
-
? { name: 'SKILL.md', relativePath: `${kbDirName}/${skillSummary.path}/SKILL.md`, type: 'file' }
|
|
257
|
-
: null;
|
|
258
|
-
|
|
259
|
-
return (
|
|
260
|
-
<div className="text-sm">
|
|
261
|
-
<p className="mb-4 text-[13.5px] text-slate-600">{detail.skill.description}</p>
|
|
262
|
-
|
|
263
|
-
<section className="mb-4">
|
|
264
|
-
<div className="mb-2 flex items-center justify-between">
|
|
265
|
-
<h4 className="text-[10.5px] font-bold uppercase tracking-[.09em] text-slate-400">
|
|
266
|
-
Integrations this skill needs
|
|
267
|
-
</h4>
|
|
268
|
-
{owned && accessEntry && (
|
|
269
|
-
<button
|
|
270
|
-
type="button"
|
|
271
|
-
className="rounded-lg bg-[#eef2f7] px-3.5 py-1 text-[11.5px] font-bold text-slate-600 shadow-[inset_0_0_0_1px_#d3dbe6] transition-transform hover:-translate-y-px"
|
|
272
|
-
onClick={() => setAccessOpen(true)}
|
|
273
|
-
>
|
|
274
|
-
Manage access
|
|
275
|
-
</button>
|
|
276
|
-
)}
|
|
277
|
-
</div>
|
|
278
|
-
<div className="flex flex-col gap-1.5">
|
|
279
|
-
{needed.length === 0 ? (
|
|
280
|
-
<IntItem
|
|
281
|
-
title="Knowledge base only"
|
|
282
|
-
sub="No external connections needed"
|
|
283
|
-
right={<StatusGem state="ok" />}
|
|
284
|
-
/>
|
|
285
|
-
) : (
|
|
286
|
-
needed.map((t) => {
|
|
287
|
-
const status = toolStatus(t);
|
|
288
|
-
return (
|
|
289
|
-
<IntItem
|
|
290
|
-
key={t.slug}
|
|
291
|
-
title={t.name}
|
|
292
|
-
sub={status.state === 'ok' ? 'Connected — nothing to do' : status.text}
|
|
293
|
-
right={
|
|
294
|
-
status.state === 'ok' ? (
|
|
295
|
-
<StatusGem state="ok" />
|
|
296
|
-
) : (
|
|
297
|
-
<ConnectButton
|
|
298
|
-
label={status.state === 'err' ? 'Reconnect' : 'Connect'}
|
|
299
|
-
onClick={() => navigate('/connect')}
|
|
300
|
-
/>
|
|
301
|
-
)
|
|
302
|
-
}
|
|
303
|
-
/>
|
|
304
|
-
);
|
|
305
|
-
})
|
|
306
|
-
)}
|
|
307
|
-
</div>
|
|
308
|
-
</section>
|
|
309
|
-
|
|
310
|
-
<section className="mb-4">
|
|
311
|
-
<h4 className="mb-2 text-[10.5px] font-bold uppercase tracking-[.09em] text-slate-400">
|
|
312
|
-
Files in this skill — click one to view it
|
|
313
|
-
</h4>
|
|
314
|
-
<div className="flex flex-col gap-1.5">
|
|
315
|
-
{relFiles.map((rel) => (
|
|
316
|
-
<button
|
|
317
|
-
key={rel}
|
|
318
|
-
type="button"
|
|
319
|
-
className={`flex items-center gap-2 rounded-[9px] border px-2.5 py-1.5 text-left transition-colors ${
|
|
320
|
-
selected === rel
|
|
321
|
-
? 'border-[#0d9488] bg-[#e6f7f4]'
|
|
322
|
-
: 'border-slate-200 bg-[#fafbfd] hover:border-[#7fd0c4]'
|
|
323
|
-
}`}
|
|
324
|
-
onClick={() => setSelected(rel)}
|
|
325
|
-
>
|
|
326
|
-
<span
|
|
327
|
-
className={`font-mono text-[11.5px] font-semibold ${selected === rel ? 'text-[#0f766e]' : 'text-slate-600'}`}
|
|
328
|
-
>
|
|
329
|
-
{rel}
|
|
330
|
-
</span>
|
|
331
|
-
{rel === 'SKILL.md' && (
|
|
332
|
-
<span className="rounded-full bg-white px-1.5 text-[9.5px] font-bold tracking-[.04em] text-[#0f766e] shadow-[inset_0_0_0_1px_#d2e9e4]">
|
|
333
|
-
MAIN
|
|
334
|
-
</span>
|
|
335
|
-
)}
|
|
336
|
-
</button>
|
|
337
|
-
))}
|
|
338
|
-
</div>
|
|
339
|
-
</section>
|
|
340
|
-
|
|
341
|
-
<section>
|
|
342
|
-
<div className="mb-2 flex items-center justify-between">
|
|
343
|
-
<h4 className="font-mono text-[11px] text-slate-500">{selected}</h4>
|
|
344
|
-
{owned && kbDirName && (
|
|
345
|
-
<button
|
|
346
|
-
type="button"
|
|
347
|
-
className="rounded-lg bg-[#e0f8ee] px-3.5 py-1 text-[11.5px] font-bold text-[#0a8f60] shadow-[inset_0_0_0_1px_#a9e8cd] transition-transform hover:-translate-y-px"
|
|
348
|
-
onClick={() => openInEditor(`${kbDirName}/${skillSummary.path}/${selected}`)}
|
|
349
|
-
>
|
|
350
|
-
Edit
|
|
351
|
-
</button>
|
|
352
|
-
)}
|
|
353
|
-
</div>
|
|
354
|
-
|
|
355
|
-
{suggestionDiff && (
|
|
356
|
-
<div className="mb-2 flex items-center justify-between rounded-lg border border-[#d2e9e4] bg-[#e6f7f4] px-3 py-1.5 text-[11.5px] text-[#0f766e]">
|
|
357
|
-
<span>Your pending suggestions are shown inline</span>
|
|
358
|
-
<button
|
|
359
|
-
type="button"
|
|
360
|
-
className="rounded-full bg-[#fdecec] px-3 py-0.5 font-bold text-[#c53030] shadow-[inset_0_0_0_1px_#f3c4c4]"
|
|
361
|
-
onClick={() => void withdrawOwn()}
|
|
362
|
-
>
|
|
363
|
-
Withdraw
|
|
364
|
-
</button>
|
|
365
|
-
</div>
|
|
366
|
-
)}
|
|
367
|
-
|
|
368
|
-
<div ref={fileViewRef}>
|
|
369
|
-
{raw === null ? (
|
|
370
|
-
<div className="py-4 text-center text-xs text-slate-400">Loading…</div>
|
|
371
|
-
) : suggestionDiff ? (
|
|
372
|
-
<pre className="lib-sug whitespace-pre-wrap break-words rounded-[13px] border border-slate-200 bg-[#f7f9fb] p-3.5 font-mono text-[11.5px] leading-relaxed text-slate-600">
|
|
373
|
-
{suggestionDiff.map((l, i) =>
|
|
374
|
-
l.kind === 'same' ? (
|
|
375
|
-
<div key={i}>{l.text || ' '}</div>
|
|
376
|
-
) : l.kind === 'removed' ? (
|
|
377
|
-
<del key={i} className="block">
|
|
378
|
-
{l.text || ' '}
|
|
379
|
-
</del>
|
|
380
|
-
) : (
|
|
381
|
-
<ins key={i} className="block">
|
|
382
|
-
{l.text || ' '}
|
|
383
|
-
</ins>
|
|
384
|
-
),
|
|
385
|
-
)}
|
|
386
|
-
</pre>
|
|
387
|
-
) : selected.endsWith('.md') ? (
|
|
388
|
-
<div className="rounded-[13px] border border-slate-200 bg-[#f7f9fb] px-4 py-3">
|
|
389
|
-
<KbMarkdownView
|
|
390
|
-
source={raw}
|
|
391
|
-
onOpenFile={(href) => {
|
|
392
|
-
if (!kbDirName) return;
|
|
393
|
-
openInEditor(resolveRelativePath(`${kbDirName}/${skillSummary.path}/${selected}`, href));
|
|
394
|
-
}}
|
|
395
|
-
/>
|
|
396
|
-
</div>
|
|
397
|
-
) : (
|
|
398
|
-
<pre className="whitespace-pre-wrap break-words rounded-[13px] border border-slate-200 bg-[#f7f9fb] p-3.5 font-mono text-[11.5px] leading-relaxed text-slate-600">
|
|
399
|
-
{raw}
|
|
400
|
-
</pre>
|
|
401
|
-
)}
|
|
402
|
-
</div>
|
|
403
|
-
</section>
|
|
404
|
-
|
|
405
|
-
<SuggestChange containerRef={fileViewRef} raw={raw} onSubmit={handleSuggest} />
|
|
406
|
-
|
|
407
|
-
{owned && <ChangeRequestDock crs={skillCrs} onSelect={onCompare} />}
|
|
408
|
-
|
|
409
|
-
{accessOpen && accessEntry && (
|
|
410
|
-
<ManageAccessDialog entry={accessEntry} onClose={() => setAccessOpen(false)} />
|
|
411
|
-
)}
|
|
412
|
-
</div>
|
|
413
|
-
);
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
/* ── compare host: mounts the split view once the skill detail is available ── */
|
|
417
|
-
|
|
418
|
-
interface CompareHostProps extends DetailDialogProps {
|
|
419
|
-
skillSummary: LibrarySkillSummary;
|
|
420
|
-
cr: PullRequestSummary;
|
|
421
|
-
onExit(): void;
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
function SkillCompareHost({ skillSummary, cr, onExit, onDataChanged }: CompareHostProps) {
|
|
425
|
-
const toast = useLibraryToast();
|
|
426
|
-
const detail = useSkillDetail(skillSummary.name);
|
|
427
|
-
|
|
428
|
-
if (detail.loading) {
|
|
429
|
-
return (
|
|
430
|
-
<div className="fixed inset-0 z-[60] flex items-center justify-center bg-slate-950/40 text-sm text-white">
|
|
431
|
-
Loading…
|
|
432
|
-
</div>
|
|
433
|
-
);
|
|
434
|
-
}
|
|
435
|
-
if (!detail.skill) return null;
|
|
436
|
-
|
|
437
|
-
return (
|
|
438
|
-
<CompareView
|
|
439
|
-
skill={detail.skill}
|
|
440
|
-
mainContent={(rel) => (rel === 'SKILL.md' ? detail.skill!.body : detail.fileContent(rel))}
|
|
441
|
-
loadMainFile={(rel) => {
|
|
442
|
-
if (rel !== 'SKILL.md') detail.loadFile(rel);
|
|
443
|
-
}}
|
|
444
|
-
cr={cr}
|
|
445
|
-
onClose={onExit}
|
|
446
|
-
onResolved={(kind) => {
|
|
447
|
-
toast(kind === 'applied' ? 'Change request is being applied' : 'Sent back to the author');
|
|
448
|
-
onExit();
|
|
449
|
-
onDataChanged();
|
|
450
|
-
}}
|
|
451
|
-
/>
|
|
452
|
-
);
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
/* ── integration body ── */
|
|
456
|
-
|
|
457
|
-
interface ToolBodyProps extends DetailDialogProps {
|
|
458
|
-
tool: ToolSecrets;
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
function ToolDetailBody({ tool, skills, allowedToolsBySkill }: ToolBodyProps) {
|
|
462
|
-
const navigate = useNavigate();
|
|
463
|
-
const { kbDirName } = useWorkspace();
|
|
464
|
-
const rows = toolVariableStatuses(tool);
|
|
465
|
-
|
|
466
|
-
const usedBy = useMemo(
|
|
467
|
-
() =>
|
|
468
|
-
skills.filter(
|
|
469
|
-
(s) =>
|
|
470
|
-
neededToolsFor({ allowedTools: allowedToolsBySkill.get(s.name) }, [tool]).length > 0,
|
|
471
|
-
),
|
|
472
|
-
[skills, allowedToolsBySkill, tool],
|
|
473
|
-
);
|
|
474
|
-
|
|
475
|
-
return (
|
|
476
|
-
<div className="text-sm">
|
|
477
|
-
<section className="mb-4">
|
|
478
|
-
<h4 className="mb-2 text-[10.5px] font-bold uppercase tracking-[.09em] text-slate-400">
|
|
479
|
-
Connection status
|
|
480
|
-
</h4>
|
|
481
|
-
<div className="flex flex-col gap-1.5">
|
|
482
|
-
{rows.length === 0 ? (
|
|
483
|
-
<IntItem title="Nothing to set up" sub="This integration works for everyone as-is" right={<StatusGem state="ok" />} />
|
|
484
|
-
) : (
|
|
485
|
-
rows.map(({ v, status }) => (
|
|
486
|
-
<IntItem
|
|
487
|
-
key={v.name}
|
|
488
|
-
title={v.label ?? v.name}
|
|
489
|
-
sub={
|
|
490
|
-
status.state === 'ok'
|
|
491
|
-
? v.scope === 'admin'
|
|
492
|
-
? 'Set up for the whole team'
|
|
493
|
-
: 'Connected'
|
|
494
|
-
: status.text
|
|
495
|
-
}
|
|
496
|
-
right={
|
|
497
|
-
status.state === 'ok' ? (
|
|
498
|
-
<StatusGem state="ok" />
|
|
499
|
-
) : v.scope === 'user' && v.adminConfigured !== false ? (
|
|
500
|
-
<ConnectButton
|
|
501
|
-
label={status.state === 'err' ? 'Reconnect' : 'Connect'}
|
|
502
|
-
onClick={() => navigate('/connect')}
|
|
503
|
-
/>
|
|
504
|
-
) : tool.canWrite && kbDirName ? (
|
|
505
|
-
<ConnectButton
|
|
506
|
-
label="Set up"
|
|
507
|
-
onClick={() => navigate(kbFileUrl(DEFAULT_BRANCH, `${kbDirName}/${tool.path}`))}
|
|
508
|
-
/>
|
|
509
|
-
) : (
|
|
510
|
-
<StatusGem state={status.state} />
|
|
511
|
-
)
|
|
512
|
-
}
|
|
513
|
-
/>
|
|
514
|
-
))
|
|
515
|
-
)}
|
|
516
|
-
</div>
|
|
517
|
-
</section>
|
|
518
|
-
|
|
519
|
-
<section>
|
|
520
|
-
<h4 className="mb-2 text-[10.5px] font-bold uppercase tracking-[.09em] text-slate-400">
|
|
521
|
-
Used by these skills
|
|
522
|
-
</h4>
|
|
523
|
-
{usedBy.length === 0 ? (
|
|
524
|
-
<span className="text-[11.5px] italic text-slate-400">No skills use this yet</span>
|
|
525
|
-
) : (
|
|
526
|
-
<div className="flex flex-wrap gap-1.5">
|
|
527
|
-
{usedBy.map((s) => (
|
|
528
|
-
<span
|
|
529
|
-
key={s.name}
|
|
530
|
-
className="rounded-full border border-slate-200 bg-white px-2.5 py-1 text-[11.5px] font-semibold text-slate-500"
|
|
531
|
-
>
|
|
532
|
-
{s.name}
|
|
533
|
-
</span>
|
|
534
|
-
))}
|
|
535
|
-
</div>
|
|
536
|
-
)}
|
|
537
|
-
</section>
|
|
538
|
-
</div>
|
|
539
|
-
);
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
/* ── small shared rows ── */
|
|
543
|
-
|
|
544
|
-
function IntItem({ title, sub, right }: { title: string; sub: string; right: React.ReactNode }) {
|
|
545
|
-
return (
|
|
546
|
-
<div className="flex items-center gap-3 rounded-[11px] border border-slate-200 bg-[#fafbfd] px-3 py-2">
|
|
547
|
-
<div className="min-w-0">
|
|
548
|
-
<b className="block text-[12.5px] text-slate-800">{title}</b>
|
|
549
|
-
<small className="block text-[11px] text-slate-400">{sub}</small>
|
|
550
|
-
</div>
|
|
551
|
-
<div className="ml-auto flex shrink-0 items-center gap-2">{right}</div>
|
|
552
|
-
</div>
|
|
553
|
-
);
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
function ConnectButton({ label, onClick }: { label: string; onClick(): void }) {
|
|
557
|
-
return (
|
|
558
|
-
<button
|
|
559
|
-
type="button"
|
|
560
|
-
className="rounded-lg bg-gradient-to-br from-[#f59e0b] to-[#d97706] px-3 py-1.5 text-[11.5px] font-bold text-white shadow-[0_2px_10px_rgba(245,158,11,0.35)] transition-transform hover:-translate-y-px"
|
|
561
|
-
onClick={onClick}
|
|
562
|
-
>
|
|
563
|
-
{label} →
|
|
564
|
-
</button>
|
|
565
|
-
);
|
|
566
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The thin gear from the approved mock (mocks/gear-thin.svg, inlined there as
|
|
3
|
-
* `GEAR_SVG`), converted to a React component with `fill="currentColor"` so the
|
|
4
|
-
* integration-card chrome can tint it. Purely decorative — always aria-hidden.
|
|
5
|
-
*/
|
|
6
|
-
export function GearIcon({ className }: { className?: string }) {
|
|
7
|
-
return (
|
|
8
|
-
<svg viewBox="0 0 256 256" fill="currentColor" xmlns="http://www.w3.org/2000/svg" className={className} aria-hidden="true">
|
|
9
|
-
<path d="M128.001,76a52,52,0,1,0,52,52A52.05895,52.05895,0,0,0,128.001,76Zm0,96a44,44,0,1,1,44-44A44.04978,44.04978,0,0,1,128.001,172Zm103.606-19.19434-15.70459-20.93652c.07276-2.56543.01953-5.86182-.02246-7.709l15.72022-20.95948a3.99977,3.99977,0,0,0,.66162-3.44238,107.44341,107.44341,0,0,0-10.55664-25.51025,4.00044,4.00044,0,0,0-2.90332-1.96778L192.915,68.5835c-1.74854-1.9087-3.59033-3.75049-5.49854-5.49854l-3.6958-25.87549a3.99946,3.99946,0,0,0-1.96582-2.90234A107.46494,107.46494,0,0,0,156.251,23.7334a3.9984,3.9984,0,0,0-3.44385.66162L131.88867,40.08545c-2.58594-.11328-5.19043-.11328-7.77637,0L103.20215,24.40186a3.99975,3.99975,0,0,0-3.44238-.66163A107.43015,107.43015,0,0,0,74.24854,34.29736a3.99987,3.99987,0,0,0-1.96729,2.90284L68.585,63.08643c-1.90869,1.74853-3.75049,3.59033-5.499,5.499L37.21045,72.28076a4.00233,4.00233,0,0,0-2.90234,1.96631A107.45352,107.45352,0,0,0,23.73437,99.75146a4.00034,4.00034,0,0,0,.66163,3.44385l15.70459,20.93653c-.07276,2.56543-.01954,5.86181.02246,7.709L24.40283,152.80029a3.9998,3.9998,0,0,0-.66162,3.44239,107.44358,107.44358,0,0,0,10.55664,25.51025,4.0004,4.0004,0,0,0,2.90332,1.96777l25.88672,3.69678c1.74854,1.90869,3.59033,3.75049,5.49854,5.49854l3.6958,25.87548a3.99943,3.99943,0,0,0,1.96582,2.90235,107.46536,107.46536,0,0,0,25.5039,10.57373,3.99865,3.99865,0,0,0,3.44385-.66162l20.91846-15.69043c2.58594.11328,5.19043.11328,7.77636,0l20.91016,15.68359a3.99818,3.99818,0,0,0,3.44238.66162,107.42974,107.42974,0,0,0,25.51123-10.55713,3.99985,3.99985,0,0,0,1.96729-2.90283l3.69971-25.90918c1.86523-1.76269,4.1582-4.13135,5.43506-5.4668l25.936-3.70459a4.00231,4.00231,0,0,0,2.90234-1.9663,107.453,107.453,0,0,0,10.57373-25.5044A4.00032,4.00032,0,0,0,231.60693,152.80566Zm-15.89941,23.27393-25.35889,3.62207a4.00012,4.00012,0,0,0-2.34765,1.21875c-.0459.04883-4.59473,4.87744-6.98926,6.99756a4.00188,4.00188,0,0,0-1.30811,2.42969l-3.62256,25.36718a99.46249,99.46249,0,0,1-20.05908,8.29981l-20.4917-15.36914a3.99365,3.99365,0,0,0-2.64257-.793,80.73137,80.73137,0,0,1-9.77051,0,3.99956,3.99956,0,0,0-2.64258.793l-20.499,15.376a99.48407,99.48407,0,0,1-20.05274-8.31494l-3.62207-25.35742a3.9995,3.9995,0,0,0-1.3081-2.42969,80.77735,80.77735,0,0,1-6.90918-6.90869,3.99933,3.99933,0,0,0-2.4292-1.3081l-25.36719-3.62256a99.46525,99.46525,0,0,1-8.29981-20.0586l15.37012-20.49316a3.99957,3.99957,0,0,0,.79785-2.52148c-.002-.0669-.20019-6.69825-.00586-9.89063a4.00065,4.00065,0,0,0-.793-2.64307l-15.376-20.49853a99.49477,99.49477,0,0,1,8.31494-20.05322l25.35791-3.6211a4.00129,4.00129,0,0,0,2.4292-1.30859A80.70375,80.70375,0,0,1,74.99121,68.083a4.00194,4.00194,0,0,0,1.30811-2.42969l3.62255-25.36719A99.46278,99.46278,0,0,1,99.981,31.98633l20.4917,15.36914a4.01364,4.01364,0,0,0,2.64257.793,80.72728,80.72728,0,0,1,9.77051,0,4.00878,4.00878,0,0,0,2.64258-.793l20.499-15.376a99.48407,99.48407,0,0,1,20.05274,8.31494l3.62207,25.35743a3.9994,3.9994,0,0,0,1.3081,2.42968,80.78169,80.78169,0,0,1,6.90918,6.90869,3.99939,3.99939,0,0,0,2.4292,1.30811l25.36719,3.62256a99.46513,99.46513,0,0,1,8.2998,20.05859l-15.37011,20.49317a3.99954,3.99954,0,0,0-.79785,2.52148c.002.0669.20019,6.69824.00586,9.89063a4.00063,4.00063,0,0,0,.793,2.64306l15.376,20.49854A99.49477,99.49477,0,0,1,215.70752,176.07959Z" />
|
|
10
|
-
</svg>
|
|
11
|
-
);
|
|
12
|
-
}
|