@bevel-software/platform-core-frontend 0.7.5 → 0.9.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/core/registry.ts +16 -4
- 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/admin/state/admin.context.tsx +15 -0
- 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} +197 -106
- package/src/modules/library/__tests__/PluginsIndexPage.test.tsx +363 -0
- package/src/modules/library/__tests__/{GroupsSidebar.contextmenu.test.tsx → PluginsSidebar.contextmenu.test.tsx} +32 -31
- package/src/modules/library/__tests__/{GroupsSidebar.locked.test.tsx → PluginsSidebar.locked.test.tsx} +29 -28
- package/src/modules/library/__tests__/PluginsSidebar.test.tsx +171 -0
- 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__/library-data.test.ts +82 -0
- 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 +80 -71
- 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 +23 -5
- package/src/modules/library/components/PageActions.tsx +34 -11
- package/src/modules/library/components/PersonalAddDialog.tsx +5 -5
- package/src/modules/library/components/{PersonalGroupPage.tsx → PersonalPluginPage.tsx} +29 -19
- 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/PluginJoinRequests.tsx +77 -0
- package/src/modules/library/components/{GroupPage.tsx → PluginPage.tsx} +112 -72
- package/src/modules/library/components/{GroupsIndexPage.tsx → PluginsIndexPage.tsx} +91 -48
- package/src/modules/library/components/{GroupsSidebar.tsx → PluginsSidebar.tsx} +105 -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} +218 -27
- 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 +32 -19
- 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 +67 -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__/creator-welcome.test.tsx +318 -0
- package/src/modules/onboarding/__tests__/onboarding.test.tsx +86 -8
- package/src/modules/onboarding/agent-clients.ts +18 -14
- package/src/modules/onboarding/components/CreatorWelcomePage.tsx +143 -0
- package/src/modules/onboarding/components/WelcomePage.tsx +30 -22
- package/src/modules/onboarding/components/WelcomeRoute.tsx +57 -0
- package/src/modules/onboarding/welcome-state.ts +36 -0
- 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/setup/__tests__/setup.test.tsx +203 -0
- package/src/modules/setup/components/SetupScreen.tsx +235 -68
- 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/FileRoute.tsx +8 -1
- package/src/modules/workspace/components/FileViewer.tsx +95 -38
- package/src/modules/workspace/components/__tests__/FileExplorer.test.tsx +14 -14
- package/src/modules/workspace/components/__tests__/FileRoute.test.tsx +20 -0
- package/src/modules/workspace/components/__tests__/FileViewer.test.tsx +227 -18
- package/src/modules/workspace/components/renderers/ToolRenderer.tsx +7 -2
- package/src/modules/workspace/routing/__tests__/kb-routes.test.tsx +25 -0
- package/src/modules/workspace/routing/kb-routes.ts +23 -1
- package/src/modules/workspace/utils/__tests__/diff.test.ts +1 -1
- package/src/modules/workspace/utils/fileTree.ts +54 -3
- package/src/shared/components/Surface.tsx +15 -0
- 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
- package/src/modules/library/__tests__/GroupsIndexPage.test.tsx +0 -283
- package/src/modules/library/__tests__/GroupsSidebar.test.tsx +0 -142
- package/src/modules/library/components/GroupJoinRequests.tsx +0 -56
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { MouseEvent, ReactNode } from 'react';
|
|
2
2
|
import { cn } from '../../../lib/utils';
|
|
3
3
|
import type { LibraryFilter } from '../utils/status';
|
|
4
|
+
import { ChalkArrow } from './plugin-page-parts';
|
|
4
5
|
import { LockGlyph } from './LockGlyph';
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -21,47 +22,66 @@ export interface SidebarContextTarget {
|
|
|
21
22
|
row: HTMLElement | null;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
export interface
|
|
25
|
+
export interface PluginsSidebarProps {
|
|
25
26
|
/** What the URL has selected, or null on a page with no gallery filter. */
|
|
26
27
|
filter: LibraryFilter | null;
|
|
27
28
|
/** A row was clicked — the layout navigates; the sidebar owns no state. */
|
|
28
29
|
onSelect(filter: LibraryFilter): void;
|
|
29
|
-
/** Readable
|
|
30
|
-
|
|
30
|
+
/** Readable plugins, with their item count and how many integrations need setup. */
|
|
31
|
+
plugins: { plugin: string; count: number; attention: number }[];
|
|
31
32
|
/**
|
|
32
|
-
*
|
|
33
|
+
* Plugins the caller cannot read, alphabetical. Rendered after a gap, with a
|
|
33
34
|
* lock instead of a count.
|
|
34
35
|
*/
|
|
35
|
-
|
|
36
|
+
lockedPlugins: string[];
|
|
36
37
|
ownedCount: number;
|
|
37
38
|
/**
|
|
38
39
|
* How many of the caller's OWN items are waiting on them. Drives the amber
|
|
39
40
|
* badge; when zero the row shows `ownedCount` in grey instead.
|
|
40
41
|
*/
|
|
41
42
|
ownedAttention: number;
|
|
42
|
-
/** The caller's own space, e.g. `Juan's
|
|
43
|
-
|
|
43
|
+
/** The caller's own space, e.g. `Juan's Plugin` — see `personalPluginName`. */
|
|
44
|
+
personalPluginLabel: string;
|
|
44
45
|
ungroupedCount: number;
|
|
45
46
|
/** Integrations across the catalog that need setup — the amber count. */
|
|
46
47
|
attentionCount: number;
|
|
47
48
|
/** Send the user to the Connect page to finish those. */
|
|
48
49
|
onFinishSetup(): void;
|
|
49
|
-
/** Start a new
|
|
50
|
-
|
|
50
|
+
/** Start a new plugin. The layout owns the dialog; this is only the intent. */
|
|
51
|
+
onCreatePlugin(): void;
|
|
51
52
|
/**
|
|
52
|
-
*
|
|
53
|
+
* Whether to spell the first plugin out in words, with the chalk arrow. The
|
|
54
|
+
* hover-revealed `+` is unchanged for everyone; this is only the teaching
|
|
55
|
+
* mark, and it is an administrator's — see the empty-state block below.
|
|
56
|
+
*
|
|
57
|
+
* The caller passes a SETTLED verdict, not just a role: the layout derives
|
|
58
|
+
* it from `workspaceHasNoPlugins`, which stays false while plugin discovery
|
|
59
|
+
* is loading or has failed. Without that, an admin whose plugins were still
|
|
60
|
+
* arriving would briefly read "Create a plugin" over a workspace that has
|
|
61
|
+
* twenty. The empty-`plugins` check below is therefore structural (where the
|
|
62
|
+
* row may appear), while WHETHER it may appear is the caller's call.
|
|
63
|
+
*
|
|
64
|
+
* Optional, defaulting to OFF, for the same reason `isAdminLoading` is
|
|
65
|
+
* optional on the admin context: this props type is public, and a host
|
|
66
|
+
* application rendering the nav must stay source-compatible across the
|
|
67
|
+
* upgrade. Omitting it reproduces the nav exactly as it shipped, which had
|
|
68
|
+
* no written-out CTA at all.
|
|
69
|
+
*/
|
|
70
|
+
canCreatePlugin?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* The all-plugins index is showing. Beside `filter` rather than inside it: the
|
|
53
73
|
* index lists PLACES, not a filtered slice of the catalog, so it is not a
|
|
54
74
|
* `LibraryFilter` and pretending otherwise would put a row in the gallery's
|
|
55
75
|
* vocabulary that no gallery can render.
|
|
56
76
|
*/
|
|
57
|
-
|
|
77
|
+
pluginsIndexActive: boolean;
|
|
58
78
|
/** Go to the index — the Library's home. */
|
|
59
|
-
|
|
79
|
+
onOpenPluginsIndex(): void;
|
|
60
80
|
/**
|
|
61
81
|
* A row — or the nav's empty space — was right-clicked. Like every other
|
|
62
82
|
* handler here this is an INTENT, not a menu: the layout owns the popup,
|
|
63
|
-
* because the verbs in it (add to this
|
|
64
|
-
*
|
|
83
|
+
* because the verbs in it (add to this plugin, manage its access) need the
|
|
84
|
+
* plugin summaries and the workspace, and the sidebar knows neither.
|
|
65
85
|
*
|
|
66
86
|
* Omitted, the nav does nothing on right-click and the browser's own menu
|
|
67
87
|
* appears — which is the honest default for a view with no actions wired.
|
|
@@ -73,9 +93,9 @@ export interface GroupsSidebarProps {
|
|
|
73
93
|
* The library's nav spine — the prototype's `.side` + `.nav` (lines 55-95).
|
|
74
94
|
*
|
|
75
95
|
* Replaces the loadout rail, which came from a retired mock and has no
|
|
76
|
-
* equivalent in the prototype.
|
|
96
|
+
* equivalent in the prototype. Plugins ARE the structure here: the sidebar is
|
|
77
97
|
* how you move between them, which is why the page no longer carries
|
|
78
|
-
* Skills/Integrations filter chips. A
|
|
98
|
+
* Skills/Integrations filter chips. A plugin is a folder, so this list is
|
|
79
99
|
* derived from the catalog's paths rather than from a registry.
|
|
80
100
|
*
|
|
81
101
|
* It is a pure view of the URL: `filter` comes down, clicks go up as intents,
|
|
@@ -87,22 +107,23 @@ export interface GroupsSidebarProps {
|
|
|
87
107
|
* Knowledge's file tree renders inside too. That is the whole reason the two
|
|
88
108
|
* navs cannot drift: there is one of them, holding a different list.
|
|
89
109
|
*/
|
|
90
|
-
export function
|
|
110
|
+
export function PluginsSidebar({
|
|
91
111
|
filter,
|
|
92
112
|
onSelect,
|
|
93
|
-
|
|
94
|
-
|
|
113
|
+
plugins,
|
|
114
|
+
lockedPlugins,
|
|
95
115
|
ownedCount,
|
|
96
116
|
ownedAttention,
|
|
97
|
-
|
|
117
|
+
personalPluginLabel,
|
|
98
118
|
ungroupedCount,
|
|
99
119
|
attentionCount,
|
|
100
120
|
onFinishSetup,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
121
|
+
onCreatePlugin,
|
|
122
|
+
canCreatePlugin = false,
|
|
123
|
+
pluginsIndexActive,
|
|
124
|
+
onOpenPluginsIndex,
|
|
104
125
|
onContextMenu,
|
|
105
|
-
}:
|
|
126
|
+
}: PluginsSidebarProps) {
|
|
106
127
|
const rowClass = (selected: boolean) =>
|
|
107
128
|
cn(
|
|
108
129
|
'flex items-center justify-between gap-2 rounded-sm px-2.5 py-1.5 text-ui transition-colors',
|
|
@@ -116,7 +137,7 @@ export function GroupsSidebar({
|
|
|
116
137
|
*/
|
|
117
138
|
const isCurrent = (target: LibraryFilter) =>
|
|
118
139
|
target.kind === 'group'
|
|
119
|
-
? filter?.kind === 'group' && filter.
|
|
140
|
+
? filter?.kind === 'group' && filter.plugin === target.plugin
|
|
120
141
|
: filter?.kind === target.kind;
|
|
121
142
|
|
|
122
143
|
/**
|
|
@@ -167,7 +188,7 @@ export function GroupsSidebar({
|
|
|
167
188
|
);
|
|
168
189
|
|
|
169
190
|
/**
|
|
170
|
-
* A
|
|
191
|
+
* A plugin the caller cannot read. Same chrome as every other row, because it
|
|
171
192
|
* is the same kind of thing — a place in the workspace — and demoting it
|
|
172
193
|
* visually would undo the reason it is listed at all.
|
|
173
194
|
*
|
|
@@ -178,7 +199,7 @@ export function GroupsSidebar({
|
|
|
178
199
|
* words, so the glyph itself can stay decorative.
|
|
179
200
|
*/
|
|
180
201
|
const lockedRow = (name: string) => {
|
|
181
|
-
const target: LibraryFilter = { kind: 'group',
|
|
202
|
+
const target: LibraryFilter = { kind: 'group', plugin: name };
|
|
182
203
|
return (
|
|
183
204
|
<button
|
|
184
205
|
key={`locked:${name}`}
|
|
@@ -188,7 +209,7 @@ export function GroupsSidebar({
|
|
|
188
209
|
className={rowClass(isCurrent(target))}
|
|
189
210
|
onClick={() => onSelect(target)}
|
|
190
211
|
// A locked row gets the SAME menu as a readable one, for the same
|
|
191
|
-
// reason it gets the same click: a
|
|
212
|
+
// reason it gets the same click: a plugin you are not in is still a
|
|
192
213
|
// place, and `Manage access` is exactly the item an admin locked out of
|
|
193
214
|
// one needs. Which verbs are actually true is the layout's call.
|
|
194
215
|
onContextMenu={(e) => openMenu(e, target, name, e.currentTarget)}
|
|
@@ -204,7 +225,7 @@ export function GroupsSidebar({
|
|
|
204
225
|
return (
|
|
205
226
|
<>
|
|
206
227
|
<nav
|
|
207
|
-
aria-label="Library
|
|
228
|
+
aria-label="Library plugins"
|
|
208
229
|
className="flex min-h-0 flex-1 flex-col gap-px overflow-y-auto"
|
|
209
230
|
// The nav's empty space is a target too — Knowledge's tree gives its
|
|
210
231
|
// ROOT row a menu holding the create verbs, and this is where the
|
|
@@ -214,29 +235,29 @@ export function GroupsSidebar({
|
|
|
214
235
|
>
|
|
215
236
|
{/* The home row, above every section and belonging to none of them:
|
|
216
237
|
it is where the Library opens, and the one place that lists the
|
|
217
|
-
|
|
238
|
+
plugins you are NOT in beside the ones you are. Unlabelled and
|
|
218
239
|
first for the same reason — a destination the whole surface
|
|
219
240
|
hangs off does not sit inside a category of lenses.
|
|
220
241
|
|
|
221
242
|
Written out rather than built by `row`, because it is the one
|
|
222
243
|
row with no `LibraryFilter` behind it: the index is a list of
|
|
223
244
|
PLACES, not a slice of the catalog. Its menu is therefore the
|
|
224
|
-
nav's own (`filter: null`) — create a
|
|
245
|
+
nav's own (`filter: null`) — create a plugin, and none of the
|
|
225
246
|
verbs that need a folder to point at. */}
|
|
226
247
|
<button
|
|
227
248
|
type="button"
|
|
228
|
-
aria-current={
|
|
229
|
-
className={rowClass(
|
|
230
|
-
onClick={
|
|
231
|
-
onContextMenu={(e) => openMenu(e, null, 'All
|
|
249
|
+
aria-current={pluginsIndexActive}
|
|
250
|
+
className={rowClass(pluginsIndexActive)}
|
|
251
|
+
onClick={onOpenPluginsIndex}
|
|
252
|
+
onContextMenu={(e) => openMenu(e, null, 'All plugins', e.currentTarget)}
|
|
232
253
|
>
|
|
233
|
-
<span className="truncate">All
|
|
254
|
+
<span className="truncate">All plugins</span>
|
|
234
255
|
</button>
|
|
235
256
|
|
|
236
257
|
{/* Lenses — the whole catalog, sliced — which is exactly what the
|
|
237
|
-
|
|
258
|
+
plugin rows below are not. Naming the section is what keeps that
|
|
238
259
|
distinction visible. `Everything` is a row again now that the
|
|
239
|
-
Library lands on the
|
|
260
|
+
Library lands on the plugins index instead: without one it would
|
|
240
261
|
be a page with no way in. */}
|
|
241
262
|
<SectionLabel spaced>Library</SectionLabel>
|
|
242
263
|
{row('Everything', { kind: 'all' }, 0)}
|
|
@@ -251,26 +272,55 @@ export function GroupsSidebar({
|
|
|
251
272
|
ownedAttention > 0 ? ownedAttention : ownedCount,
|
|
252
273
|
ownedAttention > 0 ? 'pending' : 'count',
|
|
253
274
|
)}
|
|
254
|
-
<
|
|
275
|
+
<PluginsLabel onCreate={onCreatePlugin} />
|
|
255
276
|
|
|
256
|
-
{/* Your own space leads the
|
|
277
|
+
{/* Your own space leads the plugins, as in the prototype (line 2487):
|
|
257
278
|
it is the one you are always in. */}
|
|
258
|
-
{row(
|
|
259
|
-
{
|
|
260
|
-
// Amber wins the count slot: a
|
|
279
|
+
{row(personalPluginLabel, { kind: 'ungrouped' }, ungroupedCount)}
|
|
280
|
+
{plugins.map(({ plugin, count, attention }) =>
|
|
281
|
+
// Amber wins the count slot: a plugin that needs setup is telling you
|
|
261
282
|
// something, and how many items it holds is not the news.
|
|
262
283
|
row(
|
|
263
|
-
|
|
264
|
-
{ kind: 'group',
|
|
284
|
+
plugin,
|
|
285
|
+
{ kind: 'group', plugin },
|
|
265
286
|
attention > 0 ? attention : count,
|
|
266
287
|
attention > 0 ? 'pending' : 'count',
|
|
267
288
|
),
|
|
268
289
|
)}
|
|
269
|
-
{/*
|
|
290
|
+
{/* The heading's `+` is hover-revealed, and a person with no plugins
|
|
291
|
+
yet is exactly the person who has not learned to hover it. While
|
|
292
|
+
the workspace holds no plugins AT ALL, the way to the first one is
|
|
293
|
+
said in words, as a row where it would sit — with a chalk arrow
|
|
294
|
+
from the empty space below, the same margin-note voice as the
|
|
295
|
+
empty plugin page. It stands down the moment any plugin exists,
|
|
296
|
+
readable or locked: a locked plugin means someone already created
|
|
297
|
+
one, and this is a doorway for an untouched workspace, not a
|
|
298
|
+
permanent duplicate of the `+`.
|
|
299
|
+
|
|
300
|
+
Administrators only. On an untouched workspace the first plugin is
|
|
301
|
+
theirs to make, and telling everyone else to make it points them
|
|
302
|
+
at a decision that is not theirs. The `+` above is untouched for
|
|
303
|
+
every caller — this is the teaching mark, not the affordance. */}
|
|
304
|
+
{canCreatePlugin && plugins.length === 0 && lockedPlugins.length === 0 && (
|
|
305
|
+
<div className="relative">
|
|
306
|
+
<button
|
|
307
|
+
type="button"
|
|
308
|
+
onClick={onCreatePlugin}
|
|
309
|
+
className="flex items-center gap-2 rounded-sm px-2.5 py-1.5 text-left text-ui text-ink-faint transition-colors hover:bg-hover hover:text-ink"
|
|
310
|
+
>
|
|
311
|
+
<span aria-hidden="true">+</span>
|
|
312
|
+
<span className="truncate">Create a plugin</span>
|
|
313
|
+
</button>
|
|
314
|
+
{/* Mirrored, so the tip points up-left at the row's words from
|
|
315
|
+
the room an empty nav is guaranteed to have beneath it. */}
|
|
316
|
+
<ChalkArrow className="pointer-events-none absolute left-[22px] top-[30px] h-[52px] w-[64px] -scale-x-100 text-ink-faint" />
|
|
317
|
+
</div>
|
|
318
|
+
)}
|
|
319
|
+
{/* Locked plugins, after the prototype's 14px `.navgap`. The gap is the
|
|
270
320
|
whole statement: these are in the same list because they are in the
|
|
271
321
|
same workspace, and below a break because you are not in them. */}
|
|
272
|
-
{
|
|
273
|
-
{
|
|
322
|
+
{lockedPlugins.length > 0 && <div className="h-3.5" aria-hidden="true" />}
|
|
323
|
+
{lockedPlugins.map(lockedRow)}
|
|
274
324
|
</nav>
|
|
275
325
|
|
|
276
326
|
{attentionCount > 0 && (
|
|
@@ -287,19 +337,19 @@ export function GroupsSidebar({
|
|
|
287
337
|
}
|
|
288
338
|
|
|
289
339
|
/**
|
|
290
|
-
* The `INCLUDED IN YOUR MCP` heading, and the one way to make a new
|
|
340
|
+
* The `INCLUDED IN YOUR MCP` heading, and the one way to make a new plugin —
|
|
291
341
|
* the prototype's `.lbladd` (line 78).
|
|
292
342
|
*
|
|
293
343
|
* The heading says what this list IS rather than what its rows are called:
|
|
294
344
|
* these folders are the set mounted into the caller's MCP — the agent's
|
|
295
|
-
* working context — not merely a directory of
|
|
345
|
+
* working context — not merely a directory of plugins. (The locked rows that
|
|
296
346
|
* trail the list sit below a gap for exactly that reason: they are in the
|
|
297
347
|
* workspace but not in your MCP, and the break is what keeps the heading
|
|
298
348
|
* honest about them.)
|
|
299
349
|
*
|
|
300
|
-
* `All
|
|
350
|
+
* `All plugins` is NOT a row here. It heads the whole nav instead: it is the
|
|
301
351
|
* 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
|
|
352
|
+
* and inside this list it used to collect the clicks meant for the plugins
|
|
303
353
|
* under it.
|
|
304
354
|
*
|
|
305
355
|
* The `+` is always in the DOM and always reachable by keyboard; only its
|
|
@@ -320,15 +370,15 @@ function SectionLabel({ children, spaced = false }: { children: ReactNode; space
|
|
|
320
370
|
);
|
|
321
371
|
}
|
|
322
372
|
|
|
323
|
-
function
|
|
373
|
+
function PluginsLabel({ onCreate }: { onCreate(): void }) {
|
|
324
374
|
return (
|
|
325
375
|
<div className="group/label flex items-center gap-1 px-2.5 pb-1.5 pt-5">
|
|
326
376
|
<span className="text-label uppercase text-ink-faint">Included in your MCP</span>
|
|
327
377
|
<button
|
|
328
378
|
type="button"
|
|
329
379
|
onClick={onCreate}
|
|
330
|
-
title="New
|
|
331
|
-
aria-label="New
|
|
380
|
+
title="New plugin"
|
|
381
|
+
aria-label="New plugin"
|
|
332
382
|
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
383
|
>
|
|
334
384
|
+
|
|
@@ -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
|
</>
|