@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
|
@@ -3,33 +3,33 @@ import { useNavigate } from 'react-router-dom';
|
|
|
3
3
|
import { Badge, Banner } from '../../../shared/components';
|
|
4
4
|
import { useAuth } from '../../auth/state/auth.context';
|
|
5
5
|
import { attentionOf, useLibrary, type LibraryItem } from '../state/library-data';
|
|
6
|
-
import {
|
|
7
|
-
import { LIBRARY_ROOT,
|
|
8
|
-
import { ownersTextOf } from '../utils/
|
|
9
|
-
import type {
|
|
10
|
-
import {
|
|
6
|
+
import { personalPluginName } from '../utils/personal-plugin';
|
|
7
|
+
import { LIBRARY_ROOT, pathForPlugin } from '../routes/library-paths';
|
|
8
|
+
import { ownersTextOf } from '../utils/plugin-summary';
|
|
9
|
+
import type { PluginSummary } from '../services/plugins.api';
|
|
10
|
+
import { PluginIndexRow } from './PluginIndexRow';
|
|
11
11
|
import { LockGlyph } from './LockGlyph';
|
|
12
|
-
import {
|
|
12
|
+
import { ManagedPluginRequests } from './ManagedPluginRequests';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
* The all-
|
|
15
|
+
* The all-plugins index — `/skills-and-tools`, where the Library opens.
|
|
16
16
|
*
|
|
17
|
-
* The sidebar can only show
|
|
18
|
-
* you may DISCOVER — the endpoint returns a
|
|
17
|
+
* The sidebar can only show plugins you are IN. This page also shows the ones
|
|
18
|
+
* you may DISCOVER — the endpoint returns a plugin exactly when the caller is
|
|
19
19
|
* a member, manages it, or can read its `access.md` (the discovery grant), so
|
|
20
|
-
* a
|
|
20
|
+
* a plugin with none of those is absent here too, not merely unlabelled.
|
|
21
21
|
*
|
|
22
|
-
* Two sources, one list. The `GET /api/
|
|
22
|
+
* Two sources, one list. The `GET /api/plugins` summaries are authoritative
|
|
23
23
|
* about existence and access; the caller's own catalog is authoritative about
|
|
24
|
-
* what they can actually see. A
|
|
24
|
+
* what they can actually see. A plugin in the catalog but missing from the
|
|
25
25
|
* summaries (endpoint degraded, or a folder the scan hasn't picked up) still
|
|
26
26
|
* gets a row, because the items are right there.
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
|
-
/** A
|
|
29
|
+
/** A plugin's rows, whichever source could speak for it. */
|
|
30
30
|
interface IndexEntry {
|
|
31
31
|
name: string;
|
|
32
|
-
summary:
|
|
32
|
+
summary: PluginSummary | null;
|
|
33
33
|
skillCount: number;
|
|
34
34
|
toolCount: number;
|
|
35
35
|
attention: number;
|
|
@@ -37,86 +37,86 @@ interface IndexEntry {
|
|
|
37
37
|
member: boolean;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
export function
|
|
41
|
-
const { items,
|
|
40
|
+
export function PluginsIndexPage() {
|
|
41
|
+
const { items, pluginSummaries, pluginsLoading, pluginsError, reloadPlugins } = useLibrary();
|
|
42
42
|
const navigate = useNavigate();
|
|
43
43
|
const { user } = useAuth();
|
|
44
44
|
|
|
45
|
-
const personalName =
|
|
45
|
+
const personalName = personalPluginName(user?.name);
|
|
46
46
|
const ungroupedSkills = countKind(items, null, 'skill');
|
|
47
47
|
const ungroupedTools = countKind(items, null, 'integration');
|
|
48
48
|
|
|
49
49
|
const entries = useMemo((): IndexEntry[] => {
|
|
50
|
-
const names = new Set<string>(
|
|
51
|
-
for (const item of items) if (item.
|
|
50
|
+
const names = new Set<string>(pluginSummaries.map((g) => g.name));
|
|
51
|
+
for (const item of items) if (item.plugin) names.add(item.plugin);
|
|
52
52
|
|
|
53
53
|
return [...names]
|
|
54
54
|
.sort((a, b) => a.localeCompare(b))
|
|
55
55
|
.map((name) => {
|
|
56
|
-
const summary =
|
|
56
|
+
const summary = pluginSummaries.find((g) => g.name === name) ?? null;
|
|
57
57
|
const derivedSkills = countKind(items, name, 'skill');
|
|
58
58
|
const derivedTools = countKind(items, name, 'integration');
|
|
59
59
|
const hasItems = derivedSkills + derivedTools > 0;
|
|
60
60
|
return {
|
|
61
61
|
name,
|
|
62
62
|
summary,
|
|
63
|
-
// The summary's counts are the
|
|
63
|
+
// The summary's counts are the plugin's TOTALS; the catalog's are the
|
|
64
64
|
// caller's slice. Prefer the totals — a member should see the same
|
|
65
|
-
// "4 skills" here as on the
|
|
65
|
+
// "4 skills" here as on the plugin page.
|
|
66
66
|
skillCount: summary ? summary.skillCount : derivedSkills,
|
|
67
67
|
toolCount: summary ? summary.toolCount : derivedTools,
|
|
68
68
|
attention: attentionOf(items, name),
|
|
69
69
|
member: summary ? summary.canRead || summary.canWrite || hasItems : hasItems,
|
|
70
70
|
};
|
|
71
71
|
});
|
|
72
|
-
}, [
|
|
72
|
+
}, [pluginSummaries, items]);
|
|
73
73
|
|
|
74
74
|
const mine = entries.filter((e) => e.member);
|
|
75
75
|
const locked = entries.filter((e) => !e.member);
|
|
76
76
|
|
|
77
77
|
return (
|
|
78
78
|
<div className="pb-14">
|
|
79
|
-
<h1 className="text-display font-semibold">All
|
|
79
|
+
<h1 className="text-display font-semibold">All plugins</h1>
|
|
80
80
|
<p className="mt-0.5 text-ui text-ink-muted">
|
|
81
|
-
A
|
|
81
|
+
A plugin carries skills and tools for the people in it.
|
|
82
82
|
</p>
|
|
83
83
|
|
|
84
84
|
{/* Somebody asking to join one of these is the news on a page about
|
|
85
|
-
|
|
85
|
+
plugins, and this is the view the Library opens on — the one place
|
|
86
86
|
the ask is certain to be seen. Renders nothing when nothing pends. */}
|
|
87
87
|
<div className="mt-5 empty:mt-0">
|
|
88
|
-
<
|
|
88
|
+
<ManagedPluginRequests />
|
|
89
89
|
</div>
|
|
90
90
|
|
|
91
91
|
{/* "Owned by me" used to head this list and does not any more: it is a
|
|
92
|
-
LENS on every
|
|
92
|
+
LENS on every plugin (the things you answer for, wherever they live),
|
|
93
93
|
not a place items belong to. It stays in the sidebar, where lenses
|
|
94
|
-
go. What remains here is the one
|
|
94
|
+
go. What remains here is the one plugin that really is yours. */}
|
|
95
95
|
<SectionHead>Yours</SectionHead>
|
|
96
96
|
<RowList>
|
|
97
|
-
<
|
|
97
|
+
<PluginIndexRow
|
|
98
98
|
label={personalName}
|
|
99
|
-
description="Your sign-ins and the skills no
|
|
99
|
+
description="Your sign-ins and the skills no plugin carries"
|
|
100
100
|
meta={countsText(ungroupedSkills, ungroupedTools)}
|
|
101
101
|
onOpen={() => navigate(`${LIBRARY_ROOT}/yours`)}
|
|
102
102
|
/>
|
|
103
103
|
</RowList>
|
|
104
104
|
|
|
105
|
-
{
|
|
105
|
+
{pluginsError ? (
|
|
106
106
|
<Banner role="alert" tone="danger" className="mt-6">
|
|
107
|
-
{
|
|
108
|
-
<button type="button" className="ml-3 font-semibold underline" onClick={
|
|
107
|
+
{pluginsError}
|
|
108
|
+
<button type="button" className="ml-3 font-semibold underline" onClick={reloadPlugins}>
|
|
109
109
|
Try again
|
|
110
110
|
</button>
|
|
111
111
|
</Banner>
|
|
112
|
-
) :
|
|
113
|
-
<div className="py-16 text-center text-ui text-ink-faint">Loading
|
|
112
|
+
) : pluginsLoading && pluginSummaries.length === 0 ? (
|
|
113
|
+
<div className="py-16 text-center text-ui text-ink-faint">Loading plugins…</div>
|
|
114
114
|
) : (
|
|
115
115
|
<>
|
|
116
|
-
<SectionHead count={mine.length}>
|
|
116
|
+
<SectionHead count={mine.length}>Your plugins</SectionHead>
|
|
117
117
|
<RowList>
|
|
118
118
|
{mine.map((entry) => (
|
|
119
|
-
<
|
|
119
|
+
<PluginIndexRow
|
|
120
120
|
key={entry.name}
|
|
121
121
|
label={entry.name}
|
|
122
122
|
badge={
|
|
@@ -134,17 +134,17 @@ export function GroupsIndexPage() {
|
|
|
134
134
|
</Badge>
|
|
135
135
|
) : undefined
|
|
136
136
|
}
|
|
137
|
-
onOpen={() => navigate(
|
|
137
|
+
onOpen={() => navigate(pathForPlugin(entry.name))}
|
|
138
138
|
/>
|
|
139
139
|
))}
|
|
140
140
|
</RowList>
|
|
141
141
|
|
|
142
142
|
{locked.length > 0 && (
|
|
143
143
|
<>
|
|
144
|
-
<SectionHead count={locked.length}>
|
|
144
|
+
<SectionHead count={locked.length}>Request access</SectionHead>
|
|
145
145
|
<RowList>
|
|
146
146
|
{locked.map((entry) => (
|
|
147
|
-
<
|
|
147
|
+
<PluginIndexRow
|
|
148
148
|
key={entry.name}
|
|
149
149
|
label={entry.name}
|
|
150
150
|
{...describe(entry)}
|
|
@@ -166,7 +166,7 @@ export function GroupsIndexPage() {
|
|
|
166
166
|
</Badge>
|
|
167
167
|
)
|
|
168
168
|
}
|
|
169
|
-
onOpen={() => navigate(
|
|
169
|
+
onOpen={() => navigate(pathForPlugin(entry.name))}
|
|
170
170
|
/>
|
|
171
171
|
))}
|
|
172
172
|
</RowList>
|
|
@@ -180,7 +180,7 @@ export function GroupsIndexPage() {
|
|
|
180
180
|
|
|
181
181
|
/**
|
|
182
182
|
* A row's description + meta. With a summary the row leads with WHO runs the
|
|
183
|
-
*
|
|
183
|
+
* plugin and puts the counts on the right; without one there is no verified
|
|
184
184
|
* principal to name, so the counts move left and the meta slot stays empty
|
|
185
185
|
* rather than inventing a "Run by …" we never resolved.
|
|
186
186
|
*/
|
|
@@ -192,7 +192,7 @@ function describe(entry: IndexEntry): { description: string; meta?: string } {
|
|
|
192
192
|
|
|
193
193
|
/**
|
|
194
194
|
* `{n} skills · {n} tools`, fixed plural. Not an oversight: the spec's own
|
|
195
|
-
* empty-
|
|
195
|
+
* empty-plugin example reads `0 skills · 0 tools`, so this is a label for two
|
|
196
196
|
* quantities rather than a sentence about them, and it stays the same width as
|
|
197
197
|
* the row above it.
|
|
198
198
|
*/
|
|
@@ -200,8 +200,8 @@ function countsText(skills: number, tools: number): string {
|
|
|
200
200
|
return `${skills} skills · ${tools} tools`;
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
-
function countKind(items: LibraryItem[],
|
|
204
|
-
return items.filter((i) => i.
|
|
203
|
+
function countKind(items: LibraryItem[], plugin: string | null, kind: LibraryItem['kind']): number {
|
|
204
|
+
return items.filter((i) => i.plugin === plugin && i.kind === kind).length;
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
/** Section label with an optional count cap beside it, not inside it — the
|
|
@@ -21,47 +21,47 @@ export interface SidebarContextTarget {
|
|
|
21
21
|
row: HTMLElement | null;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
export interface
|
|
24
|
+
export interface PluginsSidebarProps {
|
|
25
25
|
/** What the URL has selected, or null on a page with no gallery filter. */
|
|
26
26
|
filter: LibraryFilter | null;
|
|
27
27
|
/** A row was clicked — the layout navigates; the sidebar owns no state. */
|
|
28
28
|
onSelect(filter: LibraryFilter): void;
|
|
29
|
-
/** Readable
|
|
30
|
-
|
|
29
|
+
/** Readable plugins, with their item count and how many integrations need setup. */
|
|
30
|
+
plugins: { plugin: string; count: number; attention: number }[];
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
32
|
+
* Plugins the caller cannot read, alphabetical. Rendered after a gap, with a
|
|
33
33
|
* lock instead of a count.
|
|
34
34
|
*/
|
|
35
|
-
|
|
35
|
+
lockedPlugins: string[];
|
|
36
36
|
ownedCount: number;
|
|
37
37
|
/**
|
|
38
38
|
* How many of the caller's OWN items are waiting on them. Drives the amber
|
|
39
39
|
* badge; when zero the row shows `ownedCount` in grey instead.
|
|
40
40
|
*/
|
|
41
41
|
ownedAttention: number;
|
|
42
|
-
/** The caller's own space, e.g. `Juan's
|
|
43
|
-
|
|
42
|
+
/** The caller's own space, e.g. `Juan's Plugin` — see `personalPluginName`. */
|
|
43
|
+
personalPluginLabel: string;
|
|
44
44
|
ungroupedCount: number;
|
|
45
45
|
/** Integrations across the catalog that need setup — the amber count. */
|
|
46
46
|
attentionCount: number;
|
|
47
47
|
/** Send the user to the Connect page to finish those. */
|
|
48
48
|
onFinishSetup(): void;
|
|
49
|
-
/** Start a new
|
|
50
|
-
|
|
49
|
+
/** Start a new plugin. The layout owns the dialog; this is only the intent. */
|
|
50
|
+
onCreatePlugin(): void;
|
|
51
51
|
/**
|
|
52
|
-
* The all-
|
|
52
|
+
* The all-plugins index is showing. Beside `filter` rather than inside it: the
|
|
53
53
|
* index lists PLACES, not a filtered slice of the catalog, so it is not a
|
|
54
54
|
* `LibraryFilter` and pretending otherwise would put a row in the gallery's
|
|
55
55
|
* vocabulary that no gallery can render.
|
|
56
56
|
*/
|
|
57
|
-
|
|
57
|
+
pluginsIndexActive: boolean;
|
|
58
58
|
/** Go to the index — the Library's home. */
|
|
59
|
-
|
|
59
|
+
onOpenPluginsIndex(): void;
|
|
60
60
|
/**
|
|
61
61
|
* A row — or the nav's empty space — was right-clicked. Like every other
|
|
62
62
|
* handler here this is an INTENT, not a menu: the layout owns the popup,
|
|
63
|
-
* because the verbs in it (add to this
|
|
64
|
-
*
|
|
63
|
+
* because the verbs in it (add to this plugin, manage its access) need the
|
|
64
|
+
* plugin summaries and the workspace, and the sidebar knows neither.
|
|
65
65
|
*
|
|
66
66
|
* Omitted, the nav does nothing on right-click and the browser's own menu
|
|
67
67
|
* appears — which is the honest default for a view with no actions wired.
|
|
@@ -73,9 +73,9 @@ export interface GroupsSidebarProps {
|
|
|
73
73
|
* The library's nav spine — the prototype's `.side` + `.nav` (lines 55-95).
|
|
74
74
|
*
|
|
75
75
|
* Replaces the loadout rail, which came from a retired mock and has no
|
|
76
|
-
* equivalent in the prototype.
|
|
76
|
+
* equivalent in the prototype. Plugins ARE the structure here: the sidebar is
|
|
77
77
|
* how you move between them, which is why the page no longer carries
|
|
78
|
-
* Skills/Integrations filter chips. A
|
|
78
|
+
* Skills/Integrations filter chips. A plugin is a folder, so this list is
|
|
79
79
|
* derived from the catalog's paths rather than from a registry.
|
|
80
80
|
*
|
|
81
81
|
* It is a pure view of the URL: `filter` comes down, clicks go up as intents,
|
|
@@ -87,22 +87,22 @@ export interface GroupsSidebarProps {
|
|
|
87
87
|
* Knowledge's file tree renders inside too. That is the whole reason the two
|
|
88
88
|
* navs cannot drift: there is one of them, holding a different list.
|
|
89
89
|
*/
|
|
90
|
-
export function
|
|
90
|
+
export function PluginsSidebar({
|
|
91
91
|
filter,
|
|
92
92
|
onSelect,
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
plugins,
|
|
94
|
+
lockedPlugins,
|
|
95
95
|
ownedCount,
|
|
96
96
|
ownedAttention,
|
|
97
|
-
|
|
97
|
+
personalPluginLabel,
|
|
98
98
|
ungroupedCount,
|
|
99
99
|
attentionCount,
|
|
100
100
|
onFinishSetup,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
onCreatePlugin,
|
|
102
|
+
pluginsIndexActive,
|
|
103
|
+
onOpenPluginsIndex,
|
|
104
104
|
onContextMenu,
|
|
105
|
-
}:
|
|
105
|
+
}: PluginsSidebarProps) {
|
|
106
106
|
const rowClass = (selected: boolean) =>
|
|
107
107
|
cn(
|
|
108
108
|
'flex items-center justify-between gap-2 rounded-sm px-2.5 py-1.5 text-ui transition-colors',
|
|
@@ -116,7 +116,7 @@ export function GroupsSidebar({
|
|
|
116
116
|
*/
|
|
117
117
|
const isCurrent = (target: LibraryFilter) =>
|
|
118
118
|
target.kind === 'group'
|
|
119
|
-
? filter?.kind === 'group' && filter.
|
|
119
|
+
? filter?.kind === 'group' && filter.plugin === target.plugin
|
|
120
120
|
: filter?.kind === target.kind;
|
|
121
121
|
|
|
122
122
|
/**
|
|
@@ -167,7 +167,7 @@ export function GroupsSidebar({
|
|
|
167
167
|
);
|
|
168
168
|
|
|
169
169
|
/**
|
|
170
|
-
* A
|
|
170
|
+
* A plugin the caller cannot read. Same chrome as every other row, because it
|
|
171
171
|
* is the same kind of thing — a place in the workspace — and demoting it
|
|
172
172
|
* visually would undo the reason it is listed at all.
|
|
173
173
|
*
|
|
@@ -178,7 +178,7 @@ export function GroupsSidebar({
|
|
|
178
178
|
* words, so the glyph itself can stay decorative.
|
|
179
179
|
*/
|
|
180
180
|
const lockedRow = (name: string) => {
|
|
181
|
-
const target: LibraryFilter = { kind: 'group',
|
|
181
|
+
const target: LibraryFilter = { kind: 'group', plugin: name };
|
|
182
182
|
return (
|
|
183
183
|
<button
|
|
184
184
|
key={`locked:${name}`}
|
|
@@ -188,7 +188,7 @@ export function GroupsSidebar({
|
|
|
188
188
|
className={rowClass(isCurrent(target))}
|
|
189
189
|
onClick={() => onSelect(target)}
|
|
190
190
|
// A locked row gets the SAME menu as a readable one, for the same
|
|
191
|
-
// reason it gets the same click: a
|
|
191
|
+
// reason it gets the same click: a plugin you are not in is still a
|
|
192
192
|
// place, and `Manage access` is exactly the item an admin locked out of
|
|
193
193
|
// one needs. Which verbs are actually true is the layout's call.
|
|
194
194
|
onContextMenu={(e) => openMenu(e, target, name, e.currentTarget)}
|
|
@@ -204,7 +204,7 @@ export function GroupsSidebar({
|
|
|
204
204
|
return (
|
|
205
205
|
<>
|
|
206
206
|
<nav
|
|
207
|
-
aria-label="Library
|
|
207
|
+
aria-label="Library plugins"
|
|
208
208
|
className="flex min-h-0 flex-1 flex-col gap-px overflow-y-auto"
|
|
209
209
|
// The nav's empty space is a target too — Knowledge's tree gives its
|
|
210
210
|
// ROOT row a menu holding the create verbs, and this is where the
|
|
@@ -214,29 +214,29 @@ export function GroupsSidebar({
|
|
|
214
214
|
>
|
|
215
215
|
{/* The home row, above every section and belonging to none of them:
|
|
216
216
|
it is where the Library opens, and the one place that lists the
|
|
217
|
-
|
|
217
|
+
plugins you are NOT in beside the ones you are. Unlabelled and
|
|
218
218
|
first for the same reason — a destination the whole surface
|
|
219
219
|
hangs off does not sit inside a category of lenses.
|
|
220
220
|
|
|
221
221
|
Written out rather than built by `row`, because it is the one
|
|
222
222
|
row with no `LibraryFilter` behind it: the index is a list of
|
|
223
223
|
PLACES, not a slice of the catalog. Its menu is therefore the
|
|
224
|
-
nav's own (`filter: null`) — create a
|
|
224
|
+
nav's own (`filter: null`) — create a plugin, and none of the
|
|
225
225
|
verbs that need a folder to point at. */}
|
|
226
226
|
<button
|
|
227
227
|
type="button"
|
|
228
|
-
aria-current={
|
|
229
|
-
className={rowClass(
|
|
230
|
-
onClick={
|
|
231
|
-
onContextMenu={(e) => openMenu(e, null, 'All
|
|
228
|
+
aria-current={pluginsIndexActive}
|
|
229
|
+
className={rowClass(pluginsIndexActive)}
|
|
230
|
+
onClick={onOpenPluginsIndex}
|
|
231
|
+
onContextMenu={(e) => openMenu(e, null, 'All plugins', e.currentTarget)}
|
|
232
232
|
>
|
|
233
|
-
<span className="truncate">All
|
|
233
|
+
<span className="truncate">All plugins</span>
|
|
234
234
|
</button>
|
|
235
235
|
|
|
236
236
|
{/* Lenses — the whole catalog, sliced — which is exactly what the
|
|
237
|
-
|
|
237
|
+
plugin rows below are not. Naming the section is what keeps that
|
|
238
238
|
distinction visible. `Everything` is a row again now that the
|
|
239
|
-
Library lands on the
|
|
239
|
+
Library lands on the plugins index instead: without one it would
|
|
240
240
|
be a page with no way in. */}
|
|
241
241
|
<SectionLabel spaced>Library</SectionLabel>
|
|
242
242
|
{row('Everything', { kind: 'all' }, 0)}
|
|
@@ -251,26 +251,26 @@ export function GroupsSidebar({
|
|
|
251
251
|
ownedAttention > 0 ? ownedAttention : ownedCount,
|
|
252
252
|
ownedAttention > 0 ? 'pending' : 'count',
|
|
253
253
|
)}
|
|
254
|
-
<
|
|
254
|
+
<PluginsLabel onCreate={onCreatePlugin} />
|
|
255
255
|
|
|
256
|
-
{/* Your own space leads the
|
|
256
|
+
{/* Your own space leads the plugins, as in the prototype (line 2487):
|
|
257
257
|
it is the one you are always in. */}
|
|
258
|
-
{row(
|
|
259
|
-
{
|
|
260
|
-
// Amber wins the count slot: a
|
|
258
|
+
{row(personalPluginLabel, { kind: 'ungrouped' }, ungroupedCount)}
|
|
259
|
+
{plugins.map(({ plugin, count, attention }) =>
|
|
260
|
+
// Amber wins the count slot: a plugin that needs setup is telling you
|
|
261
261
|
// something, and how many items it holds is not the news.
|
|
262
262
|
row(
|
|
263
|
-
|
|
264
|
-
{ kind: 'group',
|
|
263
|
+
plugin,
|
|
264
|
+
{ kind: 'group', plugin },
|
|
265
265
|
attention > 0 ? attention : count,
|
|
266
266
|
attention > 0 ? 'pending' : 'count',
|
|
267
267
|
),
|
|
268
268
|
)}
|
|
269
|
-
{/* Locked
|
|
269
|
+
{/* Locked plugins, after the prototype's 14px `.navgap`. The gap is the
|
|
270
270
|
whole statement: these are in the same list because they are in the
|
|
271
271
|
same workspace, and below a break because you are not in them. */}
|
|
272
|
-
{
|
|
273
|
-
{
|
|
272
|
+
{lockedPlugins.length > 0 && <div className="h-3.5" aria-hidden="true" />}
|
|
273
|
+
{lockedPlugins.map(lockedRow)}
|
|
274
274
|
</nav>
|
|
275
275
|
|
|
276
276
|
{attentionCount > 0 && (
|
|
@@ -287,19 +287,19 @@ export function GroupsSidebar({
|
|
|
287
287
|
}
|
|
288
288
|
|
|
289
289
|
/**
|
|
290
|
-
* The `INCLUDED IN YOUR MCP` heading, and the one way to make a new
|
|
290
|
+
* The `INCLUDED IN YOUR MCP` heading, and the one way to make a new plugin —
|
|
291
291
|
* the prototype's `.lbladd` (line 78).
|
|
292
292
|
*
|
|
293
293
|
* The heading says what this list IS rather than what its rows are called:
|
|
294
294
|
* these folders are the set mounted into the caller's MCP — the agent's
|
|
295
|
-
* working context — not merely a directory of
|
|
295
|
+
* working context — not merely a directory of plugins. (The locked rows that
|
|
296
296
|
* trail the list sit below a gap for exactly that reason: they are in the
|
|
297
297
|
* workspace but not in your MCP, and the break is what keeps the heading
|
|
298
298
|
* honest about them.)
|
|
299
299
|
*
|
|
300
|
-
* `All
|
|
300
|
+
* `All plugins` is NOT a row here. It heads the whole nav instead: it is the
|
|
301
301
|
* Library's home rather than one more entry in the set mounted into your MCP,
|
|
302
|
-
* and inside this list it used to collect the clicks meant for the
|
|
302
|
+
* and inside this list it used to collect the clicks meant for the plugins
|
|
303
303
|
* under it.
|
|
304
304
|
*
|
|
305
305
|
* The `+` is always in the DOM and always reachable by keyboard; only its
|
|
@@ -320,15 +320,15 @@ function SectionLabel({ children, spaced = false }: { children: ReactNode; space
|
|
|
320
320
|
);
|
|
321
321
|
}
|
|
322
322
|
|
|
323
|
-
function
|
|
323
|
+
function PluginsLabel({ onCreate }: { onCreate(): void }) {
|
|
324
324
|
return (
|
|
325
325
|
<div className="group/label flex items-center gap-1 px-2.5 pb-1.5 pt-5">
|
|
326
326
|
<span className="text-label uppercase text-ink-faint">Included in your MCP</span>
|
|
327
327
|
<button
|
|
328
328
|
type="button"
|
|
329
329
|
onClick={onCreate}
|
|
330
|
-
title="New
|
|
331
|
-
aria-label="New
|
|
330
|
+
title="New plugin"
|
|
331
|
+
aria-label="New plugin"
|
|
332
332
|
className="ml-auto flex size-4.5 items-center justify-center rounded-xs text-ui leading-none text-ink-faint opacity-0 transition-opacity hover:bg-hover hover:text-ink focus-visible:opacity-100 group-hover/label:opacity-100"
|
|
333
333
|
>
|
|
334
334
|
+
|
|
@@ -6,19 +6,19 @@ import { MenuItem, MenuPanel, useDismissableMenu } from '../../../shared/compone
|
|
|
6
6
|
* The Library sidebar's right-click menu — Knowledge's `ContextMenu`
|
|
7
7
|
* (`FileExplorer.tsx:126`) with the Library's verbs in it.
|
|
8
8
|
*
|
|
9
|
-
* The two navs are one frame holding two lists (see `
|
|
9
|
+
* The two navs are one frame holding two lists (see `PluginsSidebar`'s
|
|
10
10
|
* docstring), so a right-click has to BEHAVE the same in both: the panel opens
|
|
11
11
|
* at the pointer, an outside click or Escape closes it, and Escape hands focus
|
|
12
12
|
* back to the row it came from. None of that is `MenuPanel`'s job — its own
|
|
13
13
|
* docstring says it is presentation only — so the wiring is `useDismissableMenu`
|
|
14
14
|
* and the fixed wrapper is the caller's, exactly as in the file tree.
|
|
15
15
|
*
|
|
16
|
-
* The ITEMS differ, because the things differ. A
|
|
16
|
+
* The ITEMS differ, because the things differ. A plugin is not a file: there is
|
|
17
17
|
* no Rename and no Download here, because no endpoint stands behind either for
|
|
18
|
-
* a
|
|
18
|
+
* a plugin, and a menu item that cannot do its job is worse than one that is
|
|
19
19
|
* not there (the same call `PageActions` already makes about Leave
|
|
20
|
-
* subscription). Delete DOES have an endpoint now — `DELETE /api/
|
|
21
|
-
* the owner's verb — so it appears exactly when the caller owns the
|
|
20
|
+
* subscription). Delete DOES have an endpoint now — `DELETE /api/plugins/:name`,
|
|
21
|
+
* the owner's verb — so it appears exactly when the caller owns the plugin and
|
|
22
22
|
* not otherwise. What carries over is the pairing that matters — a create
|
|
23
23
|
* verb, a copy verb, and access below the rule — wearing the SAME lucide
|
|
24
24
|
* glyphs the file tree gives each, so the two menus read as one product
|
|
@@ -26,11 +26,11 @@ import { MenuItem, MenuPanel, useDismissableMenu } from '../../../shared/compone
|
|
|
26
26
|
*
|
|
27
27
|
* Every action is optional, and an absent one is simply not rendered — the same
|
|
28
28
|
* contract `ContextMenu` uses for `onCreateFile` / `onDownload`. That is what
|
|
29
|
-
* lets one component serve a
|
|
29
|
+
* lets one component serve a plugin row, a lens row and the nav's empty space
|
|
30
30
|
* with no `kind` switch inside it: the layout is the one that knows which verbs
|
|
31
31
|
* are true for what was clicked, and it says so by passing them.
|
|
32
32
|
*/
|
|
33
|
-
export interface
|
|
33
|
+
export interface PluginsSidebarMenuProps {
|
|
34
34
|
x: number;
|
|
35
35
|
y: number;
|
|
36
36
|
/** What was right-clicked, by name — the menu's accessible name. */
|
|
@@ -39,29 +39,29 @@ export interface GroupsSidebarMenuProps {
|
|
|
39
39
|
/** Opens "Add a skill or tool to {label}". Absent for a lens or empty space. */
|
|
40
40
|
onAdd?(): void;
|
|
41
41
|
/** The one verb every target has: the nav's own create affordance. */
|
|
42
|
-
|
|
42
|
+
onCreatePlugin(): void;
|
|
43
43
|
/** Copies a link to the row's page. Absent on the nav's empty space. */
|
|
44
44
|
onCopyLink?(): void;
|
|
45
45
|
/** Absent when there is no folder behind the row to manage. */
|
|
46
46
|
onManageAccess?(): void;
|
|
47
|
-
/** Opens the delete confirmation. Present ONLY for a
|
|
47
|
+
/** Opens the delete confirmation. Present ONLY for a plugin the caller owns. */
|
|
48
48
|
onDelete?(): void;
|
|
49
49
|
/** The row this menu was opened from — Escape hands focus back to it. */
|
|
50
50
|
returnFocusTo?: RefObject<HTMLElement | null>;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
export function
|
|
53
|
+
export function PluginsSidebarMenu({
|
|
54
54
|
x,
|
|
55
55
|
y,
|
|
56
56
|
label,
|
|
57
57
|
onClose,
|
|
58
58
|
onAdd,
|
|
59
|
-
|
|
59
|
+
onCreatePlugin,
|
|
60
60
|
onCopyLink,
|
|
61
61
|
onManageAccess,
|
|
62
62
|
onDelete,
|
|
63
63
|
returnFocusTo,
|
|
64
|
-
}:
|
|
64
|
+
}: PluginsSidebarMenuProps) {
|
|
65
65
|
const ref = useDismissableMenu<HTMLDivElement>({ open: true, onClose, returnFocusTo });
|
|
66
66
|
|
|
67
67
|
return (
|
|
@@ -92,13 +92,13 @@ export function GroupsSidebarMenu({
|
|
|
92
92
|
<MenuItem
|
|
93
93
|
role="menuitem"
|
|
94
94
|
onClick={() => {
|
|
95
|
-
|
|
95
|
+
onCreatePlugin();
|
|
96
96
|
onClose();
|
|
97
97
|
}}
|
|
98
98
|
>
|
|
99
99
|
<span className="flex items-center gap-2">
|
|
100
100
|
<FolderPlus size={14} />
|
|
101
|
-
New
|
|
101
|
+
New plugin
|
|
102
102
|
</span>
|
|
103
103
|
</MenuItem>
|
|
104
104
|
{onCopyLink && (
|
|
@@ -149,7 +149,7 @@ export function GroupsSidebarMenu({
|
|
|
149
149
|
>
|
|
150
150
|
<span className="flex items-center gap-2">
|
|
151
151
|
<Trash2 size={14} />
|
|
152
|
-
Delete
|
|
152
|
+
Delete plugin
|
|
153
153
|
</span>
|
|
154
154
|
</MenuItem>
|
|
155
155
|
</>
|