@bevel-software/platform-core-frontend 0.7.5 → 0.8.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/LICENSE +202 -202
- package/THIRD-PARTY-NOTICES.md +344 -988
- package/package.json +5 -5
- package/src/core/CoreAppShell.tsx +4 -4
- package/src/core/__tests__/ShellRoutes.test.tsx +1 -1
- package/src/core/__tests__/bootstrap.test.ts +47 -2
- package/src/core/bootstrap.ts +20 -0
- package/src/css-side-effect-imports.d.ts +7 -7
- package/src/modules/access/__tests__/ManageAccessDialog.placement.test.tsx +1 -1
- package/src/modules/access/__tests__/ManageAccessDialog.test.tsx +5 -5
- package/src/modules/access/api.ts +5 -5
- package/src/modules/access/components/ManageAccessDialog.tsx +21 -20
- package/src/modules/admin/__tests__/AdminRolesPage.suggest.test.tsx +1 -1
- package/src/modules/admin/components/AdminRolesPage.tsx +1 -1
- package/src/modules/change-requests/__tests__/useFileOnBranch.test.tsx +2 -2
- package/src/modules/change-requests/components/ChangeRequestDialog.tsx +1 -1
- package/src/modules/change-requests/hooks/useApplyChangeRequest.ts +1 -1
- package/src/modules/layout/__tests__/SidebarFrameResponsive.test.tsx +4 -4
- package/src/modules/layout/__tests__/SidebarToggle.test.tsx +4 -4
- package/src/modules/layout/__tests__/breakpoints.test.ts +1 -1
- package/src/modules/layout/components/SidebarFrame.tsx +2 -2
- package/src/modules/library/__tests__/{AddToGroupDialog.test.tsx → AddToPluginDialog.test.tsx} +34 -34
- package/src/modules/library/__tests__/LibraryCard.test.tsx +30 -11
- package/src/modules/library/__tests__/LibraryRoutes.test.tsx +84 -59
- package/src/modules/library/__tests__/LibrarySidebarMenu.test.tsx +51 -51
- package/src/modules/library/__tests__/{LockedGroupView.test.tsx → LockedPluginView.test.tsx} +33 -33
- package/src/modules/library/__tests__/McpServerSection.test.tsx +138 -0
- package/src/modules/library/__tests__/{NewGroupDialog.test.tsx → NewPluginDialog.test.tsx} +22 -22
- package/src/modules/library/__tests__/PersonalAddDialog.test.tsx +7 -7
- package/src/modules/library/__tests__/PluginExtras.test.tsx +131 -0
- package/src/modules/library/__tests__/{GroupJoinRequests.test.tsx → PluginJoinRequests.test.tsx} +24 -24
- package/src/modules/library/__tests__/{GroupPage.test.tsx → PluginPage.test.tsx} +101 -101
- package/src/modules/library/__tests__/{GroupsIndexPage.test.tsx → PluginsIndexPage.test.tsx} +57 -57
- package/src/modules/library/__tests__/{GroupsSidebar.contextmenu.test.tsx → PluginsSidebar.contextmenu.test.tsx} +31 -31
- package/src/modules/library/__tests__/{GroupsSidebar.locked.test.tsx → PluginsSidebar.locked.test.tsx} +28 -28
- package/src/modules/library/__tests__/{GroupsSidebar.test.tsx → PluginsSidebar.test.tsx} +39 -39
- package/src/modules/library/__tests__/{GroupsSidebarMenu.test.tsx → PluginsSidebarMenu.test.tsx} +18 -18
- package/src/modules/library/__tests__/SkillPage.test.tsx +8 -8
- package/src/modules/library/__tests__/ToolConnectionSection.test.tsx +2 -2
- package/src/modules/library/__tests__/ToolPage.test.tsx +41 -12
- package/src/modules/library/__tests__/ToolSharePanel.test.tsx +1 -1
- package/src/modules/library/__tests__/WorkspaceItemRoute.test.tsx +57 -57
- package/src/modules/library/__tests__/auth-harness.tsx +4 -4
- package/src/modules/library/__tests__/status.test.ts +19 -19
- package/src/modules/library/__tests__/tools.api.test.ts +70 -0
- package/src/modules/library/__tests__/useToolPage.test.tsx +4 -4
- package/src/modules/library/components/AccessRequestsBanner.tsx +8 -8
- package/src/modules/library/components/{AddToGroupDialog.tsx → AddToPluginDialog.tsx} +11 -11
- package/src/modules/library/components/ChangeRequestDock.tsx +1 -1
- package/src/modules/library/components/{DeleteGroupDialog.tsx → DeletePluginDialog.tsx} +9 -9
- package/src/modules/library/components/LibraryCard.tsx +26 -2
- package/src/modules/library/components/LibraryLayout.tsx +70 -70
- package/src/modules/library/components/LibraryPage.tsx +8 -8
- package/src/modules/library/components/LockGlyph.tsx +1 -1
- package/src/modules/library/components/{LockedGroupView.tsx → LockedPluginView.tsx} +35 -35
- package/src/modules/library/components/{ManagedGroupRequests.tsx → ManagedPluginRequests.tsx} +13 -13
- package/src/modules/library/components/{NewGroupDialog.tsx → NewPluginDialog.tsx} +24 -24
- package/src/modules/library/components/NewSkillPanel.tsx +5 -5
- package/src/modules/library/components/PageActions.tsx +3 -3
- package/src/modules/library/components/PersonalAddDialog.tsx +5 -5
- package/src/modules/library/components/{PersonalGroupPage.tsx → PersonalPluginPage.tsx} +17 -17
- package/src/modules/library/components/PluginExtras.tsx +195 -0
- package/src/modules/library/components/{GroupIndexRow.tsx → PluginIndexRow.tsx} +6 -6
- package/src/modules/library/components/{GroupJoinRequests.tsx → PluginJoinRequests.tsx} +12 -12
- package/src/modules/library/components/{GroupPage.tsx → PluginPage.tsx} +72 -69
- package/src/modules/library/components/{GroupsIndexPage.tsx → PluginsIndexPage.tsx} +46 -46
- package/src/modules/library/components/{GroupsSidebar.tsx → PluginsSidebar.tsx} +55 -55
- package/src/modules/library/components/{GroupsSidebarMenu.tsx → PluginsSidebarMenu.tsx} +15 -15
- package/src/modules/library/components/{group-page-parts.tsx → plugin-page-parts.tsx} +35 -24
- package/src/modules/library/components/skill-page/SkillPage.tsx +12 -12
- package/src/modules/library/components/tool-page/McpServerSection.tsx +380 -0
- package/src/modules/library/components/tool-page/ToolPage.tsx +22 -5
- package/src/modules/library/hooks/useJoinRequests.ts +8 -8
- package/src/modules/library/routes/LibraryRoutes.tsx +30 -17
- package/src/modules/library/routes/WorkspaceItemRoute.tsx +24 -24
- package/src/modules/library/routes/library-paths.ts +36 -36
- package/src/modules/library/services/library.api.ts +9 -9
- package/src/modules/library/services/{groups.api.ts → plugins.api.ts} +43 -43
- package/src/modules/library/services/tools.api.ts +54 -0
- package/src/modules/library/state/library-data.tsx +46 -46
- package/src/modules/library/utils/names.ts +1 -1
- package/src/modules/library/utils/{personal-group.ts → personal-plugin.ts} +8 -8
- package/src/modules/library/utils/{group-summary.ts → plugin-summary.ts} +14 -14
- package/src/modules/library/utils/status.ts +17 -17
- package/src/modules/onboarding/__tests__/onboarding.test.tsx +86 -8
- package/src/modules/onboarding/agent-clients.ts +18 -14
- package/src/modules/onboarding/components/WelcomePage.tsx +19 -8
- package/src/modules/review/components/MarkdownDiffViewer.tsx +1 -1
- package/src/modules/review/components/ReviewPanel.tsx +11 -11
- package/src/modules/review/components/__tests__/{isGroupItemPath.test.ts → isPluginItemPath.test.ts} +24 -24
- package/src/modules/secrets-vault/components/ToolSecretsPanel.tsx +3 -3
- package/src/modules/secrets-vault/components/__tests__/SecretsPage.test.tsx +1 -1
- package/src/modules/settings/components/SettingsLayout.tsx +1 -1
- package/src/modules/settings/components/SettingsNav.tsx +5 -5
- package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +29 -107
- package/src/modules/toolbar/components/__tests__/AppSwitcher.test.tsx +1 -1
- package/src/modules/toolbar/components/__tests__/ExternalAgentAccessPage.test.tsx +228 -0
- package/src/modules/toolbar/components/__tests__/Toolbar.test.tsx +3 -3
- package/src/modules/workspace/components/FileExplorer.tsx +12 -12
- package/src/modules/workspace/components/__tests__/FileExplorer.test.tsx +14 -14
- package/src/modules/workspace/components/renderers/ToolRenderer.tsx +7 -2
- package/src/modules/workspace/utils/__tests__/diff.test.ts +1 -1
- package/src/modules/workspace/utils/fileTree.ts +3 -3
- package/src/shared/mcp/ClaudeInstallLink.tsx +88 -0
- package/src/shared/mcp/ConnectionInstructions.tsx +51 -0
- package/src/shared/mcp/CopyBlock.tsx +42 -0
- package/src/shared/mcp/__tests__/ClaudeInstallLink.test.tsx +40 -0
- package/src/shared/mcp/__tests__/connect-snippets.test.ts +431 -0
- package/src/shared/mcp/__tests__/useCopyFeedback.test.ts +112 -0
- package/src/shared/mcp/connect-snippets.ts +353 -0
- package/src/shared/mcp/index.ts +28 -0
- package/src/shared/mcp/useCopyFeedback.ts +46 -0
- package/src/test-setup.ts +11 -0
|
@@ -4,10 +4,10 @@ import { NewSkillPanel } from './NewSkillPanel';
|
|
|
4
4
|
import { useLibraryToast } from '../state/toast.context';
|
|
5
5
|
import { COPIED_TOAST, COPY_FAILED_TOAST, copyToClipboard } from '../utils/clipboard';
|
|
6
6
|
|
|
7
|
-
export interface
|
|
8
|
-
/**
|
|
7
|
+
export interface AddToPluginDialogProps {
|
|
8
|
+
/** Plugin name — the folder segment, already decoded. */
|
|
9
9
|
name: string;
|
|
10
|
-
/** Repo-relative primary folder, e.g. `
|
|
10
|
+
/** Repo-relative primary folder, e.g. `Plugins/GTM`. */
|
|
11
11
|
primaryPath: string;
|
|
12
12
|
/**
|
|
13
13
|
* Whether the caller can write the folder. It changes the prompt's landing
|
|
@@ -22,7 +22,7 @@ export interface AddToGroupDialogProps {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
* "Add a skill or tool to {
|
|
25
|
+
* "Add a skill or tool to {plugin}" — the writer's half of the plugin page.
|
|
26
26
|
*
|
|
27
27
|
* The agent prompt is the path everyone gets. Admins also get the direct
|
|
28
28
|
* starter that creates an empty `SKILL.md`; non-admins do not. A placeholder
|
|
@@ -30,7 +30,7 @@ export interface AddToGroupDialogProps {
|
|
|
30
30
|
* send complete drafted content through the ordinary review flow.
|
|
31
31
|
*
|
|
32
32
|
* The prompt is the actual product here. It is copy-pasteable into the agent
|
|
33
|
-
* verbatim and it already knows the
|
|
33
|
+
* verbatim and it already knows the plugin, so nobody has to explain where the
|
|
34
34
|
* skill goes.
|
|
35
35
|
*
|
|
36
36
|
* The add button itself stays consistent for every role. What changes is the
|
|
@@ -38,21 +38,21 @@ export interface AddToGroupDialogProps {
|
|
|
38
38
|
* clause tells the truth about whether the resulting skill lands directly or
|
|
39
39
|
* arrives as a change request.
|
|
40
40
|
*/
|
|
41
|
-
export function
|
|
41
|
+
export function AddToPluginDialog({
|
|
42
42
|
name,
|
|
43
43
|
primaryPath,
|
|
44
44
|
canWrite,
|
|
45
45
|
existingSkills,
|
|
46
46
|
onClose,
|
|
47
|
-
}:
|
|
47
|
+
}: AddToPluginDialogProps) {
|
|
48
48
|
const { isAdmin } = useAdmin();
|
|
49
49
|
const toast = useLibraryToast();
|
|
50
50
|
|
|
51
51
|
// The only sentence in this dialog that varies by role.
|
|
52
52
|
const landing = canWrite
|
|
53
53
|
? 'I run it, so it goes in directly. No review step.'
|
|
54
|
-
: 'I am not an owner, so send it to the
|
|
55
|
-
const prompt = `Help me build a new skill or tool and add it to the ${name}
|
|
54
|
+
: 'I am not an owner, so send it to the plugin as a change request for review.';
|
|
55
|
+
const prompt = `Help me build a new skill or tool and add it to the ${name} plugin at Bevel. ${landing}`;
|
|
56
56
|
|
|
57
57
|
async function copyPrompt() {
|
|
58
58
|
const copied = await copyToClipboard(prompt);
|
|
@@ -78,10 +78,10 @@ export function AddToGroupDialog({
|
|
|
78
78
|
<p className="text-ui text-ink-muted">
|
|
79
79
|
{isAdmin
|
|
80
80
|
? canWrite
|
|
81
|
-
? `Two ways in. Either way it joins ${name}. Everyone in the
|
|
81
|
+
? `Two ways in. Either way it joins ${name}. Everyone in the plugin gets it the next time their agent connects.`
|
|
82
82
|
: `Two ways in. Either way it goes to ${name} as a change request, and an owner reviews it before it joins.`
|
|
83
83
|
: canWrite
|
|
84
|
-
? `Use the prompt below to have your agent draft the skill and add it to ${name} for everyone in the
|
|
84
|
+
? `Use the prompt below to have your agent draft the skill and add it to ${name} for everyone in the plugin.`
|
|
85
85
|
: `Use the prompt below to have your agent draft the skill and send it to ${name} as a change request for an owner to review.`}
|
|
86
86
|
</p>
|
|
87
87
|
|
|
@@ -14,7 +14,7 @@ interface ChangeRequestDockProps {
|
|
|
14
14
|
*
|
|
15
15
|
* It anchors to the VIEWPORT's right edge. It used to sit at
|
|
16
16
|
* `right: calc(50% + 22.5rem)` — left of a centred dialog — and when the skill
|
|
17
|
-
* detail became a page that put it on top of the
|
|
17
|
+
* detail became a page that put it on top of the plugin sidebar. A page has no
|
|
18
18
|
* centred panel to hang off, so the edge is the only stable anchor.
|
|
19
19
|
*
|
|
20
20
|
* Renders nothing when there is nothing to review: an empty box floating beside
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { Banner, Button, Dialog } from '../../../shared/components';
|
|
3
|
-
import {
|
|
3
|
+
import { deletePlugin } from '../services/plugins.api';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* The "are you sure" a
|
|
6
|
+
* The "are you sure" a plugin deletion deserves — and it deserves a bigger one
|
|
7
7
|
* than a single skill's: this takes the folder, every skill and tool inside
|
|
8
8
|
* it, and the membership that made it appear in people's MCPs. The content
|
|
9
9
|
* survives only in git history.
|
|
10
10
|
*
|
|
11
|
-
* One dialog serves both openers (the sidebar's right-click and the
|
|
11
|
+
* One dialog serves both openers (the sidebar's right-click and the plugin
|
|
12
12
|
* page's `⋯` menu), so the two surfaces cannot describe the same act in
|
|
13
13
|
* different words. Who may open it is the caller's decision (`isOwner` on the
|
|
14
14
|
* summary); the backend enforces the same verdict for real.
|
|
15
15
|
*/
|
|
16
|
-
export function
|
|
16
|
+
export function DeletePluginDialog({
|
|
17
17
|
name,
|
|
18
18
|
skillCount,
|
|
19
19
|
toolCount,
|
|
@@ -21,7 +21,7 @@ export function DeleteGroupDialog({
|
|
|
21
21
|
onDeleted,
|
|
22
22
|
}: {
|
|
23
23
|
name: string;
|
|
24
|
-
/** The
|
|
24
|
+
/** The plugin's totals, for copy that says what is actually at stake. */
|
|
25
25
|
skillCount: number;
|
|
26
26
|
toolCount: number;
|
|
27
27
|
onClose(): void;
|
|
@@ -45,13 +45,13 @@ export function DeleteGroupDialog({
|
|
|
45
45
|
setBusy(true);
|
|
46
46
|
setError(null);
|
|
47
47
|
try {
|
|
48
|
-
await
|
|
48
|
+
await deletePlugin(name);
|
|
49
49
|
onDeleted();
|
|
50
50
|
onClose();
|
|
51
51
|
} catch (err) {
|
|
52
52
|
// The backend's refusal names the rule (ownership, a refused push); a
|
|
53
53
|
// generic apology would hide the one thing worth reading.
|
|
54
|
-
setError(err instanceof Error ? err.message : "Couldn't delete the
|
|
54
|
+
setError(err instanceof Error ? err.message : "Couldn't delete the plugin.");
|
|
55
55
|
setBusy(false);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
@@ -69,13 +69,13 @@ export function DeleteGroupDialog({
|
|
|
69
69
|
Cancel
|
|
70
70
|
</Button>
|
|
71
71
|
<Button variant="danger" onClick={() => void remove()} disabled={busy}>
|
|
72
|
-
{busy ? 'Deleting…' : 'Delete
|
|
72
|
+
{busy ? 'Deleting…' : 'Delete plugin'}
|
|
73
73
|
</Button>
|
|
74
74
|
</>
|
|
75
75
|
}
|
|
76
76
|
>
|
|
77
77
|
<p className="text-ui text-ink-muted">
|
|
78
|
-
{`This deletes the
|
|
78
|
+
{`This deletes the plugin for everyone in it. ${contents} Members lose it the next time their agent connects, and there is no undo — the content survives only in git history.`}
|
|
79
79
|
</p>
|
|
80
80
|
{error && (
|
|
81
81
|
<Banner tone="danger" role="alert" className="mt-3">
|
|
@@ -4,8 +4,26 @@ import { StatusDot } from './StatusDot';
|
|
|
4
4
|
import { ToolLogo } from './ToolLogo';
|
|
5
5
|
import type { AttentionStatus, GemState } from '../utils/status';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
/**
|
|
8
|
+
* A discriminated union on `kind`, not a bag of optionals: an integration
|
|
9
|
+
* MUST say its flavor (a card silently missing the badge would compile fine
|
|
10
|
+
* with an optional), and a skill must not be able to carry one.
|
|
11
|
+
*/
|
|
12
|
+
export type LibraryCardProps = LibraryCardCommonProps &
|
|
13
|
+
(
|
|
14
|
+
| { kind: 'skill'; flavor?: never }
|
|
15
|
+
| {
|
|
16
|
+
kind: 'integration';
|
|
17
|
+
/**
|
|
18
|
+
* How the integration is declared: an `mcp.json` server or a `.tool`
|
|
19
|
+
* UTCP manual. Two different files to edit and two different
|
|
20
|
+
* capability sets, so the card says which one this is.
|
|
21
|
+
*/
|
|
22
|
+
flavor: 'mcp' | 'utcp';
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
export interface LibraryCardCommonProps {
|
|
9
27
|
id: string;
|
|
10
28
|
name: string;
|
|
11
29
|
description: string;
|
|
@@ -58,6 +76,7 @@ export function LibraryCard({
|
|
|
58
76
|
version,
|
|
59
77
|
pending,
|
|
60
78
|
onOpen,
|
|
79
|
+
flavor,
|
|
61
80
|
}: LibraryCardProps) {
|
|
62
81
|
/**
|
|
63
82
|
* What the bottom-left says, and when it says anything at all.
|
|
@@ -103,6 +122,11 @@ export function LibraryCard({
|
|
|
103
122
|
column of coloured squares that distinguish nothing. */}
|
|
104
123
|
{kind === 'integration' && <ToolLogo slug={id} name={name} />}
|
|
105
124
|
<span className="truncate text-lede font-semibold text-ink">{name}</span>
|
|
125
|
+
{kind === 'integration' && flavor && (
|
|
126
|
+
<Badge tone="outline" size="xs" className="shrink-0 uppercase">
|
|
127
|
+
{flavor === 'mcp' ? 'MCP server' : 'UTCP manual'}
|
|
128
|
+
</Badge>
|
|
129
|
+
)}
|
|
106
130
|
{pending && (
|
|
107
131
|
<Badge tone="wait" size="xs" className="shrink-0 uppercase">
|
|
108
132
|
In review
|
|
@@ -4,15 +4,15 @@ import { cn } from '../../../lib/utils';
|
|
|
4
4
|
import { DOCUMENT_COLUMN, documentGutters } from '../../../shared/theme/measure';
|
|
5
5
|
import { useAuth } from '../../auth/state/auth.context';
|
|
6
6
|
import { attentionOf, useLibrary } from '../state/library-data';
|
|
7
|
-
import {
|
|
7
|
+
import { personalPluginName } from '../utils/personal-plugin';
|
|
8
8
|
import {
|
|
9
|
-
|
|
9
|
+
isPluginsIndexPath,
|
|
10
10
|
libraryFilterForPath,
|
|
11
|
-
|
|
11
|
+
pathForPluginsIndex,
|
|
12
12
|
pathForLibraryFilter,
|
|
13
13
|
} from '../routes/library-paths';
|
|
14
|
-
import {
|
|
15
|
-
import { primaryFolderOf } from '../utils/
|
|
14
|
+
import { pluginCounts, type LibraryFilter } from '../utils/status';
|
|
15
|
+
import { primaryFolderOf } from '../utils/plugin-summary';
|
|
16
16
|
import { LINK_COPIED_TOAST, LINK_COPY_FAILED_TOAST, copyToClipboard } from '../utils/clipboard';
|
|
17
17
|
import { useLibraryToast } from '../state/toast.context';
|
|
18
18
|
import { useSidebar } from '../../layout/state/sidebar';
|
|
@@ -20,14 +20,14 @@ import { SidebarFrame } from '../../layout/components/SidebarFrame';
|
|
|
20
20
|
import { useWorkspace } from '../../workspace/state/workspace.context';
|
|
21
21
|
import { ManageAccessDialog } from '../../access/components/ManageAccessDialog';
|
|
22
22
|
import { ConnectAgentPill } from '../../onboarding/components/ConnectAgentPill';
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
23
|
+
import { PluginsSidebar, type SidebarContextTarget } from './PluginsSidebar';
|
|
24
|
+
import { PluginsSidebarMenu } from './PluginsSidebarMenu';
|
|
25
|
+
import { AddToPluginDialog } from './AddToPluginDialog';
|
|
26
|
+
import { DeletePluginDialog } from './DeletePluginDialog';
|
|
27
|
+
import { NewPluginDialog } from './NewPluginDialog';
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
* The shell every Library page renders inside: the
|
|
30
|
+
* The shell every Library page renders inside: the plugin nav on the left, the
|
|
31
31
|
* page in the scrolling column on the right.
|
|
32
32
|
*
|
|
33
33
|
* It is also the ONE place the URL and the sidebar meet — the path becomes a
|
|
@@ -36,16 +36,16 @@ import { NewGroupDialog } from './NewGroupDialog';
|
|
|
36
36
|
* can take its filter as a plain prop and the sidebar can hold no state.
|
|
37
37
|
*/
|
|
38
38
|
export function LibraryLayout() {
|
|
39
|
-
const { items,
|
|
39
|
+
const { items, pluginSummaries, reload, reloadPlugins } = useLibrary();
|
|
40
40
|
const location = useLocation();
|
|
41
41
|
const navigate = useNavigate();
|
|
42
42
|
const { user } = useAuth();
|
|
43
43
|
const { kbDirName } = useWorkspace();
|
|
44
44
|
const toast = useLibraryToast();
|
|
45
|
-
const [
|
|
45
|
+
const [newPluginOpen, setNewPluginOpen] = useState(false);
|
|
46
46
|
/**
|
|
47
47
|
* The sidebar's right-click menu, and the two sheets it can open. All three
|
|
48
|
-
* live HERE rather than in `
|
|
48
|
+
* live HERE rather than in `PluginsSidebar` because the verbs need the plugin
|
|
49
49
|
* summaries and the workspace's KB dir — the sidebar is handed a list of
|
|
50
50
|
* names and counts and knows neither. The sidebar reports the click; this
|
|
51
51
|
* decides what is true about what was clicked.
|
|
@@ -54,7 +54,7 @@ export function LibraryLayout() {
|
|
|
54
54
|
/**
|
|
55
55
|
* Captured whole at pick time, not looked up at render time: the menu closes
|
|
56
56
|
* as it hands over, so by the time the dialog paints there is no `menu` left
|
|
57
|
-
* to re-derive the
|
|
57
|
+
* to re-derive the plugin from.
|
|
58
58
|
*/
|
|
59
59
|
const [addTo, setAddTo] = useState<{
|
|
60
60
|
name: string;
|
|
@@ -63,7 +63,7 @@ export function LibraryLayout() {
|
|
|
63
63
|
} | null>(null);
|
|
64
64
|
const [manageFolder, setManageFolder] = useState<string | null>(null);
|
|
65
65
|
/**
|
|
66
|
-
* The
|
|
66
|
+
* The plugin whose delete confirmation is up — captured whole at pick time
|
|
67
67
|
* for the same reason `addTo` is: the menu is gone by the time the dialog
|
|
68
68
|
* paints, and the counts belong in the dialog's copy.
|
|
69
69
|
*/
|
|
@@ -90,48 +90,48 @@ export function LibraryLayout() {
|
|
|
90
90
|
const filter = libraryFilterForPath(location.pathname);
|
|
91
91
|
|
|
92
92
|
/**
|
|
93
|
-
* The member rows: every
|
|
93
|
+
* The member rows: every plugin the caller can READ (or manages), whether or
|
|
94
94
|
* not anything is in it yet. Counts come from the catalog, membership does
|
|
95
|
-
* not — a freshly created
|
|
95
|
+
* not — a freshly created plugin has no skills or tools, and deriving the
|
|
96
96
|
* rows from the items alone made it vanish from the very nav that says
|
|
97
|
-
* "Included in your MCP". Being in a
|
|
97
|
+
* "Included in your MCP". Being in a plugin is what puts it in your MCP;
|
|
98
98
|
* having content is not. The catalog still contributes names the summaries
|
|
99
99
|
* miss (a per-file grant can surface one skill from an otherwise unreadable
|
|
100
100
|
* folder), so the two witnesses are merged rather than either winning.
|
|
101
101
|
*/
|
|
102
|
-
const
|
|
103
|
-
const counts = new Map(
|
|
102
|
+
const plugins = useMemo(() => {
|
|
103
|
+
const counts = new Map(pluginCounts(items).map((g) => [g.plugin, g.count]));
|
|
104
104
|
const names = new Set<string>(counts.keys());
|
|
105
|
-
for (const g of
|
|
105
|
+
for (const g of pluginSummaries) {
|
|
106
106
|
if (g.canRead || g.canWrite) names.add(g.name);
|
|
107
107
|
}
|
|
108
108
|
return [...names]
|
|
109
109
|
.sort((a, b) => a.localeCompare(b))
|
|
110
|
-
.map((
|
|
111
|
-
|
|
112
|
-
count: counts.get(
|
|
113
|
-
attention: attentionOf(items,
|
|
110
|
+
.map((plugin) => ({
|
|
111
|
+
plugin,
|
|
112
|
+
count: counts.get(plugin) ?? 0,
|
|
113
|
+
attention: attentionOf(items, plugin),
|
|
114
114
|
}));
|
|
115
|
-
}, [items,
|
|
115
|
+
}, [items, pluginSummaries]);
|
|
116
116
|
/**
|
|
117
|
-
*
|
|
117
|
+
* Plugins the caller cannot get into, alphabetical.
|
|
118
118
|
*
|
|
119
119
|
* `canRead` is the folder verdict; the catalog is the other witness, and it
|
|
120
120
|
* wins when it disagrees. Access resolves closeness-first, so a per-file grant
|
|
121
121
|
* can hand somebody one skill inside a folder they cannot read — showing that
|
|
122
|
-
*
|
|
123
|
-
* contradicting itself. Same rule as `
|
|
122
|
+
* plugin locked while its skill sits in the gallery above would be the Library
|
|
123
|
+
* contradicting itself. Same rule as `PluginPage`'s member-vs-locked decision,
|
|
124
124
|
* which is what keeps the row and the page it opens in agreement.
|
|
125
125
|
*/
|
|
126
|
-
const
|
|
127
|
-
const visible = new Set(items.map((i) => i.
|
|
128
|
-
return
|
|
129
|
-
// A manager (canWrite via admin-rescue) is not locked out — their
|
|
126
|
+
const lockedPlugins = useMemo(() => {
|
|
127
|
+
const visible = new Set(items.map((i) => i.plugin).filter((g): g is string => g !== null));
|
|
128
|
+
return pluginSummaries
|
|
129
|
+
// A manager (canWrite via admin-rescue) is not locked out — their plugin
|
|
130
130
|
// belongs with the ones they run, not below the gap.
|
|
131
131
|
.filter((g) => !g.canRead && !g.canWrite && !visible.has(g.name))
|
|
132
132
|
.map((g) => g.name)
|
|
133
133
|
.sort((a, b) => a.localeCompare(b));
|
|
134
|
-
}, [
|
|
134
|
+
}, [pluginSummaries, items]);
|
|
135
135
|
|
|
136
136
|
const ownedCount = useMemo(() => items.filter((i) => i.owned).length, [items]);
|
|
137
137
|
/**
|
|
@@ -143,7 +143,7 @@ export function LibraryLayout() {
|
|
|
143
143
|
() => items.filter((i) => i.owned && i.status.state !== 'ok').length,
|
|
144
144
|
[items],
|
|
145
145
|
);
|
|
146
|
-
const ungroupedCount = useMemo(() => items.filter((i) => i.
|
|
146
|
+
const ungroupedCount = useMemo(() => items.filter((i) => i.plugin === null).length, [items]);
|
|
147
147
|
const attentionCount = useMemo(
|
|
148
148
|
() => items.filter((i) => i.kind === 'integration' && i.status.state !== 'ok').length,
|
|
149
149
|
[items],
|
|
@@ -152,12 +152,12 @@ export function LibraryLayout() {
|
|
|
152
152
|
/**
|
|
153
153
|
* What the open menu is pointing at.
|
|
154
154
|
*
|
|
155
|
-
* A
|
|
155
|
+
* A plugin row resolves to its summary, which is where the folder behind it
|
|
156
156
|
* lives — and therefore whether `Add a skill or tool` and `Manage access`
|
|
157
157
|
* have anything to act on at all. A LENS row resolves to nothing, because
|
|
158
158
|
* neither lens is a folder: "Owned by me" and your own space are slices of
|
|
159
159
|
* the catalog, and there is no `access.md` behind a slice. That is the same
|
|
160
|
-
* call the
|
|
160
|
+
* call the plugin page's `PageActions` already makes when it hides `Share` on
|
|
161
161
|
* the personal page, and the menu has to make it the same way or the two
|
|
162
162
|
* surfaces disagree about what a lens is.
|
|
163
163
|
*
|
|
@@ -166,10 +166,10 @@ export function LibraryLayout() {
|
|
|
166
166
|
* this shared with?" should answer.
|
|
167
167
|
*/
|
|
168
168
|
const menuFilter = menu?.filter ?? null;
|
|
169
|
-
const
|
|
169
|
+
const menuPlugin = menuFilter?.kind === 'group' ? menuFilter.plugin : null;
|
|
170
170
|
const menuSummary = useMemo(
|
|
171
|
-
() => (
|
|
172
|
-
[
|
|
171
|
+
() => (menuPlugin ? pluginSummaries.find((g) => g.name === menuPlugin) : undefined),
|
|
172
|
+
[pluginSummaries, menuPlugin],
|
|
173
173
|
);
|
|
174
174
|
const menuFolder = menuSummary ? primaryFolderOf(menuSummary) : null;
|
|
175
175
|
|
|
@@ -195,7 +195,7 @@ export function LibraryLayout() {
|
|
|
195
195
|
|
|
196
196
|
return (
|
|
197
197
|
<div className="flex h-full min-h-0 bg-canvas text-ink">
|
|
198
|
-
{/* The connect-your-agent CTA sits above the
|
|
198
|
+
{/* The connect-your-agent CTA sits above the plugin list — the one row
|
|
199
199
|
that has to be true before the rows under it mean anything. Passed
|
|
200
200
|
IN rather than mounted by the frame: which reminder belongs at the
|
|
201
201
|
top of this nav is the surface's call, and `SidebarFrame` is the
|
|
@@ -204,21 +204,21 @@ export function LibraryLayout() {
|
|
|
204
204
|
place — a person who skipped the welcome page and stayed in
|
|
205
205
|
Knowledge still sees it. It renders nothing once onboarding is
|
|
206
206
|
done. */}
|
|
207
|
-
<SidebarFrame label="Library
|
|
208
|
-
<
|
|
207
|
+
<SidebarFrame label="Library plugins" header={<ConnectAgentPill />}>
|
|
208
|
+
<PluginsSidebar
|
|
209
209
|
filter={filter}
|
|
210
210
|
onSelect={(next) => navigate(pathForLibraryFilter(next))}
|
|
211
|
-
|
|
212
|
-
|
|
211
|
+
plugins={plugins}
|
|
212
|
+
lockedPlugins={lockedPlugins}
|
|
213
213
|
ownedCount={ownedCount}
|
|
214
214
|
ownedAttention={ownedAttention}
|
|
215
|
-
|
|
215
|
+
personalPluginLabel={personalPluginName(user?.name)}
|
|
216
216
|
ungroupedCount={ungroupedCount}
|
|
217
217
|
attentionCount={attentionCount}
|
|
218
218
|
onFinishSetup={() => navigate('/connect')}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
219
|
+
onCreatePlugin={() => setNewPluginOpen(true)}
|
|
220
|
+
pluginsIndexActive={isPluginsIndexPath(location.pathname)}
|
|
221
|
+
onOpenPluginsIndex={() => navigate(pathForPluginsIndex())}
|
|
222
222
|
onContextMenu={openContextMenu}
|
|
223
223
|
/>
|
|
224
224
|
</SidebarFrame>
|
|
@@ -228,22 +228,22 @@ export function LibraryLayout() {
|
|
|
228
228
|
gesture two different ways. Rendered HERE, outside the frame, because
|
|
229
229
|
it is fixed to the pointer rather than laid out in the column. */}
|
|
230
230
|
{menu && (
|
|
231
|
-
<
|
|
231
|
+
<PluginsSidebarMenu
|
|
232
232
|
x={menu.x}
|
|
233
233
|
y={menu.y}
|
|
234
234
|
label={menu.label}
|
|
235
235
|
onClose={() => setMenu(null)}
|
|
236
236
|
onAdd={
|
|
237
|
-
|
|
237
|
+
menuPlugin && menuFolder && menuSummary
|
|
238
238
|
? () =>
|
|
239
239
|
setAddTo({
|
|
240
|
-
name:
|
|
240
|
+
name: menuPlugin,
|
|
241
241
|
primaryPath: menuFolder,
|
|
242
242
|
canWrite: menuSummary.canWrite,
|
|
243
243
|
})
|
|
244
244
|
: undefined
|
|
245
245
|
}
|
|
246
|
-
|
|
246
|
+
onCreatePlugin={() => setNewPluginOpen(true)}
|
|
247
247
|
onCopyLink={menuFilter ? () => void copyLink(menuFilter) : undefined}
|
|
248
248
|
onManageAccess={menuFolder && kbDirName ? () => setManageFolder(menuFolder) : undefined}
|
|
249
249
|
// The OWNER's verb, and only theirs — `isOwner` is the same verdict
|
|
@@ -264,11 +264,11 @@ export function LibraryLayout() {
|
|
|
264
264
|
)}
|
|
265
265
|
|
|
266
266
|
{addTo && (
|
|
267
|
-
<
|
|
267
|
+
<AddToPluginDialog
|
|
268
268
|
name={addTo.name}
|
|
269
269
|
primaryPath={addTo.primaryPath}
|
|
270
270
|
canWrite={addTo.canWrite}
|
|
271
|
-
// Every skill, not just this
|
|
271
|
+
// Every skill, not just this plugin's: a skill's id is its name and
|
|
272
272
|
// ids are global, so that is the collision the create half must catch.
|
|
273
273
|
existingSkills={items.filter((i) => i.kind === 'skill').map((i) => i.name)}
|
|
274
274
|
onClose={() => setAddTo(null)}
|
|
@@ -285,44 +285,44 @@ export function LibraryLayout() {
|
|
|
285
285
|
onClose={() => {
|
|
286
286
|
setManageFolder(null);
|
|
287
287
|
// Granting through the dialog can settle a pending join request —
|
|
288
|
-
// refresh the roster and the catalog together, exactly as the
|
|
288
|
+
// refresh the roster and the catalog together, exactly as the plugin
|
|
289
289
|
// page does when its copy of this dialog closes.
|
|
290
|
-
|
|
290
|
+
reloadPlugins();
|
|
291
291
|
reload();
|
|
292
292
|
}}
|
|
293
293
|
/>
|
|
294
294
|
)}
|
|
295
295
|
|
|
296
296
|
{deleting && (
|
|
297
|
-
<
|
|
297
|
+
<DeletePluginDialog
|
|
298
298
|
name={deleting.name}
|
|
299
299
|
skillCount={deleting.skillCount}
|
|
300
300
|
toolCount={deleting.toolCount}
|
|
301
301
|
onClose={() => setDeleting(null)}
|
|
302
302
|
onDeleted={() => {
|
|
303
303
|
toast(`Deleted ${deleting.name}.`);
|
|
304
|
-
// Standing inside the
|
|
305
|
-
// render "This
|
|
304
|
+
// Standing inside the plugin that just ceased to exist would
|
|
305
|
+
// render "This plugin doesn't exist yet" — the index is the
|
|
306
306
|
// honest place to land. Any other page is unaffected.
|
|
307
|
-
if (filter?.kind === 'group' && filter.
|
|
308
|
-
navigate(
|
|
307
|
+
if (filter?.kind === 'group' && filter.plugin === deleting.name) {
|
|
308
|
+
navigate(pathForPluginsIndex());
|
|
309
309
|
}
|
|
310
310
|
reload();
|
|
311
|
-
|
|
311
|
+
reloadPlugins();
|
|
312
312
|
}}
|
|
313
313
|
/>
|
|
314
314
|
)}
|
|
315
315
|
|
|
316
|
-
{
|
|
317
|
-
<
|
|
316
|
+
{newPluginOpen && (
|
|
317
|
+
<NewPluginDialog
|
|
318
318
|
// Every name the workspace already knows, readable or not: creating
|
|
319
|
-
// `
|
|
319
|
+
// `Plugins/GTM` when a locked `GTM` exists would not make a plugin, it
|
|
320
320
|
// would drop items into somebody else's.
|
|
321
|
-
existing={[...new Set([...
|
|
322
|
-
onClose={() =>
|
|
321
|
+
existing={[...new Set([...plugins.map((g) => g.plugin), ...pluginSummaries.map((g) => g.name)])]}
|
|
322
|
+
onClose={() => setNewPluginOpen(false)}
|
|
323
323
|
onCreated={() => {
|
|
324
324
|
reload();
|
|
325
|
-
|
|
325
|
+
reloadPlugins();
|
|
326
326
|
}}
|
|
327
327
|
/>
|
|
328
328
|
)}
|
|
@@ -6,12 +6,12 @@ import { urlForItemFile } from '../routes/library-paths';
|
|
|
6
6
|
import { useWorkspace } from '../../workspace/state/workspace.context';
|
|
7
7
|
import { emptyMessageFor, filterLibraryItems, type LibraryFilter } from '../utils/status';
|
|
8
8
|
import { Banner, TextField } from '../../../shared/components';
|
|
9
|
-
import {
|
|
9
|
+
import { PluginItemSections } from './plugin-page-parts';
|
|
10
10
|
import { PendingSkillReview } from './PendingSkillReview';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* The Library gallery — the card grid at `/skills-and-tools/everything` and its
|
|
14
|
-
* filtered views (`/owned`, and a
|
|
14
|
+
* filtered views (`/owned`, and a plugin's cards).
|
|
15
15
|
*
|
|
16
16
|
* This is CONTENT only: the sidebar, the flex shell and the data live in
|
|
17
17
|
* `LibraryLayout` + `LibraryProvider` above it. The filter arrives as a prop
|
|
@@ -23,10 +23,10 @@ import { PendingSkillReview } from './PendingSkillReview';
|
|
|
23
23
|
*
|
|
24
24
|
* - the LOADOUT. It came from a retired mock; the prototype has no such
|
|
25
25
|
* concept, and it was a documented client-side stub, so nothing persisted
|
|
26
|
-
* was lost. Its rail is now the
|
|
27
|
-
* - Skills / Integrations filter chips.
|
|
26
|
+
* was lost. Its rail is now the plugin nav.
|
|
27
|
+
* - Skills / Integrations filter chips. Plugins are the structure, and a plugin
|
|
28
28
|
* owns its skills AND the tools they need, so splitting the catalog by kind
|
|
29
|
-
* showed a
|
|
29
|
+
* showed a plugin's integrations detached from the reason they exist.
|
|
30
30
|
*/
|
|
31
31
|
|
|
32
32
|
/** The h1 names what the sidebar has selected, so the two never disagree. */
|
|
@@ -39,7 +39,7 @@ function headingFor(filter: LibraryFilter): string {
|
|
|
39
39
|
case 'ungrouped':
|
|
40
40
|
return 'Yours alone';
|
|
41
41
|
case 'group':
|
|
42
|
-
return filter.
|
|
42
|
+
return filter.plugin;
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
|
|
@@ -104,13 +104,13 @@ export function LibraryPage({ filter }: { filter: LibraryFilter }) {
|
|
|
104
104
|
{emptyMessageFor(filter, query)}
|
|
105
105
|
</div>
|
|
106
106
|
) : (
|
|
107
|
-
// Skills and tools, split — the same two bands a
|
|
107
|
+
// Skills and tools, split — the same two bands a plugin page has.
|
|
108
108
|
// One undifferentiated grid made you read every card's body to learn
|
|
109
109
|
// what kind of thing it was; the heading does that now, once, for a
|
|
110
110
|
// whole band. A band with nothing in it is dropped rather than shown
|
|
111
111
|
// empty: this is a search result, not an inventory of what could be.
|
|
112
112
|
<div className="pb-14">
|
|
113
|
-
<
|
|
113
|
+
<PluginItemSections
|
|
114
114
|
skillItems={visible.filter((i) => i.kind === 'skill')}
|
|
115
115
|
toolItems={visible.filter((i) => i.kind === 'integration')}
|
|
116
116
|
onOpen={openItem}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The lock. One shape, three places: the sidebar's count box, the `Locked`
|
|
3
|
-
* badge on a
|
|
3
|
+
* badge on a plugin's page, and the all-plugins index rows.
|
|
4
4
|
*
|
|
5
5
|
* Inline rather than an icon-library import because it is drawn ~20px wide in
|
|
6
6
|
* a fixed slot and has to inherit `currentColor` from the row it sits in —
|