@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
|
@@ -4,43 +4,45 @@ import { Banner, Button } from '../../../shared/components';
|
|
|
4
4
|
import { attentionOf, useLibrary, type LibraryItem } from '../state/library-data';
|
|
5
5
|
import { useLibraryToast } from '../state/toast.context';
|
|
6
6
|
import {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
decodePluginSegment,
|
|
8
|
+
pathForPluginsIndex,
|
|
9
9
|
urlForItemFile,
|
|
10
10
|
} from '../routes/library-paths';
|
|
11
|
-
import { primaryFolderOf } from '../utils/
|
|
12
|
-
import {
|
|
11
|
+
import { primaryFolderOf } from '../utils/plugin-summary';
|
|
12
|
+
import { PluginJoinRequests } from './PluginJoinRequests';
|
|
13
13
|
import { useWorkspace } from '../../workspace/state/workspace.context';
|
|
14
|
+
import { ManifestButton, ClientExtensionsSection } from './PluginExtras';
|
|
14
15
|
import { ManageAccessDialog } from '../../access/components/ManageAccessDialog';
|
|
15
|
-
import {
|
|
16
|
-
import { BandControls,
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
import { AddToPluginDialog } from './AddToPluginDialog';
|
|
17
|
+
import { BandControls, EmptySkillsNudge, PluginBreadcrumb, PluginItemSections, PageNote,
|
|
18
|
+
RemoveLibraryItemDialog,
|
|
19
|
+
} from './plugin-page-parts';
|
|
20
|
+
import { DeletePluginDialog } from './DeletePluginDialog';
|
|
19
21
|
import { PageActions } from './PageActions';
|
|
20
22
|
import { copyToClipboard } from '../utils/clipboard';
|
|
21
|
-
import {
|
|
23
|
+
import { LockedPluginView } from './LockedPluginView';
|
|
22
24
|
import { PendingSkillReview } from './PendingSkillReview';
|
|
23
25
|
|
|
24
26
|
/**
|
|
25
|
-
* One
|
|
27
|
+
* One plugin, as a place: `/skills-and-tools/plugins/:plugin`.
|
|
26
28
|
*
|
|
27
|
-
* A
|
|
29
|
+
* A plugin is a KB folder, so this page is the folder made legible — its skills
|
|
28
30
|
* and the tools those skills need, side by side, with who runs it and who it is
|
|
29
31
|
* shared with in one line above them. The sidebar and the gallery could already
|
|
30
|
-
* FILTER to a
|
|
32
|
+
* FILTER to a plugin; what they could not do is be linked to, bookmarked, or
|
|
31
33
|
* handed to somebody. That is the whole difference this page makes.
|
|
32
34
|
*
|
|
33
35
|
* WHICH VIEW: the page decides member-vs-locked, not the router and not the
|
|
34
36
|
* sidebar. The member view renders when the folder verdict says `canRead`, OR
|
|
35
|
-
* when the caller's catalog already contains an item in the
|
|
37
|
+
* when the caller's catalog already contains an item in the plugin (a per-file
|
|
36
38
|
* grant can hand somebody one skill inside a folder they cannot read). Locked
|
|
37
39
|
* means: the summary says no AND the catalog agrees — which can only happen
|
|
38
|
-
* for a DISCOVERABLE
|
|
40
|
+
* for a DISCOVERABLE plugin, because an undiscoverable one never reaches this
|
|
39
41
|
* page's data at all and renders like one that does not exist.
|
|
40
42
|
*/
|
|
41
|
-
export function
|
|
43
|
+
export function PluginPage() {
|
|
42
44
|
const params = useParams();
|
|
43
|
-
const
|
|
45
|
+
const plugin = decodePluginSegment(params.plugin ?? '');
|
|
44
46
|
const data = useLibrary();
|
|
45
47
|
const toast = useLibraryToast();
|
|
46
48
|
const navigate = useNavigate();
|
|
@@ -59,6 +61,13 @@ export function GroupPage() {
|
|
|
59
61
|
const [accessRevision, setAccessRevision] = useState(0);
|
|
60
62
|
/** The proposed skill being reviewed, if the reader opened one. */
|
|
61
63
|
const [reviewing, setReviewing] = useState<LibraryItem | null>(null);
|
|
64
|
+
/**
|
|
65
|
+
* Whether the join-requests banner is actually on screen. The empty band's
|
|
66
|
+
* chalk arrow points a fixed distance up at the title row's `+`, so any
|
|
67
|
+
* banner between them turns the arrow into a lie — this is how the page
|
|
68
|
+
* knows to stand the arrow down (the sentence and its action stay).
|
|
69
|
+
*/
|
|
70
|
+
const [joinRequestsShown, setJoinRequestsShown] = useState(false);
|
|
62
71
|
|
|
63
72
|
/**
|
|
64
73
|
* "Last updated just now" has to be TRUE.
|
|
@@ -75,13 +84,13 @@ export function GroupPage() {
|
|
|
75
84
|
* loads are settled" is also true of the instant BEFORE the refetch starts,
|
|
76
85
|
* and of an unrelated load that was already in flight settling first. So the
|
|
77
86
|
* spin only ends on a settle that FOLLOWS a loading phase this click caused.
|
|
78
|
-
* `
|
|
87
|
+
* `reloadPlugins()` raises `pluginsLoading` synchronously, so that phase is
|
|
79
88
|
* guaranteed to be observed — and if it somehow were not, the button keeps
|
|
80
89
|
* spinning, which is the failure worth having.
|
|
81
90
|
*/
|
|
82
91
|
const sawLoading = useRef(false);
|
|
83
92
|
const spinning = refreshState === 'spin';
|
|
84
|
-
const loadsSettled = !data.loading && !data.
|
|
93
|
+
const loadsSettled = !data.loading && !data.pluginsLoading;
|
|
85
94
|
useEffect(() => {
|
|
86
95
|
if (!spinning) return;
|
|
87
96
|
if (!loadsSettled) {
|
|
@@ -90,8 +99,8 @@ export function GroupPage() {
|
|
|
90
99
|
}
|
|
91
100
|
if (!sawLoading.current) return;
|
|
92
101
|
sawLoading.current = false;
|
|
93
|
-
setRefreshState(data.error || data.
|
|
94
|
-
}, [spinning, loadsSettled, data.error, data.
|
|
102
|
+
setRefreshState(data.error || data.pluginsError ? 'idle' : 'done');
|
|
103
|
+
}, [spinning, loadsSettled, data.error, data.pluginsError]);
|
|
95
104
|
|
|
96
105
|
// The freshness line decays on its own — that one IS a clock, and it is the
|
|
97
106
|
// only timer left. Cleared on unmount rather than left to fire into a
|
|
@@ -104,16 +113,16 @@ export function GroupPage() {
|
|
|
104
113
|
|
|
105
114
|
/** The card being removed, while its confirm dialog is up. */
|
|
106
115
|
const [removing, setRemoving] = useState<LibraryItem | null>(null);
|
|
107
|
-
/** Whether the
|
|
116
|
+
/** Whether the plugin's own delete confirmation is up. */
|
|
108
117
|
const [deleteOpen, setDeleteOpen] = useState(false);
|
|
109
118
|
|
|
110
119
|
const summary = useMemo(
|
|
111
|
-
() => data.
|
|
112
|
-
[data.
|
|
120
|
+
() => data.pluginSummaries.find((g) => g.name === plugin) ?? null,
|
|
121
|
+
[data.pluginSummaries, plugin],
|
|
113
122
|
);
|
|
114
|
-
const
|
|
115
|
-
() => data.items.filter((i) => i.
|
|
116
|
-
[data.items,
|
|
123
|
+
const pluginItems = useMemo(
|
|
124
|
+
() => data.items.filter((i) => i.plugin === plugin),
|
|
125
|
+
[data.items, plugin],
|
|
117
126
|
);
|
|
118
127
|
/** For the add dialog's name check — global, because a skill's id is global. */
|
|
119
128
|
const allSkillNames = useMemo(
|
|
@@ -121,9 +130,9 @@ export function GroupPage() {
|
|
|
121
130
|
[data.items],
|
|
122
131
|
);
|
|
123
132
|
|
|
124
|
-
const skillItems =
|
|
125
|
-
const toolItems =
|
|
126
|
-
const attention = attentionOf(data.items,
|
|
133
|
+
const skillItems = pluginItems.filter((i) => i.kind === 'skill');
|
|
134
|
+
const toolItems = pluginItems.filter((i) => i.kind === 'integration');
|
|
135
|
+
const attention = attentionOf(data.items, plugin);
|
|
127
136
|
// What the Skills band actually renders. The filter is a VIEW over the band,
|
|
128
137
|
// not a different query — flipping it back must show exactly what was there.
|
|
129
138
|
const shownSkills = filterOn ? skillItems.filter((i) => i.status.state !== 'ok') : skillItems;
|
|
@@ -166,29 +175,29 @@ export function GroupPage() {
|
|
|
166
175
|
setManageFolder(null);
|
|
167
176
|
// Granting through the dialog can settle a pending join request —
|
|
168
177
|
// refresh the roster, the catalog and the request surface together.
|
|
169
|
-
data.
|
|
178
|
+
data.reloadPlugins();
|
|
170
179
|
data.reload();
|
|
171
180
|
setAccessRevision((r) => r + 1);
|
|
172
181
|
}}
|
|
173
182
|
/>
|
|
174
183
|
) : null;
|
|
175
184
|
|
|
176
|
-
// Nothing has spoken yet: the catalog is still loading, the
|
|
177
|
-
// still loading, and no item has proven the
|
|
185
|
+
// Nothing has spoken yet: the catalog is still loading, the plugin index is
|
|
186
|
+
// still loading, and no item has proven the plugin exists. Deciding now would
|
|
178
187
|
// flash "doesn't exist" (or a locked splash) at somebody who is simply early.
|
|
179
|
-
if (
|
|
188
|
+
if (pluginItems.length === 0 && (data.loading || data.pluginsLoading)) {
|
|
180
189
|
return <PageNote>Loading the library…</PageNote>;
|
|
181
190
|
}
|
|
182
191
|
|
|
183
|
-
if (summary && !summary.canRead &&
|
|
192
|
+
if (summary && !summary.canRead && pluginItems.length === 0) {
|
|
184
193
|
return (
|
|
185
194
|
<>
|
|
186
|
-
<
|
|
187
|
-
|
|
188
|
-
onRequested={data.
|
|
195
|
+
<LockedPluginView
|
|
196
|
+
plugin={summary}
|
|
197
|
+
onRequested={data.reloadPlugins}
|
|
189
198
|
onUnlocked={() => {
|
|
190
199
|
data.reload();
|
|
191
|
-
data.
|
|
200
|
+
data.reloadPlugins();
|
|
192
201
|
}}
|
|
193
202
|
onManage={setManageFolder}
|
|
194
203
|
/>
|
|
@@ -197,18 +206,18 @@ export function GroupPage() {
|
|
|
197
206
|
);
|
|
198
207
|
}
|
|
199
208
|
|
|
200
|
-
// No summary, no items, and the endpoint did NOT fail — the
|
|
209
|
+
// No summary, no items, and the endpoint did NOT fail — the plugin really is
|
|
201
210
|
// not there. With a failed endpoint the honest answer is the degraded member
|
|
202
211
|
// view below, because "we couldn't ask" is not "it doesn't exist".
|
|
203
|
-
if (!summary &&
|
|
212
|
+
if (!summary && pluginItems.length === 0 && !data.pluginsError) {
|
|
204
213
|
return (
|
|
205
214
|
<div className="py-16 text-center">
|
|
206
|
-
<p className="text-ui text-ink-faint">{"This
|
|
215
|
+
<p className="text-ui text-ink-faint">{"This plugin doesn't exist yet."}</p>
|
|
207
216
|
<Link
|
|
208
|
-
to={
|
|
217
|
+
to={pathForPluginsIndex()}
|
|
209
218
|
className="mt-2 inline-block rounded-xs text-ui font-semibold text-ink underline"
|
|
210
219
|
>
|
|
211
|
-
All
|
|
220
|
+
All plugins
|
|
212
221
|
</Link>
|
|
213
222
|
</div>
|
|
214
223
|
);
|
|
@@ -218,7 +227,7 @@ export function GroupPage() {
|
|
|
218
227
|
|
|
219
228
|
return (
|
|
220
229
|
<div className="pb-14">
|
|
221
|
-
<
|
|
230
|
+
<PluginBreadcrumb name={plugin} />
|
|
222
231
|
|
|
223
232
|
{/* The title row carries the page's one persistent action. `Share` IS
|
|
224
233
|
the manage-access dialog — not a doorway to it. It stays un-gated:
|
|
@@ -229,30 +238,38 @@ export function GroupPage() {
|
|
|
229
238
|
Share stays un-gated: for a non-writer the dialog renders read-only,
|
|
230
239
|
which is exactly what "who is this shared with?" should answer. */}
|
|
231
240
|
<div className="flex items-start justify-between gap-4">
|
|
232
|
-
<h1 className="mt-1.5 text-display font-semibold">{
|
|
233
|
-
<div className="mt-1.5">
|
|
241
|
+
<h1 className="mt-1.5 text-display font-semibold">{plugin}</h1>
|
|
242
|
+
<div className="mt-1.5 flex items-center gap-1">
|
|
243
|
+
<ManifestButton kbDirName={kbDirName} folder={plugin} canWrite={summary?.canWrite === true} />
|
|
234
244
|
<PageActions
|
|
235
245
|
onShare={primaryFolder ? () => setManageFolder(primaryFolder) : undefined}
|
|
236
|
-
|
|
246
|
+
// The dialog needs both to mount (`addOpen && summary &&
|
|
247
|
+
// primaryFolder`), so without them `+` could only ever be a
|
|
248
|
+
// no-op — it is omitted instead, the same way `Share` is when
|
|
249
|
+
// there is no folder to manage. The empty band's doorway checks
|
|
250
|
+
// the identical prerequisite, so the two ways to add always agree
|
|
251
|
+
// about whether adding is possible at all.
|
|
252
|
+
onAdd={summary && primaryFolder ? () => setAddOpen(true) : undefined}
|
|
237
253
|
onCopyLink={() => copyToClipboard(window.location.href)}
|
|
238
254
|
// The OWNER's verb — `isOwner` is the same verdict the DELETE
|
|
239
255
|
// route enforces, so the item appears for exactly the people the
|
|
240
256
|
// backend will let through.
|
|
241
257
|
onDelete={summary?.isOwner ? () => setDeleteOpen(true) : undefined}
|
|
242
|
-
addLabel={`Add a skill or tool to ${
|
|
258
|
+
addLabel={`Add a skill or tool to ${plugin}`}
|
|
243
259
|
/>
|
|
244
260
|
</div>
|
|
245
261
|
</div>
|
|
246
262
|
|
|
247
263
|
{/* Somebody is waiting on the person reading this. Rendered only for a
|
|
248
|
-
|
|
264
|
+
plugin manager (canWrite) — every member can see the CRs elsewhere,
|
|
249
265
|
but only the people who can act on a request get its banner. */}
|
|
250
266
|
{summary?.canWrite && (
|
|
251
|
-
<
|
|
252
|
-
|
|
267
|
+
<PluginJoinRequests
|
|
268
|
+
plugin={plugin}
|
|
253
269
|
folders={summary.folders}
|
|
254
270
|
onManage={setManageFolder}
|
|
255
271
|
reloadSignal={accessRevision}
|
|
272
|
+
onVisible={setJoinRequestsShown}
|
|
256
273
|
className="mt-4"
|
|
257
274
|
/>
|
|
258
275
|
)}
|
|
@@ -264,7 +281,7 @@ export function GroupPage() {
|
|
|
264
281
|
attention === 1
|
|
265
282
|
? 'integration needs setup: connect it'
|
|
266
283
|
: 'integrations need setup: connect them'
|
|
267
|
-
} to unblock this
|
|
284
|
+
} to unblock this plugin's skills.`}
|
|
268
285
|
</span>{' '}
|
|
269
286
|
<Button variant="outline" size="tiny" onClick={() => navigate('/connect')}>
|
|
270
287
|
Finish setup
|
|
@@ -272,18 +289,40 @@ export function GroupPage() {
|
|
|
272
289
|
</Banner>
|
|
273
290
|
)}
|
|
274
291
|
|
|
275
|
-
<
|
|
292
|
+
<PluginItemSections
|
|
276
293
|
skillItems={shownSkills}
|
|
277
294
|
toolItems={toolItems}
|
|
278
295
|
onOpen={openItem}
|
|
279
|
-
// Removal is the
|
|
296
|
+
// Removal is the PLUGIN MANAGER's verb — the same canWrite that lets
|
|
280
297
|
// them answer join requests. The backend's per-path gate enforces it
|
|
281
298
|
// for real; this only decides who sees the affordance.
|
|
282
299
|
onRemove={summary?.canWrite ? setRemoving : undefined}
|
|
283
300
|
emptySkills={
|
|
284
|
-
filterOn
|
|
285
|
-
|
|
286
|
-
|
|
301
|
+
filterOn ? (
|
|
302
|
+
'Nothing in this band needs you right now.'
|
|
303
|
+
) : summary && primaryFolder ? (
|
|
304
|
+
// A truly empty plugin is the one moment the page has to teach
|
|
305
|
+
// where "add" lives — the button opens the same dialog the title
|
|
306
|
+
// row's `+` does, and the nudge's arrow points at that `+`. The
|
|
307
|
+
// arrow stands down when a banner sits between the band and the
|
|
308
|
+
// title row (join requests, integration attention): its aim is a
|
|
309
|
+
// fixed offset, and pointing into a banner teaches the wrong spot.
|
|
310
|
+
<EmptySkillsNudge
|
|
311
|
+
lead="No skills yet."
|
|
312
|
+
actionLabel="Add the first skill"
|
|
313
|
+
tail={`, or ask your agent to write one for ${plugin}.`}
|
|
314
|
+
agentOnly={`No skills yet. Ask your agent to write one for ${plugin}.`}
|
|
315
|
+
arrow={attention === 0 && !joinRequestsShown}
|
|
316
|
+
onAction={() => setAddOpen(true)}
|
|
317
|
+
/>
|
|
318
|
+
) : (
|
|
319
|
+
// Degraded: the plugins endpoint failed, so the summary — and with
|
|
320
|
+
// it the folder the add dialog writes into — is missing. The
|
|
321
|
+
// dialog gated on both (`addOpen && summary && primaryFolder`)
|
|
322
|
+
// could not mount, so a doorway here would be a button that does
|
|
323
|
+
// nothing. State the fact and the one door that still works.
|
|
324
|
+
`No skills yet. Ask your agent to write one for ${plugin}.`
|
|
325
|
+
)
|
|
287
326
|
}
|
|
288
327
|
// The band fades its controls until you hover it, and `opacity`
|
|
289
328
|
// composites — so "the filter stays lit when it is on" has to be said
|
|
@@ -300,7 +339,7 @@ export function GroupPage() {
|
|
|
300
339
|
sawLoading.current = false;
|
|
301
340
|
setRefreshState('spin');
|
|
302
341
|
data.reload();
|
|
303
|
-
data.
|
|
342
|
+
data.reloadPlugins();
|
|
304
343
|
}}
|
|
305
344
|
/>
|
|
306
345
|
}
|
|
@@ -313,19 +352,19 @@ export function GroupPage() {
|
|
|
313
352
|
onResolved={() => {
|
|
314
353
|
setReviewing(null);
|
|
315
354
|
// One reload moves it off the review shelf and into the catalog;
|
|
316
|
-
// the
|
|
355
|
+
// the plugin index follows because its skill count just changed.
|
|
317
356
|
data.reload();
|
|
318
|
-
data.
|
|
357
|
+
data.reloadPlugins();
|
|
319
358
|
}}
|
|
320
359
|
/>
|
|
321
360
|
)}
|
|
322
361
|
|
|
323
362
|
{addOpen && summary && primaryFolder && (
|
|
324
|
-
<
|
|
325
|
-
name={
|
|
363
|
+
<AddToPluginDialog
|
|
364
|
+
name={plugin}
|
|
326
365
|
primaryPath={primaryFolder}
|
|
327
366
|
canWrite={summary.canWrite}
|
|
328
|
-
// Every skill, not just this
|
|
367
|
+
// Every skill, not just this plugin's: a skill's id is its name and
|
|
329
368
|
// ids are global, so the collision that matters is with any of them.
|
|
330
369
|
existingSkills={allSkillNames}
|
|
331
370
|
onClose={() => setAddOpen(false)}
|
|
@@ -333,18 +372,18 @@ export function GroupPage() {
|
|
|
333
372
|
)}
|
|
334
373
|
|
|
335
374
|
{deleteOpen && summary && (
|
|
336
|
-
<
|
|
337
|
-
name={
|
|
375
|
+
<DeletePluginDialog
|
|
376
|
+
name={plugin}
|
|
338
377
|
skillCount={summary.skillCount}
|
|
339
378
|
toolCount={summary.toolCount}
|
|
340
379
|
onClose={() => setDeleteOpen(false)}
|
|
341
380
|
onDeleted={() => {
|
|
342
|
-
toast(`Deleted ${
|
|
381
|
+
toast(`Deleted ${plugin}.`);
|
|
343
382
|
// This page's place just ceased to exist — the index is the
|
|
344
383
|
// honest landing. Reloads follow so the sidebar agrees.
|
|
345
|
-
navigate(
|
|
384
|
+
navigate(pathForPluginsIndex());
|
|
346
385
|
data.reload();
|
|
347
|
-
data.
|
|
386
|
+
data.reloadPlugins();
|
|
348
387
|
}}
|
|
349
388
|
/>
|
|
350
389
|
)}
|
|
@@ -352,17 +391,18 @@ export function GroupPage() {
|
|
|
352
391
|
{removing && (
|
|
353
392
|
<RemoveLibraryItemDialog
|
|
354
393
|
item={removing}
|
|
355
|
-
place={
|
|
394
|
+
place={plugin}
|
|
356
395
|
onClose={() => setRemoving(null)}
|
|
357
396
|
onRemoved={() => {
|
|
358
|
-
toast(`Removed ${removing.name} from ${
|
|
359
|
-
// Catalog for the card,
|
|
397
|
+
toast(`Removed ${removing.name} from ${plugin}.`);
|
|
398
|
+
// Catalog for the card, plugin index for the counts.
|
|
360
399
|
data.reload();
|
|
361
|
-
data.
|
|
400
|
+
data.reloadPlugins();
|
|
362
401
|
}}
|
|
363
402
|
/>
|
|
364
403
|
)}
|
|
365
404
|
|
|
405
|
+
<ClientExtensionsSection kbDirName={kbDirName} folder={plugin} />
|
|
366
406
|
{manageDialog}
|
|
367
407
|
</div>
|
|
368
408
|
);
|
|
@@ -1,35 +1,38 @@
|
|
|
1
|
-
import { useMemo, type ReactNode } from 'react';
|
|
1
|
+
import { useMemo, useState, type ReactNode } from 'react';
|
|
2
2
|
import { useNavigate } from 'react-router-dom';
|
|
3
3
|
import { Badge, Banner } from '../../../shared/components';
|
|
4
4
|
import { useAuth } from '../../auth/state/auth.context';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
5
|
+
import { useAdmin } from '../../admin/state/admin.context';
|
|
6
|
+
import { attentionOf, useLibrary, workspaceHasNoPlugins, type LibraryItem } from '../state/library-data';
|
|
7
|
+
import { personalPluginName } from '../utils/personal-plugin';
|
|
8
|
+
import { LIBRARY_ROOT, pathForPlugin } from '../routes/library-paths';
|
|
9
|
+
import { ownersTextOf } from '../utils/plugin-summary';
|
|
10
|
+
import type { PluginSummary } from '../services/plugins.api';
|
|
11
|
+
import { EmptyStateAction } from './plugin-page-parts';
|
|
12
|
+
import { PluginIndexRow } from './PluginIndexRow';
|
|
11
13
|
import { LockGlyph } from './LockGlyph';
|
|
12
|
-
import {
|
|
14
|
+
import { ManagedPluginRequests } from './ManagedPluginRequests';
|
|
15
|
+
import { NewPluginDialog } from './NewPluginDialog';
|
|
13
16
|
|
|
14
17
|
/**
|
|
15
|
-
* The all-
|
|
18
|
+
* The all-plugins index — `/skills-and-tools`, where the Library opens.
|
|
16
19
|
*
|
|
17
|
-
* The sidebar can only show
|
|
18
|
-
* you may DISCOVER — the endpoint returns a
|
|
20
|
+
* The sidebar can only show plugins you are IN. This page also shows the ones
|
|
21
|
+
* you may DISCOVER — the endpoint returns a plugin exactly when the caller is
|
|
19
22
|
* a member, manages it, or can read its `access.md` (the discovery grant), so
|
|
20
|
-
* a
|
|
23
|
+
* a plugin with none of those is absent here too, not merely unlabelled.
|
|
21
24
|
*
|
|
22
|
-
* Two sources, one list. The `GET /api/
|
|
25
|
+
* Two sources, one list. The `GET /api/plugins` summaries are authoritative
|
|
23
26
|
* about existence and access; the caller's own catalog is authoritative about
|
|
24
|
-
* what they can actually see. A
|
|
27
|
+
* what they can actually see. A plugin in the catalog but missing from the
|
|
25
28
|
* summaries (endpoint degraded, or a folder the scan hasn't picked up) still
|
|
26
29
|
* gets a row, because the items are right there.
|
|
27
30
|
*/
|
|
28
31
|
|
|
29
|
-
/** A
|
|
32
|
+
/** A plugin's rows, whichever source could speak for it. */
|
|
30
33
|
interface IndexEntry {
|
|
31
34
|
name: string;
|
|
32
|
-
summary:
|
|
35
|
+
summary: PluginSummary | null;
|
|
33
36
|
skillCount: number;
|
|
34
37
|
toolCount: number;
|
|
35
38
|
attention: number;
|
|
@@ -37,86 +40,112 @@ interface IndexEntry {
|
|
|
37
40
|
member: boolean;
|
|
38
41
|
}
|
|
39
42
|
|
|
40
|
-
export function
|
|
41
|
-
const
|
|
43
|
+
export function PluginsIndexPage() {
|
|
44
|
+
const lib = useLibrary();
|
|
45
|
+
const { items, pluginSummaries, pluginsLoading, pluginsError, reload, reloadPlugins } = lib;
|
|
42
46
|
const navigate = useNavigate();
|
|
43
47
|
const { user } = useAuth();
|
|
48
|
+
const { isAdmin } = useAdmin();
|
|
49
|
+
const [newPluginOpen, setNewPluginOpen] = useState(false);
|
|
44
50
|
|
|
45
|
-
const personalName =
|
|
51
|
+
const personalName = personalPluginName(user?.name);
|
|
46
52
|
const ungroupedSkills = countKind(items, null, 'skill');
|
|
47
53
|
const ungroupedTools = countKind(items, null, 'integration');
|
|
48
54
|
|
|
49
55
|
const entries = useMemo((): IndexEntry[] => {
|
|
50
|
-
const names = new Set<string>(
|
|
51
|
-
for (const item of items) if (item.
|
|
56
|
+
const names = new Set<string>(pluginSummaries.map((g) => g.name));
|
|
57
|
+
for (const item of items) if (item.plugin) names.add(item.plugin);
|
|
52
58
|
|
|
53
59
|
return [...names]
|
|
54
60
|
.sort((a, b) => a.localeCompare(b))
|
|
55
61
|
.map((name) => {
|
|
56
|
-
const summary =
|
|
62
|
+
const summary = pluginSummaries.find((g) => g.name === name) ?? null;
|
|
57
63
|
const derivedSkills = countKind(items, name, 'skill');
|
|
58
64
|
const derivedTools = countKind(items, name, 'integration');
|
|
59
65
|
const hasItems = derivedSkills + derivedTools > 0;
|
|
60
66
|
return {
|
|
61
67
|
name,
|
|
62
68
|
summary,
|
|
63
|
-
// The summary's counts are the
|
|
69
|
+
// The summary's counts are the plugin's TOTALS; the catalog's are the
|
|
64
70
|
// caller's slice. Prefer the totals — a member should see the same
|
|
65
|
-
// "4 skills" here as on the
|
|
71
|
+
// "4 skills" here as on the plugin page.
|
|
66
72
|
skillCount: summary ? summary.skillCount : derivedSkills,
|
|
67
73
|
toolCount: summary ? summary.toolCount : derivedTools,
|
|
68
74
|
attention: attentionOf(items, name),
|
|
69
75
|
member: summary ? summary.canRead || summary.canWrite || hasItems : hasItems,
|
|
70
76
|
};
|
|
71
77
|
});
|
|
72
|
-
}, [
|
|
78
|
+
}, [pluginSummaries, items]);
|
|
73
79
|
|
|
74
80
|
const mine = entries.filter((e) => e.member);
|
|
75
81
|
const locked = entries.filter((e) => !e.member);
|
|
76
82
|
|
|
77
83
|
return (
|
|
78
84
|
<div className="pb-14">
|
|
79
|
-
<h1 className="text-display font-semibold">All
|
|
85
|
+
<h1 className="text-display font-semibold">All plugins</h1>
|
|
80
86
|
<p className="mt-0.5 text-ui text-ink-muted">
|
|
81
|
-
A
|
|
87
|
+
A plugin carries skills and tools for the people in it.
|
|
82
88
|
</p>
|
|
83
89
|
|
|
84
90
|
{/* Somebody asking to join one of these is the news on a page about
|
|
85
|
-
|
|
91
|
+
plugins, and this is the view the Library opens on — the one place
|
|
86
92
|
the ask is certain to be seen. Renders nothing when nothing pends. */}
|
|
87
93
|
<div className="mt-5 empty:mt-0">
|
|
88
|
-
<
|
|
94
|
+
<ManagedPluginRequests />
|
|
89
95
|
</div>
|
|
90
96
|
|
|
91
97
|
{/* "Owned by me" used to head this list and does not any more: it is a
|
|
92
|
-
LENS on every
|
|
98
|
+
LENS on every plugin (the things you answer for, wherever they live),
|
|
93
99
|
not a place items belong to. It stays in the sidebar, where lenses
|
|
94
|
-
go. What remains here is the one
|
|
100
|
+
go. What remains here is the one plugin that really is yours. */}
|
|
95
101
|
<SectionHead>Yours</SectionHead>
|
|
96
102
|
<RowList>
|
|
97
|
-
<
|
|
103
|
+
<PluginIndexRow
|
|
98
104
|
label={personalName}
|
|
99
|
-
description="Your sign-ins and the skills no
|
|
105
|
+
description="Your sign-ins and the skills no plugin carries"
|
|
100
106
|
meta={countsText(ungroupedSkills, ungroupedTools)}
|
|
101
107
|
onOpen={() => navigate(`${LIBRARY_ROOT}/yours`)}
|
|
102
108
|
/>
|
|
103
109
|
</RowList>
|
|
104
110
|
|
|
105
|
-
{
|
|
111
|
+
{pluginsError ? (
|
|
106
112
|
<Banner role="alert" tone="danger" className="mt-6">
|
|
107
|
-
{
|
|
108
|
-
<button type="button" className="ml-3 font-semibold underline" onClick={
|
|
113
|
+
{pluginsError}
|
|
114
|
+
<button type="button" className="ml-3 font-semibold underline" onClick={reloadPlugins}>
|
|
109
115
|
Try again
|
|
110
116
|
</button>
|
|
111
117
|
</Banner>
|
|
112
|
-
) :
|
|
113
|
-
<div className="py-16 text-center text-ui text-ink-faint">Loading
|
|
118
|
+
) : pluginsLoading && pluginSummaries.length === 0 ? (
|
|
119
|
+
<div className="py-16 text-center text-ui text-ink-faint">Loading plugins…</div>
|
|
114
120
|
) : (
|
|
115
121
|
<>
|
|
116
|
-
<SectionHead count={mine.length}>
|
|
122
|
+
<SectionHead count={mine.length}>Your plugins</SectionHead>
|
|
123
|
+
{/* The one page a person with no plugins is guaranteed to land on —
|
|
124
|
+
the Library opens here — so it is where the app says how a plugin
|
|
125
|
+
comes to exist, instead of a blank section that reads as "not for
|
|
126
|
+
you". The sidebar's `+` does the same thing; this one is written
|
|
127
|
+
out because a newcomer has not found that `+` yet.
|
|
128
|
+
|
|
129
|
+
Same verdict as the nav's version, from the same shared
|
|
130
|
+
predicate — `workspaceHasNoPlugins` — so the two surfaces cannot
|
|
131
|
+
disagree about whether a workspace is untouched. It is false for
|
|
132
|
+
locked plugins too (`mine.length === 0` alone would promise "the
|
|
133
|
+
first plugin" to someone simply not added to the twenty that
|
|
134
|
+
exist), and false until both plugin witnesses settle
|
|
135
|
+
successfully: a catalog still loading, or a summaries call that
|
|
136
|
+
failed, is an unanswered question, not an untouched workspace. */}
|
|
137
|
+
{isAdmin && workspaceHasNoPlugins(lib) && (
|
|
138
|
+
<p className="text-ui text-ink-faint">
|
|
139
|
+
{"You're not in any plugins yet. "}
|
|
140
|
+
<EmptyStateAction onClick={() => setNewPluginOpen(true)}>
|
|
141
|
+
Create the first plugin
|
|
142
|
+
</EmptyStateAction>
|
|
143
|
+
{' to share skills and tools with your team.'}
|
|
144
|
+
</p>
|
|
145
|
+
)}
|
|
117
146
|
<RowList>
|
|
118
147
|
{mine.map((entry) => (
|
|
119
|
-
<
|
|
148
|
+
<PluginIndexRow
|
|
120
149
|
key={entry.name}
|
|
121
150
|
label={entry.name}
|
|
122
151
|
badge={
|
|
@@ -134,17 +163,17 @@ export function GroupsIndexPage() {
|
|
|
134
163
|
</Badge>
|
|
135
164
|
) : undefined
|
|
136
165
|
}
|
|
137
|
-
onOpen={() => navigate(
|
|
166
|
+
onOpen={() => navigate(pathForPlugin(entry.name))}
|
|
138
167
|
/>
|
|
139
168
|
))}
|
|
140
169
|
</RowList>
|
|
141
170
|
|
|
142
171
|
{locked.length > 0 && (
|
|
143
172
|
<>
|
|
144
|
-
<SectionHead count={locked.length}>
|
|
173
|
+
<SectionHead count={locked.length}>Request access</SectionHead>
|
|
145
174
|
<RowList>
|
|
146
175
|
{locked.map((entry) => (
|
|
147
|
-
<
|
|
176
|
+
<PluginIndexRow
|
|
148
177
|
key={entry.name}
|
|
149
178
|
label={entry.name}
|
|
150
179
|
{...describe(entry)}
|
|
@@ -166,7 +195,7 @@ export function GroupsIndexPage() {
|
|
|
166
195
|
</Badge>
|
|
167
196
|
)
|
|
168
197
|
}
|
|
169
|
-
onOpen={() => navigate(
|
|
198
|
+
onOpen={() => navigate(pathForPlugin(entry.name))}
|
|
170
199
|
/>
|
|
171
200
|
))}
|
|
172
201
|
</RowList>
|
|
@@ -174,13 +203,27 @@ export function GroupsIndexPage() {
|
|
|
174
203
|
)}
|
|
175
204
|
</>
|
|
176
205
|
)}
|
|
206
|
+
|
|
207
|
+
{newPluginOpen && (
|
|
208
|
+
<NewPluginDialog
|
|
209
|
+
// Every name this page can see — summaries and catalog-derived rows
|
|
210
|
+
// alike. Locked-but-undiscoverable plugins are absent from both; the
|
|
211
|
+
// provisioning endpoint is the authority that catches those.
|
|
212
|
+
existing={entries.map((e) => e.name)}
|
|
213
|
+
onClose={() => setNewPluginOpen(false)}
|
|
214
|
+
onCreated={() => {
|
|
215
|
+
reload();
|
|
216
|
+
reloadPlugins();
|
|
217
|
+
}}
|
|
218
|
+
/>
|
|
219
|
+
)}
|
|
177
220
|
</div>
|
|
178
221
|
);
|
|
179
222
|
}
|
|
180
223
|
|
|
181
224
|
/**
|
|
182
225
|
* A row's description + meta. With a summary the row leads with WHO runs the
|
|
183
|
-
*
|
|
226
|
+
* plugin and puts the counts on the right; without one there is no verified
|
|
184
227
|
* principal to name, so the counts move left and the meta slot stays empty
|
|
185
228
|
* rather than inventing a "Run by …" we never resolved.
|
|
186
229
|
*/
|
|
@@ -192,7 +235,7 @@ function describe(entry: IndexEntry): { description: string; meta?: string } {
|
|
|
192
235
|
|
|
193
236
|
/**
|
|
194
237
|
* `{n} skills · {n} tools`, fixed plural. Not an oversight: the spec's own
|
|
195
|
-
* empty-
|
|
238
|
+
* empty-plugin example reads `0 skills · 0 tools`, so this is a label for two
|
|
196
239
|
* quantities rather than a sentence about them, and it stays the same width as
|
|
197
240
|
* the row above it.
|
|
198
241
|
*/
|
|
@@ -200,8 +243,8 @@ function countsText(skills: number, tools: number): string {
|
|
|
200
243
|
return `${skills} skills · ${tools} tools`;
|
|
201
244
|
}
|
|
202
245
|
|
|
203
|
-
function countKind(items: LibraryItem[],
|
|
204
|
-
return items.filter((i) => i.
|
|
246
|
+
function countKind(items: LibraryItem[], plugin: string | null, kind: LibraryItem['kind']): number {
|
|
247
|
+
return items.filter((i) => i.plugin === plugin && i.kind === kind).length;
|
|
205
248
|
}
|
|
206
249
|
|
|
207
250
|
/** Section label with an optional count cap beside it, not inside it — the
|