@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,20 +1,20 @@
|
|
|
1
1
|
import { useCallback, useContext, useEffect, useMemo, useState, type ReactNode, } from 'react';
|
|
2
2
|
import { LibraryContext } from './library-context';
|
|
3
|
-
import {
|
|
3
|
+
import { pluginOfPath, isPersonalPluginFolder } from '@bevel-software/platform-shared';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* The
|
|
7
|
-
* "yours alone" bucket. A personal folder (`
|
|
8
|
-
* a person's own skills live; it is a place, not a
|
|
6
|
+
* The plugin a card files under — with personal folders mapped to `null`, the
|
|
7
|
+
* "yours alone" bucket. A personal folder (`Plugins/personal-<id>/`) is where
|
|
8
|
+
* a person's own skills live; it is a place, not a plugin, and the only
|
|
9
9
|
* personal items a caller can ever read are their own (the folder's seeded
|
|
10
10
|
* access.md names nobody else), so `null` here always means "yours".
|
|
11
11
|
*/
|
|
12
|
-
function
|
|
13
|
-
const
|
|
14
|
-
return
|
|
12
|
+
function displayPluginOf(path: string): string | null {
|
|
13
|
+
const plugin = pluginOfPath(path);
|
|
14
|
+
return plugin !== null && isPersonalPluginFolder(plugin) ? null : plugin;
|
|
15
15
|
}
|
|
16
16
|
import { useLibraryData, type LibraryData } from '../hooks/useLibraryData';
|
|
17
|
-
import {
|
|
17
|
+
import { listPlugins, type PluginSummary } from '../services/plugins.api';
|
|
18
18
|
import {
|
|
19
19
|
neededToolsFor,
|
|
20
20
|
skillStatus,
|
|
@@ -25,8 +25,8 @@ import {
|
|
|
25
25
|
/**
|
|
26
26
|
* The Library's data host.
|
|
27
27
|
*
|
|
28
|
-
* Everything under `/skills-and-tools/*` — the gallery, the
|
|
29
|
-
* all-
|
|
28
|
+
* Everything under `/skills-and-tools/*` — the gallery, the plugin pages, the
|
|
29
|
+
* all-plugins index — reads the SAME catalog, so it is fetched once here rather
|
|
30
30
|
* than once per page. That matters more than it looks: `useLibraryData` pays an
|
|
31
31
|
* N+1 `getSkill` to read `allowed-tools` frontmatter, and mounting it per route
|
|
32
32
|
* would re-pay it on every navigation.
|
|
@@ -34,8 +34,8 @@ import {
|
|
|
34
34
|
* Two independent loads live side by side:
|
|
35
35
|
* - the catalog (`useLibraryData`), whose failure IS surfaced (the gallery
|
|
36
36
|
* shows a banner — an empty library is indistinguishable from a broken one);
|
|
37
|
-
* - the
|
|
38
|
-
* reported through `
|
|
37
|
+
* - the plugin index (`GET /api/plugins`), whose failure degrades to `[]` and is
|
|
38
|
+
* reported through `pluginsError` for the surfaces that want to say so.
|
|
39
39
|
*/
|
|
40
40
|
|
|
41
41
|
/** One card in the gallery — a skill or an integration, already status-derived. */
|
|
@@ -46,8 +46,8 @@ export interface LibraryItem {
|
|
|
46
46
|
description: string;
|
|
47
47
|
owned: boolean;
|
|
48
48
|
status: AttentionStatus;
|
|
49
|
-
/** Folder
|
|
50
|
-
|
|
49
|
+
/** Folder plugin from the KB path, or null when the item is in none. */
|
|
50
|
+
plugin: string | null;
|
|
51
51
|
/** Repo-root-relative path — the skill's folder, or the `.tool` file. */
|
|
52
52
|
path: string;
|
|
53
53
|
/**
|
|
@@ -77,41 +77,41 @@ export interface LibraryItem {
|
|
|
77
77
|
export interface LibraryContextValue extends LibraryData {
|
|
78
78
|
items: LibraryItem[];
|
|
79
79
|
/** `[]` until loaded, and on error. */
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
80
|
+
pluginSummaries: PluginSummary[];
|
|
81
|
+
pluginsLoading: boolean;
|
|
82
|
+
pluginsError: string | null;
|
|
83
|
+
reloadPlugins(): void;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
|
|
87
87
|
export function LibraryProvider({ children }: { children: ReactNode }) {
|
|
88
88
|
const data = useLibraryData();
|
|
89
|
-
const [
|
|
90
|
-
const [
|
|
91
|
-
const [
|
|
92
|
-
const [
|
|
89
|
+
const [pluginSummaries, setPluginSummaries] = useState<PluginSummary[]>([]);
|
|
90
|
+
const [pluginsLoading, setPluginsLoading] = useState(true);
|
|
91
|
+
const [pluginsError, setPluginsError] = useState<string | null>(null);
|
|
92
|
+
const [pluginsRevision, setPluginsRevision] = useState(0);
|
|
93
93
|
|
|
94
94
|
useEffect(() => {
|
|
95
95
|
let cancelled = false;
|
|
96
|
-
|
|
97
|
-
.then((
|
|
96
|
+
listPlugins()
|
|
97
|
+
.then((plugins) => {
|
|
98
98
|
if (cancelled) return;
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
setPluginSummaries(plugins);
|
|
100
|
+
setPluginsError(null);
|
|
101
101
|
})
|
|
102
102
|
.catch((err: unknown) => {
|
|
103
103
|
if (cancelled) return;
|
|
104
104
|
// Keep whatever we had: a transient failure on a manual reload should
|
|
105
105
|
// not blank a list the user is looking at.
|
|
106
|
-
|
|
106
|
+
setPluginsError(err instanceof Error ? err.message : "Couldn't load plugins.");
|
|
107
107
|
})
|
|
108
108
|
.finally(() => {
|
|
109
|
-
if (!cancelled)
|
|
109
|
+
if (!cancelled) setPluginsLoading(false);
|
|
110
110
|
});
|
|
111
111
|
return () => {
|
|
112
112
|
cancelled = true;
|
|
113
113
|
};
|
|
114
|
-
}, [
|
|
114
|
+
}, [pluginsRevision]);
|
|
115
115
|
|
|
116
116
|
const items: LibraryItem[] = useMemo(() => {
|
|
117
117
|
const skillItems: LibraryItem[] = data.skills.map((s) => ({
|
|
@@ -120,7 +120,7 @@ export function LibraryProvider({ children }: { children: ReactNode }) {
|
|
|
120
120
|
name: s.name,
|
|
121
121
|
description: s.description,
|
|
122
122
|
owned: data.ownedSkills.has(s.name),
|
|
123
|
-
|
|
123
|
+
plugin: displayPluginOf(s.path),
|
|
124
124
|
path: s.path,
|
|
125
125
|
version: s.version,
|
|
126
126
|
status: skillStatus(
|
|
@@ -130,13 +130,13 @@ export function LibraryProvider({ children }: { children: ReactNode }) {
|
|
|
130
130
|
/**
|
|
131
131
|
* Proposed skills, alongside the released ones rather than in a pile of
|
|
132
132
|
* their own. The question "is this skill available?" is asked in the same
|
|
133
|
-
* place as "does this
|
|
133
|
+
* place as "does this plugin have one?", and a separate shelf answers the
|
|
134
134
|
* second while hiding the first — which is exactly the failure this fixes:
|
|
135
135
|
* a skill an agent proposed was nowhere at all until it merged.
|
|
136
136
|
*
|
|
137
137
|
* `status` is the neutral `ok`: a proposal has no integrations resolved
|
|
138
138
|
* against it, and reporting `warn` would put it in the setup filter and the
|
|
139
|
-
*
|
|
139
|
+
* plugin's amber count as though something were broken.
|
|
140
140
|
*/
|
|
141
141
|
const pendingItems: LibraryItem[] = data.pendingSkills.map((s) => ({
|
|
142
142
|
kind: 'skill',
|
|
@@ -144,7 +144,7 @@ export function LibraryProvider({ children }: { children: ReactNode }) {
|
|
|
144
144
|
name: s.name,
|
|
145
145
|
description: s.description,
|
|
146
146
|
owned: false,
|
|
147
|
-
|
|
147
|
+
plugin: displayPluginOf(s.path),
|
|
148
148
|
path: s.path,
|
|
149
149
|
version: s.version,
|
|
150
150
|
status: { state: 'ok', text: 'In review' },
|
|
@@ -163,7 +163,7 @@ export function LibraryProvider({ children }: { children: ReactNode }) {
|
|
|
163
163
|
// manual yet (see report) — the card stays clean; detail lives behind it.
|
|
164
164
|
description: '',
|
|
165
165
|
owned: t.canWrite,
|
|
166
|
-
|
|
166
|
+
plugin: displayPluginOf(t.path),
|
|
167
167
|
path: t.path,
|
|
168
168
|
status: toolStatus(t),
|
|
169
169
|
}));
|
|
@@ -180,21 +180,21 @@ export function LibraryProvider({ children }: { children: ReactNode }) {
|
|
|
180
180
|
// already covers the first load, and flipping it from the event that asked
|
|
181
181
|
// for the refetch keeps the effect body free of synchronous setState (which
|
|
182
182
|
// costs a cascading render on every revision).
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
-
|
|
183
|
+
const reloadPlugins = useCallback(() => {
|
|
184
|
+
setPluginsLoading(true);
|
|
185
|
+
setPluginsRevision((r) => r + 1);
|
|
186
186
|
}, []);
|
|
187
187
|
|
|
188
188
|
const value = useMemo(
|
|
189
189
|
(): LibraryContextValue => ({
|
|
190
190
|
...data,
|
|
191
191
|
items,
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
192
|
+
pluginSummaries,
|
|
193
|
+
pluginsLoading,
|
|
194
|
+
pluginsError,
|
|
195
|
+
reloadPlugins,
|
|
196
196
|
}),
|
|
197
|
-
[data, items,
|
|
197
|
+
[data, items, pluginSummaries, pluginsLoading, pluginsError, reloadPlugins],
|
|
198
198
|
);
|
|
199
199
|
|
|
200
200
|
return <LibraryContext.Provider value={value}>{children}</LibraryContext.Provider>;
|
|
@@ -207,8 +207,29 @@ export function useLibrary(): LibraryContextValue {
|
|
|
207
207
|
}
|
|
208
208
|
|
|
209
209
|
/**
|
|
210
|
-
*
|
|
211
|
-
*
|
|
210
|
+
* "This workspace holds no plugins at all" — settled, and from both witnesses.
|
|
211
|
+
*
|
|
212
|
+
* One predicate for every surface that offers to create the FIRST plugin (the
|
|
213
|
+
* nav's spelled-out row, the index's CTA), so the two cannot drift into
|
|
214
|
+
* disagreeing about whether a workspace is untouched. Deliberately false while
|
|
215
|
+
* either source is still loading or has failed: an unanswered question is not
|
|
216
|
+
* "no plugins", and a first-plugin doorway shown on a guess points somebody at
|
|
217
|
+
* a decision that may already be taken.
|
|
218
|
+
*/
|
|
219
|
+
export function workspaceHasNoPlugins(lib: LibraryContextValue): boolean {
|
|
220
|
+
return (
|
|
221
|
+
!lib.loading &&
|
|
222
|
+
!lib.pluginsLoading &&
|
|
223
|
+
!lib.error &&
|
|
224
|
+
!lib.pluginsError &&
|
|
225
|
+
lib.pluginSummaries.length === 0 &&
|
|
226
|
+
lib.items.every((item) => item.plugin === null)
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* How many of a plugin's integrations need setup — the amber count on the
|
|
232
|
+
* sidebar row and the plugin page's banner, computed from one place so the two
|
|
212
233
|
* can never disagree.
|
|
213
234
|
*
|
|
214
235
|
* Only integrations count. A skill that reports `warn` is warning about the
|
|
@@ -216,8 +237,8 @@ export function useLibrary(): LibraryContextValue {
|
|
|
216
237
|
* broken connection; pending change requests are a review concern, not a setup
|
|
217
238
|
* one, and belong to a different surface.
|
|
218
239
|
*/
|
|
219
|
-
export function attentionOf(items: LibraryItem[],
|
|
240
|
+
export function attentionOf(items: LibraryItem[], plugin: string): number {
|
|
220
241
|
return items.filter(
|
|
221
|
-
(i) => i.
|
|
242
|
+
(i) => i.plugin === plugin && i.kind === 'integration' && i.status.state !== 'ok',
|
|
222
243
|
).length;
|
|
223
244
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Rendering people's names the way a person says them.
|
|
3
3
|
*
|
|
4
|
-
* Shared by the locked-
|
|
4
|
+
* Shared by the locked-plugin view (its request toast) and the owner-side
|
|
5
5
|
* access-requests banner: both list requesters, and two copies of this drifted
|
|
6
6
|
* into place once already.
|
|
7
7
|
*/
|
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
* The name of a person's own space — the prototype's `MINE()` (line 2078),
|
|
3
3
|
* which reads `me().name.split(' ')[0] + "'s List"`.
|
|
4
4
|
*
|
|
5
|
-
* It is called a
|
|
6
|
-
* the same page, the same sections, the same card grid as `
|
|
5
|
+
* It is called a PLUGIN here rather than a list because that is what it now is:
|
|
6
|
+
* the same page, the same sections, the same card grid as `Plugins/Engineering`.
|
|
7
7
|
* The only difference is which items it holds, and that is a query, not a kind.
|
|
8
8
|
*
|
|
9
|
-
* First name only, deliberately. "Juan's
|
|
10
|
-
* it out loud; "Juan Viera's
|
|
9
|
+
* First name only, deliberately. "Juan's Plugin" is what a colleague would call
|
|
10
|
+
* it out loud; "Juan Viera's Plugin" is what a directory would call it.
|
|
11
11
|
*/
|
|
12
|
-
export function
|
|
12
|
+
export function personalPluginName(displayName: string | null | undefined): string {
|
|
13
13
|
const first = displayFirstName(displayName);
|
|
14
14
|
// Nobody signed in, or a user record with no name: the space still exists and
|
|
15
15
|
// still needs a heading, and "Yours" is true for whoever is reading it.
|
|
16
16
|
if (!first) return 'Yours';
|
|
17
|
-
return `${first}'s
|
|
17
|
+
return `${first}'s Plugin`;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
/**
|
|
@@ -23,11 +23,11 @@ export function personalGroupName(displayName: string | null | undefined): strin
|
|
|
23
23
|
* Sign-in records are not a style guide — an account created from a lowercase
|
|
24
24
|
* email or a hastily typed name should still be greeted the way a person
|
|
25
25
|
* writes their own name. The capital belongs HERE rather than at each call
|
|
26
|
-
* site, so the welcome page and the
|
|
26
|
+
* site, so the welcome page and the plugin heading cannot disagree about how
|
|
27
27
|
* to spell the same person.
|
|
28
28
|
*
|
|
29
29
|
* Empty when there is no name to work with, and each caller picks its own
|
|
30
|
-
* fallback: the
|
|
30
|
+
* fallback: the plugin heading says "Yours", the welcome page says "there".
|
|
31
31
|
*/
|
|
32
32
|
export function displayFirstName(displayName: string | null | undefined): string {
|
|
33
33
|
const first = (displayName ?? '').trim().split(/\s+/)[0] ?? '';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PluginPrincipals, PluginSummary } from '../services/plugins.api';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* How a
|
|
4
|
+
* How a plugin describes its membership in prose.
|
|
5
5
|
*
|
|
6
6
|
* Membership is displayed as ACCESS-RULE PRINCIPALS — the roles and people
|
|
7
7
|
* `access.md` names — and never as a head-count of who can read the folder.
|
|
@@ -9,7 +9,7 @@ import type { GroupPrincipals, GroupSummary } from '../services/groups.api';
|
|
|
9
9
|
*
|
|
10
10
|
* 1. Expanding a role to its people needs the roster endpoint, which is
|
|
11
11
|
* admin-gated. A per-person list would render for admins and vanish for
|
|
12
|
-
* everyone else, so the same
|
|
12
|
+
* everyone else, so the same plugin would describe itself differently
|
|
13
13
|
* depending on who asked.
|
|
14
14
|
* 2. Resolution is closeness-first with per-file overrides, so "who can read
|
|
15
15
|
* this folder" is not well-defined AT folder granularity. A person list
|
|
@@ -21,25 +21,25 @@ import type { GroupPrincipals, GroupSummary } from '../services/groups.api';
|
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
23
|
/** Names as written, users before roles — the order the run-by line reads in. */
|
|
24
|
-
function usersThenRoles(p:
|
|
24
|
+
function usersThenRoles(p: PluginPrincipals): string[] {
|
|
25
25
|
return [...p.users.map((u) => u.name), ...p.roles].filter((s) => s.length > 0);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
/** Roles before people — the order a share list reads in. */
|
|
29
|
-
function rolesThenUsers(p:
|
|
29
|
+
function rolesThenUsers(p: PluginPrincipals): string[] {
|
|
30
30
|
return [...p.roles, ...p.users.map((u) => u.name)].filter((s) => s.length > 0);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
* Who runs the
|
|
34
|
+
* Who runs the plugin: owners, falling back to writers, falling back to the
|
|
35
35
|
* admins.
|
|
36
36
|
*
|
|
37
37
|
* The writer fallback is not a guess — owner ⊂ writer, and "who runs it" is
|
|
38
38
|
* really "who can change it". The final fallback is a fact rather than a
|
|
39
39
|
* placeholder: admin-rescue guarantees a platform Admin can always write an
|
|
40
|
-
* `access.md`, so a
|
|
40
|
+
* `access.md`, so a plugin with no named principals genuinely is run by them.
|
|
41
41
|
*/
|
|
42
|
-
export function ownersTextOf(summary: Pick<
|
|
42
|
+
export function ownersTextOf(summary: Pick<PluginSummary, 'owners' | 'writers'>): string {
|
|
43
43
|
const owners = usersThenRoles(summary.owners);
|
|
44
44
|
if (owners.length > 0) return owners.join(', ');
|
|
45
45
|
const writers = usersThenRoles(summary.writers);
|
|
@@ -48,13 +48,13 @@ export function ownersTextOf(summary: Pick<GroupSummary, 'owners' | 'writers'>):
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
|
-
* Who the
|
|
52
|
-
* — either the reader list was withheld (the caller cannot read the
|
|
53
|
-
* a locked
|
|
51
|
+
* Who the plugin is shared with, or `null` when there is nothing honest to say
|
|
52
|
+
* — either the reader list was withheld (the caller cannot read the plugin, and
|
|
53
|
+
* a locked plugin never advertises its share list) or it resolved empty.
|
|
54
54
|
* Callers drop the whole `· shared with …` clause on null rather than printing
|
|
55
55
|
* a dangling half-sentence.
|
|
56
56
|
*/
|
|
57
|
-
export function readersTextOf(summary: Pick<
|
|
57
|
+
export function readersTextOf(summary: Pick<PluginSummary, 'readers'>): string | null {
|
|
58
58
|
const readers = summary.readers;
|
|
59
59
|
if (!readers) return null;
|
|
60
60
|
if (!readers.restricted) return 'everyone here';
|
|
@@ -62,7 +62,7 @@ export function readersTextOf(summary: Pick<GroupSummary, 'readers'>): string |
|
|
|
62
62
|
return named.length > 0 ? named.join(', ') : null;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
/** The folder a
|
|
66
|
-
export function primaryFolderOf(summary: Pick<
|
|
65
|
+
/** The folder a plugin's writes and links point at — its single `Plugins/<G>` folder. */
|
|
66
|
+
export function primaryFolderOf(summary: Pick<PluginSummary, 'folders'>): string | null {
|
|
67
67
|
return summary.folders[0] ?? null;
|
|
68
68
|
}
|
|
@@ -116,15 +116,15 @@ export function skillStatus(neededTools: ToolSecrets[]): AttentionStatus {
|
|
|
116
116
|
* What the sidebar has selected.
|
|
117
117
|
*
|
|
118
118
|
* Note there is no 'skills' / 'integrations' member. The design does not split
|
|
119
|
-
* the catalog by kind: a
|
|
120
|
-
* so filtering to "just tools" would show a
|
|
119
|
+
* the catalog by kind: a plugin owns its skills AND the tools those skills need,
|
|
120
|
+
* so filtering to "just tools" would show a plugin's integrations detached from
|
|
121
121
|
* the reason any of them are there. Kind is a property of a card, not a view.
|
|
122
122
|
*/
|
|
123
123
|
export type LibraryFilter =
|
|
124
124
|
| { kind: 'all' }
|
|
125
125
|
| { kind: 'owned' }
|
|
126
|
-
| { kind: 'group';
|
|
127
|
-
/** Owned by someone, in no
|
|
126
|
+
| { kind: 'group'; plugin: string }
|
|
127
|
+
/** Owned by someone, in no plugin — the prototype calls these "yours alone". */
|
|
128
128
|
| { kind: 'ungrouped' };
|
|
129
129
|
|
|
130
130
|
/**
|
|
@@ -150,8 +150,8 @@ export interface LibraryFilterable {
|
|
|
150
150
|
name: string;
|
|
151
151
|
description: string;
|
|
152
152
|
owned: boolean;
|
|
153
|
-
/** Folder
|
|
154
|
-
|
|
153
|
+
/** Folder plugin from the item's KB path, or null when it sits in none. */
|
|
154
|
+
plugin: string | null;
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
/** Sidebar selection narrows; the query matches name/description within it. */
|
|
@@ -171,29 +171,29 @@ export function filterLibraryItems<T extends LibraryFilterable>(
|
|
|
171
171
|
case 'owned':
|
|
172
172
|
return item.owned;
|
|
173
173
|
case 'group':
|
|
174
|
-
return item.
|
|
174
|
+
return item.plugin === filter.plugin;
|
|
175
175
|
case 'ungrouped':
|
|
176
|
-
return item.
|
|
176
|
+
return item.plugin === null;
|
|
177
177
|
}
|
|
178
178
|
});
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
/**
|
|
182
|
-
*
|
|
182
|
+
* Plugin names present in the catalog, with how many items each holds.
|
|
183
183
|
*
|
|
184
184
|
* Sorted by name rather than by count so the sidebar does not reorder itself
|
|
185
|
-
* when a
|
|
186
|
-
* than one that buries the biggest
|
|
185
|
+
* when a plugin gains an item — a nav that moves under the pointer is worse
|
|
186
|
+
* than one that buries the biggest plugin in the middle.
|
|
187
187
|
*/
|
|
188
|
-
export function
|
|
188
|
+
export function pluginCounts<T extends LibraryFilterable>(
|
|
189
189
|
items: T[],
|
|
190
|
-
): {
|
|
190
|
+
): { plugin: string; count: number }[] {
|
|
191
191
|
const counts = new Map<string, number>();
|
|
192
192
|
for (const item of items) {
|
|
193
|
-
if (item.
|
|
194
|
-
counts.set(item.
|
|
193
|
+
if (item.plugin === null) continue;
|
|
194
|
+
counts.set(item.plugin, (counts.get(item.plugin) ?? 0) + 1);
|
|
195
195
|
}
|
|
196
196
|
return [...counts.entries()]
|
|
197
|
-
.map(([
|
|
198
|
-
.sort((a, b) => a.
|
|
197
|
+
.map(([plugin, count]) => ({ plugin, count }))
|
|
198
|
+
.sort((a, b) => a.plugin.localeCompare(b.plugin));
|
|
199
199
|
}
|