@bevel-software/platform-core-frontend 0.7.4 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/LICENSE +202 -202
  2. package/THIRD-PARTY-NOTICES.md +344 -988
  3. package/package.json +5 -5
  4. package/src/core/CoreAppShell.tsx +4 -4
  5. package/src/core/__tests__/ShellRoutes.test.tsx +1 -1
  6. package/src/core/__tests__/bootstrap.test.ts +47 -2
  7. package/src/core/bootstrap.ts +20 -0
  8. package/src/css-side-effect-imports.d.ts +7 -7
  9. package/src/modules/access/__tests__/ManageAccessDialog.placement.test.tsx +1 -1
  10. package/src/modules/access/__tests__/ManageAccessDialog.test.tsx +5 -5
  11. package/src/modules/access/api.ts +5 -5
  12. package/src/modules/access/components/ManageAccessDialog.tsx +21 -20
  13. package/src/modules/admin/__tests__/AdminRolesPage.suggest.test.tsx +1 -1
  14. package/src/modules/admin/components/AdminRolesPage.tsx +1 -1
  15. package/src/modules/change-requests/__tests__/useFileOnBranch.test.tsx +2 -2
  16. package/src/modules/change-requests/components/ChangeRequestDialog.tsx +1 -1
  17. package/src/modules/change-requests/hooks/useApplyChangeRequest.ts +1 -1
  18. package/src/modules/layout/__tests__/SidebarFrameResponsive.test.tsx +4 -4
  19. package/src/modules/layout/__tests__/SidebarToggle.test.tsx +4 -4
  20. package/src/modules/layout/__tests__/breakpoints.test.ts +1 -1
  21. package/src/modules/layout/components/SidebarFrame.tsx +2 -2
  22. package/src/modules/library/__tests__/{AddToGroupDialog.test.tsx → AddToPluginDialog.test.tsx} +34 -34
  23. package/src/modules/library/__tests__/LibraryCard.test.tsx +30 -11
  24. package/src/modules/library/__tests__/LibraryRoutes.test.tsx +84 -59
  25. package/src/modules/library/__tests__/LibrarySidebarMenu.test.tsx +51 -51
  26. package/src/modules/library/__tests__/{LockedGroupView.test.tsx → LockedPluginView.test.tsx} +33 -33
  27. package/src/modules/library/__tests__/McpServerSection.test.tsx +138 -0
  28. package/src/modules/library/__tests__/{NewGroupDialog.test.tsx → NewPluginDialog.test.tsx} +22 -22
  29. package/src/modules/library/__tests__/PersonalAddDialog.test.tsx +7 -7
  30. package/src/modules/library/__tests__/PluginExtras.test.tsx +131 -0
  31. package/src/modules/library/__tests__/{GroupJoinRequests.test.tsx → PluginJoinRequests.test.tsx} +24 -24
  32. package/src/modules/library/__tests__/{GroupPage.test.tsx → PluginPage.test.tsx} +101 -101
  33. package/src/modules/library/__tests__/{GroupsIndexPage.test.tsx → PluginsIndexPage.test.tsx} +57 -57
  34. package/src/modules/library/__tests__/{GroupsSidebar.contextmenu.test.tsx → PluginsSidebar.contextmenu.test.tsx} +31 -31
  35. package/src/modules/library/__tests__/{GroupsSidebar.locked.test.tsx → PluginsSidebar.locked.test.tsx} +28 -28
  36. package/src/modules/library/__tests__/{GroupsSidebar.test.tsx → PluginsSidebar.test.tsx} +39 -39
  37. package/src/modules/library/__tests__/{GroupsSidebarMenu.test.tsx → PluginsSidebarMenu.test.tsx} +18 -18
  38. package/src/modules/library/__tests__/SkillPage.test.tsx +8 -8
  39. package/src/modules/library/__tests__/ToolConnectionSection.test.tsx +2 -2
  40. package/src/modules/library/__tests__/ToolPage.test.tsx +41 -12
  41. package/src/modules/library/__tests__/ToolSharePanel.test.tsx +1 -1
  42. package/src/modules/library/__tests__/WorkspaceItemRoute.test.tsx +57 -57
  43. package/src/modules/library/__tests__/auth-harness.tsx +4 -4
  44. package/src/modules/library/__tests__/status.test.ts +19 -19
  45. package/src/modules/library/__tests__/tools.api.test.ts +70 -0
  46. package/src/modules/library/__tests__/useToolPage.test.tsx +4 -4
  47. package/src/modules/library/components/AccessRequestsBanner.tsx +8 -8
  48. package/src/modules/library/components/{AddToGroupDialog.tsx → AddToPluginDialog.tsx} +11 -11
  49. package/src/modules/library/components/ChangeRequestDock.tsx +1 -1
  50. package/src/modules/library/components/{DeleteGroupDialog.tsx → DeletePluginDialog.tsx} +9 -9
  51. package/src/modules/library/components/LibraryCard.tsx +26 -2
  52. package/src/modules/library/components/LibraryLayout.tsx +70 -70
  53. package/src/modules/library/components/LibraryPage.tsx +8 -8
  54. package/src/modules/library/components/LockGlyph.tsx +1 -1
  55. package/src/modules/library/components/{LockedGroupView.tsx → LockedPluginView.tsx} +35 -35
  56. package/src/modules/library/components/{ManagedGroupRequests.tsx → ManagedPluginRequests.tsx} +13 -13
  57. package/src/modules/library/components/{NewGroupDialog.tsx → NewPluginDialog.tsx} +24 -24
  58. package/src/modules/library/components/NewSkillPanel.tsx +5 -5
  59. package/src/modules/library/components/PageActions.tsx +3 -3
  60. package/src/modules/library/components/PersonalAddDialog.tsx +5 -5
  61. package/src/modules/library/components/{PersonalGroupPage.tsx → PersonalPluginPage.tsx} +17 -17
  62. package/src/modules/library/components/PluginExtras.tsx +195 -0
  63. package/src/modules/library/components/{GroupIndexRow.tsx → PluginIndexRow.tsx} +6 -6
  64. package/src/modules/library/components/{GroupJoinRequests.tsx → PluginJoinRequests.tsx} +12 -12
  65. package/src/modules/library/components/{GroupPage.tsx → PluginPage.tsx} +72 -69
  66. package/src/modules/library/components/{GroupsIndexPage.tsx → PluginsIndexPage.tsx} +46 -46
  67. package/src/modules/library/components/{GroupsSidebar.tsx → PluginsSidebar.tsx} +55 -55
  68. package/src/modules/library/components/{GroupsSidebarMenu.tsx → PluginsSidebarMenu.tsx} +15 -15
  69. package/src/modules/library/components/{group-page-parts.tsx → plugin-page-parts.tsx} +35 -24
  70. package/src/modules/library/components/skill-page/SkillPage.tsx +12 -12
  71. package/src/modules/library/components/tool-page/McpServerSection.tsx +380 -0
  72. package/src/modules/library/components/tool-page/ToolPage.tsx +22 -5
  73. package/src/modules/library/hooks/useJoinRequests.ts +8 -8
  74. package/src/modules/library/routes/LibraryRoutes.tsx +30 -17
  75. package/src/modules/library/routes/WorkspaceItemRoute.tsx +24 -24
  76. package/src/modules/library/routes/library-paths.ts +36 -36
  77. package/src/modules/library/services/library.api.ts +9 -9
  78. package/src/modules/library/services/{groups.api.ts → plugins.api.ts} +43 -43
  79. package/src/modules/library/services/tools.api.ts +54 -0
  80. package/src/modules/library/state/library-data.tsx +46 -46
  81. package/src/modules/library/utils/names.ts +1 -1
  82. package/src/modules/library/utils/{personal-group.ts → personal-plugin.ts} +8 -8
  83. package/src/modules/library/utils/{group-summary.ts → plugin-summary.ts} +14 -14
  84. package/src/modules/library/utils/status.ts +17 -17
  85. package/src/modules/onboarding/__tests__/onboarding.test.tsx +86 -8
  86. package/src/modules/onboarding/agent-clients.ts +18 -14
  87. package/src/modules/onboarding/components/WelcomePage.tsx +19 -8
  88. package/src/modules/review/components/MarkdownDiffViewer.tsx +1 -1
  89. package/src/modules/review/components/ReviewPanel.tsx +11 -11
  90. package/src/modules/review/components/__tests__/{isGroupItemPath.test.ts → isPluginItemPath.test.ts} +24 -24
  91. package/src/modules/secrets-vault/components/ToolSecretsPanel.tsx +3 -3
  92. package/src/modules/secrets-vault/components/__tests__/SecretsPage.test.tsx +1 -1
  93. package/src/modules/settings/components/SettingsLayout.tsx +1 -1
  94. package/src/modules/settings/components/SettingsNav.tsx +5 -5
  95. package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +29 -107
  96. package/src/modules/toolbar/components/__tests__/AppSwitcher.test.tsx +1 -1
  97. package/src/modules/toolbar/components/__tests__/ExternalAgentAccessPage.test.tsx +228 -0
  98. package/src/modules/toolbar/components/__tests__/Toolbar.test.tsx +3 -3
  99. package/src/modules/workspace/components/FileExplorer.tsx +12 -12
  100. package/src/modules/workspace/components/__tests__/FileExplorer.test.tsx +14 -14
  101. package/src/modules/workspace/components/renderers/ToolRenderer.tsx +7 -2
  102. package/src/modules/workspace/utils/__tests__/diff.test.ts +1 -1
  103. package/src/modules/workspace/utils/fileTree.ts +3 -3
  104. package/src/shared/mcp/ClaudeInstallLink.tsx +88 -0
  105. package/src/shared/mcp/ConnectionInstructions.tsx +51 -0
  106. package/src/shared/mcp/CopyBlock.tsx +42 -0
  107. package/src/shared/mcp/__tests__/ClaudeInstallLink.test.tsx +40 -0
  108. package/src/shared/mcp/__tests__/connect-snippets.test.ts +431 -0
  109. package/src/shared/mcp/__tests__/useCopyFeedback.test.ts +112 -0
  110. package/src/shared/mcp/connect-snippets.ts +353 -0
  111. package/src/shared/mcp/index.ts +28 -0
  112. package/src/shared/mcp/useCopyFeedback.ts +46 -0
  113. package/src/test-setup.ts +11 -0
@@ -0,0 +1,195 @@
1
+ import { useEffect, useState } from 'react';
2
+ import { useNavigate } from 'react-router-dom';
3
+ import { DEFAULT_BRANCH, PLUGINS_DIR, type FileTreeEntry } from '@bevel-software/platform-shared';
4
+ import { Button } from '../../../shared/components';
5
+ import { listFiles } from '../../workspace/services/workspace.api';
6
+ import { useWorkspace } from '../../workspace/state/workspace.context';
7
+ import { findKbRoot } from '../../workspace/utils/fileTree';
8
+ import { kbFileUrl } from '../../workspace/routing/kb-routes';
9
+
10
+ /**
11
+ * The plugin page's two smallest sections, both pure REUSE of the Knowledge
12
+ * surface: links are `kbFileUrl` + `rawFile` navigations into the same raw
13
+ * editor the tool page's "Edit the tool file" uses — no new viewer, no new
14
+ * backend. The one exception is a `.tool` file in a namespace listing, which
15
+ * drops the `rawFile` state so the app gate renders its library tool page —
16
+ * the same destination its card in the Tools band reaches.
17
+ *
18
+ * MANIFEST: writers get a button to `plugin.json`. It is a button to the FILE,
19
+ * not a form, deliberately: the fields worth hand-editing (`version`,
20
+ * `description`, `license`) are plain JSON, and the `extensions` block is
21
+ * machine-written by the server editor — a bespoke form would either duplicate
22
+ * that editor or invite hand-edits it then overwrites.
23
+ *
24
+ * EXTENSIONS: the spec reserves reverse-DNS directories for client-specific
25
+ * data any other client must ignore — which cuts both ways: a plugin authored
26
+ * for ANOTHER client can carry `com.example.client/`, and this section is how
27
+ * a person inspects one instead of wondering what it is. Our own namespace's
28
+ * `tools/` contents already appear in the Tools band above, so entries here
29
+ * are typically foreign — exactly when looking inside matters.
30
+ */
31
+
32
+ /** A reverse-DNS namespace directory: at least one dot, per the spec's shape. */
33
+ const isNamespaceDir = (name: string): boolean => name.includes('.');
34
+
35
+ export function ManifestButton({
36
+ kbDirName,
37
+ folder,
38
+ canWrite,
39
+ }: {
40
+ kbDirName: string | null;
41
+ folder: string;
42
+ canWrite: boolean;
43
+ }) {
44
+ const navigate = useNavigate();
45
+ if (!canWrite || !kbDirName) return null;
46
+ return (
47
+ <Button
48
+ variant="quiet"
49
+ size="sm"
50
+ onClick={() =>
51
+ navigate(kbFileUrl(DEFAULT_BRANCH, `${kbDirName}/${PLUGINS_DIR}/${folder}/plugin.json`), {
52
+ state: { rawFile: true },
53
+ })
54
+ }
55
+ >
56
+ Manifest
57
+ </Button>
58
+ );
59
+ }
60
+
61
+ interface NamespaceListing {
62
+ namespace: string;
63
+ files: string[]; // plugin-relative, e.g. `com.example.client/hooks/on-save.js`
64
+ }
65
+
66
+ export function ClientExtensionsSection({
67
+ kbDirName,
68
+ folder,
69
+ }: {
70
+ kbDirName: string | null;
71
+ folder: string;
72
+ }) {
73
+ // LISTING and LINKS must agree on a branch. The links are pinned to the
74
+ // default branch (plugins are default-branch content), so the tree read is
75
+ // too — the context's workspace may sit on a draft branch, and a listing
76
+ // from there would render files these links then cannot open. Workspace id
77
+ // IS the encoded branch, by the platform's own contract.
78
+ const workspaceId = encodeURIComponent(DEFAULT_BRANCH);
79
+ const navigate = useNavigate();
80
+ const { workspaceId: contextWorkspaceId, fileTree: contextTree } = useWorkspace();
81
+ const [listings, setListings] = useState<NamespaceListing[]>([]);
82
+
83
+ // The workspace context has usually ALREADY loaded this exact tree — it
84
+ // bootstraps on the default branch — so the common case must not pay a
85
+ // second full-tree round-trip per page view. The fetch survives only for
86
+ // the case the reuse cannot cover: a context sitting on a draft branch,
87
+ // whose tree could list files these default-branch links cannot open.
88
+ // The reused tree is as stale as the context's — which is the freshness
89
+ // the file explorer beside this page renders from, deliberately: one
90
+ // section refetching on its own would show files the tree next to it
91
+ // doesn't, and the context refresh cycle is where staleness is fixed.
92
+ const reusableTree = contextWorkspaceId === workspaceId ? contextTree : null;
93
+
94
+ useEffect(() => {
95
+ // Reset FIRST: on a folder change or a failed refetch, stale state would
96
+ // keep rendering the previous plugin's files under the new plugin's name.
97
+ setListings([]);
98
+ if (!kbDirName) return;
99
+ if (reusableTree) {
100
+ setListings(namespaceListings(reusableTree, folder));
101
+ return;
102
+ }
103
+ let live = true;
104
+ listFiles(workspaceId)
105
+ .then((tree) => {
106
+ if (live) setListings(namespaceListings(tree, folder));
107
+ })
108
+ .catch(() => {
109
+ /* the section renders nothing — a tree fetch failure is not this page's story */
110
+ });
111
+ return () => {
112
+ live = false;
113
+ };
114
+ }, [workspaceId, kbDirName, folder, reusableTree]);
115
+
116
+ if (listings.length === 0) return null;
117
+
118
+ return (
119
+ <section className="mt-8">
120
+ <h2 className="mb-2.5 text-label font-semibold uppercase text-ink-faint">
121
+ Client-specific extensions
122
+ </h2>
123
+ <p className="mb-2 max-w-[62ch] text-detail text-ink-muted">
124
+ Reverse-DNS directories carry data for a specific client; other clients ignore them. Files
125
+ open in the Knowledge editor; a .tool opens its tool page.
126
+ </p>
127
+ {listings.map((l) => (
128
+ <div key={l.namespace} className="mb-2 rounded-md border border-line px-3.5 py-2.5">
129
+ <p className="font-mono text-detail font-semibold text-ink">{l.namespace}/</p>
130
+ <ul className="mt-1">
131
+ {l.files.map((f) => (
132
+ <li key={f}>
133
+ <button
134
+ type="button"
135
+ className="cursor-pointer font-mono text-detail text-ink-muted hover:text-ink hover:underline"
136
+ onClick={() =>
137
+ // `rawFile` steps past the app gate into the Knowledge
138
+ // editor — right for opaque client data (hooks, configs),
139
+ // wrong for a `.tool`: that file has a first-class tool
140
+ // page, and the same URL without the state renders it
141
+ // here in the library, exactly like its card above.
142
+ navigate(
143
+ kbFileUrl(DEFAULT_BRANCH, `${kbDirName}/${PLUGINS_DIR}/${folder}/${f}`),
144
+ f.toLowerCase().endsWith('.tool') ? undefined : { state: { rawFile: true } },
145
+ )
146
+ }
147
+ >
148
+ {f.slice(l.namespace.length + 1)}
149
+ </button>
150
+ </li>
151
+ ))}
152
+ </ul>
153
+ </div>
154
+ ))}
155
+ </section>
156
+ );
157
+ }
158
+
159
+ /**
160
+ * Walk the (already-loaded, ACL-filtered) tree down to this plugin's namespace
161
+ * dirs. Through `findKbRoot`, not `[kbDirName, …]` from the literal root: the
162
+ * fileTree can carry workspace/KB-clone wrapper levels above the kb dir, and
163
+ * that helper is how the rest of the codebase reaches the well-known root
164
+ * dirs regardless.
165
+ */
166
+ function namespaceListings(tree: FileTreeEntry, folder: string): NamespaceListing[] {
167
+ const kbRoot = findKbRoot(tree);
168
+ const pluginDir = kbRoot ? descend(kbRoot, [PLUGINS_DIR, folder]) : null;
169
+ if (!pluginDir?.children) return [];
170
+ const out: NamespaceListing[] = [];
171
+ for (const child of pluginDir.children) {
172
+ if (child.type !== 'directory' || !isNamespaceDir(child.name)) continue;
173
+ const files: string[] = [];
174
+ collectFiles(child, child.name, files);
175
+ if (files.length > 0) out.push({ namespace: child.name, files: files.sort() });
176
+ }
177
+ return out.sort((a, b) => a.namespace.localeCompare(b.namespace));
178
+ }
179
+
180
+ function descend(tree: FileTreeEntry, segments: string[]): FileTreeEntry | null {
181
+ let node: FileTreeEntry | undefined = tree;
182
+ for (const segment of segments) {
183
+ node = node?.children?.find((c) => c.name === segment);
184
+ if (!node) return null;
185
+ }
186
+ return node ?? null;
187
+ }
188
+
189
+ function collectFiles(node: FileTreeEntry, prefix: string, out: string[]): void {
190
+ for (const child of node.children ?? []) {
191
+ const rel = `${prefix}/${child.name}`;
192
+ if (child.type === 'directory') collectFiles(child, rel, out);
193
+ else out.push(rel);
194
+ }
195
+ }
@@ -1,7 +1,7 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import { ListRow } from '../../../shared/components';
3
3
 
4
- export interface GroupIndexRowProps {
4
+ export interface PluginIndexRowProps {
5
5
  label: string;
6
6
  /** Inline with the label — the `Owner` chip. */
7
7
  badge?: ReactNode;
@@ -9,8 +9,8 @@ export interface GroupIndexRowProps {
9
9
  /** Right-aligned counts, e.g. `4 skills · 2 tools`. */
10
10
  meta?: string;
11
11
  /**
12
- * After the counts: the amber attention count on a group you are in, or —
13
- * on an "Ask to join" row — the `Locked` chip, which becomes `Requested`
12
+ * After the counts: the amber attention count on a plugin you are in, or —
13
+ * on a "Request access" row — the `Locked` chip, which becomes `Requested`
14
14
  * once the caller has a pending access request. A slot rather than a
15
15
  * boolean, which is why those three states cost this file nothing.
16
16
  */
@@ -19,21 +19,21 @@ export interface GroupIndexRowProps {
19
19
  }
20
20
 
21
21
  /**
22
- * One row on the all-groups index — a group, or one of the two personal views.
22
+ * One row on the all-plugins index — a plugin, or one of the two personal views.
23
23
  *
24
24
  * The whole row is the target, which is why it is a `<button>` and not a card
25
25
  * with a link inside it: every row here means exactly one thing, "go there".
26
26
  * Counts live in `meta` as plain text so the row's accessible name reads as the
27
27
  * sentence it looks like ("GTM Run by Olga Ivanova 4 skills · 2 tools").
28
28
  */
29
- export function GroupIndexRow({
29
+ export function PluginIndexRow({
30
30
  label,
31
31
  badge,
32
32
  description,
33
33
  meta,
34
34
  trailing,
35
35
  onOpen,
36
- }: GroupIndexRowProps) {
36
+ }: PluginIndexRowProps) {
37
37
  return (
38
38
  <ListRow
39
39
  as="button"
@@ -3,19 +3,19 @@ import { useJoinRequests } from '../hooks/useJoinRequests';
3
3
  import { AccessRequestsBanner } from './AccessRequestsBanner';
4
4
 
5
5
  /**
6
- * One group's join requests, fetching their own data.
6
+ * One plugin's join requests, fetching their own data.
7
7
  *
8
8
  * A component rather than a hook call in each page because the gallery shows
9
- * a banner per group the caller manages, and a hook cannot be called in a
10
- * loop. Rendering one of these per group keeps that legal and gives the group
9
+ * a banner per plugin the caller manages, and a hook cannot be called in a
10
+ * loop. Rendering one of these per plugin keeps that legal and gives the plugin
11
11
  * page the identical surface for free.
12
12
  *
13
- * Render it only for groups the caller MANAGES: the endpoint answers `[]` to
13
+ * Render it only for plugins the caller MANAGES: the endpoint answers `[]` to
14
14
  * everyone else, so an ungated render is harmless but pointlessly chatty.
15
15
  */
16
- export interface GroupJoinRequestsProps {
17
- group: string;
18
- /** The group's constituent folders — for the Manage-access affordance. */
16
+ export interface PluginJoinRequestsProps {
17
+ plugin: string;
18
+ /** The plugin's constituent folders — for the Manage-access affordance. */
19
19
  folders: string[];
20
20
  onManage(folder: string): void;
21
21
  /**
@@ -28,14 +28,14 @@ export interface GroupJoinRequestsProps {
28
28
  className?: string;
29
29
  }
30
30
 
31
- export function GroupJoinRequests({
32
- group,
31
+ export function PluginJoinRequests({
32
+ plugin,
33
33
  folders,
34
34
  onManage,
35
35
  reloadSignal = 0,
36
36
  className,
37
- }: GroupJoinRequestsProps) {
38
- const requests = useJoinRequests(group, folders[0] ?? null);
37
+ }: PluginJoinRequestsProps) {
38
+ const requests = useJoinRequests(plugin, folders[0] ?? null);
39
39
  const { reload } = requests;
40
40
 
41
41
  useEffect(() => {
@@ -44,7 +44,7 @@ export function GroupJoinRequests({
44
44
 
45
45
  return (
46
46
  <AccessRequestsBanner
47
- group={group}
47
+ plugin={plugin}
48
48
  folders={folders}
49
49
  requests={requests.requests}
50
50
  onManage={onManage}
@@ -4,43 +4,44 @@ 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
- decodeGroupSegment,
8
- pathForGroupsIndex,
7
+ decodePluginSegment,
8
+ pathForPluginsIndex,
9
9
  urlForItemFile,
10
10
  } from '../routes/library-paths';
11
- import { primaryFolderOf } from '../utils/group-summary';
12
- import { GroupJoinRequests } from './GroupJoinRequests';
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 { AddToGroupDialog } from './AddToGroupDialog';
16
- import { BandControls, GroupBreadcrumb, GroupItemSections, PageNote, RemoveLibraryItemDialog,
17
- } from './group-page-parts';
18
- import { DeleteGroupDialog } from './DeleteGroupDialog';
16
+ import { AddToPluginDialog } from './AddToPluginDialog';
17
+ import { BandControls, PluginBreadcrumb, PluginItemSections, PageNote, RemoveLibraryItemDialog,
18
+ } from './plugin-page-parts';
19
+ import { DeletePluginDialog } from './DeletePluginDialog';
19
20
  import { PageActions } from './PageActions';
20
21
  import { copyToClipboard } from '../utils/clipboard';
21
- import { LockedGroupView } from './LockedGroupView';
22
+ import { LockedPluginView } from './LockedPluginView';
22
23
  import { PendingSkillReview } from './PendingSkillReview';
23
24
 
24
25
  /**
25
- * One group, as a place: `/skills-and-tools/groups/:group`.
26
+ * One plugin, as a place: `/skills-and-tools/plugins/:plugin`.
26
27
  *
27
- * A group is a KB folder, so this page is the folder made legible — its skills
28
+ * A plugin is a KB folder, so this page is the folder made legible — its skills
28
29
  * and the tools those skills need, side by side, with who runs it and who it is
29
30
  * shared with in one line above them. The sidebar and the gallery could already
30
- * FILTER to a group; what they could not do is be linked to, bookmarked, or
31
+ * FILTER to a plugin; what they could not do is be linked to, bookmarked, or
31
32
  * handed to somebody. That is the whole difference this page makes.
32
33
  *
33
34
  * WHICH VIEW: the page decides member-vs-locked, not the router and not the
34
35
  * sidebar. The member view renders when the folder verdict says `canRead`, OR
35
- * when the caller's catalog already contains an item in the group (a per-file
36
+ * when the caller's catalog already contains an item in the plugin (a per-file
36
37
  * grant can hand somebody one skill inside a folder they cannot read). Locked
37
38
  * means: the summary says no AND the catalog agrees — which can only happen
38
- * for a DISCOVERABLE group, because an undiscoverable one never reaches this
39
+ * for a DISCOVERABLE plugin, because an undiscoverable one never reaches this
39
40
  * page's data at all and renders like one that does not exist.
40
41
  */
41
- export function GroupPage() {
42
+ export function PluginPage() {
42
43
  const params = useParams();
43
- const group = decodeGroupSegment(params.group ?? '');
44
+ const plugin = decodePluginSegment(params.plugin ?? '');
44
45
  const data = useLibrary();
45
46
  const toast = useLibraryToast();
46
47
  const navigate = useNavigate();
@@ -75,13 +76,13 @@ export function GroupPage() {
75
76
  * loads are settled" is also true of the instant BEFORE the refetch starts,
76
77
  * and of an unrelated load that was already in flight settling first. So the
77
78
  * spin only ends on a settle that FOLLOWS a loading phase this click caused.
78
- * `reloadGroups()` raises `groupsLoading` synchronously, so that phase is
79
+ * `reloadPlugins()` raises `pluginsLoading` synchronously, so that phase is
79
80
  * guaranteed to be observed — and if it somehow were not, the button keeps
80
81
  * spinning, which is the failure worth having.
81
82
  */
82
83
  const sawLoading = useRef(false);
83
84
  const spinning = refreshState === 'spin';
84
- const loadsSettled = !data.loading && !data.groupsLoading;
85
+ const loadsSettled = !data.loading && !data.pluginsLoading;
85
86
  useEffect(() => {
86
87
  if (!spinning) return;
87
88
  if (!loadsSettled) {
@@ -90,8 +91,8 @@ export function GroupPage() {
90
91
  }
91
92
  if (!sawLoading.current) return;
92
93
  sawLoading.current = false;
93
- setRefreshState(data.error || data.groupsError ? 'idle' : 'done');
94
- }, [spinning, loadsSettled, data.error, data.groupsError]);
94
+ setRefreshState(data.error || data.pluginsError ? 'idle' : 'done');
95
+ }, [spinning, loadsSettled, data.error, data.pluginsError]);
95
96
 
96
97
  // The freshness line decays on its own — that one IS a clock, and it is the
97
98
  // only timer left. Cleared on unmount rather than left to fire into a
@@ -104,16 +105,16 @@ export function GroupPage() {
104
105
 
105
106
  /** The card being removed, while its confirm dialog is up. */
106
107
  const [removing, setRemoving] = useState<LibraryItem | null>(null);
107
- /** Whether the group's own delete confirmation is up. */
108
+ /** Whether the plugin's own delete confirmation is up. */
108
109
  const [deleteOpen, setDeleteOpen] = useState(false);
109
110
 
110
111
  const summary = useMemo(
111
- () => data.groupSummaries.find((g) => g.name === group) ?? null,
112
- [data.groupSummaries, group],
112
+ () => data.pluginSummaries.find((g) => g.name === plugin) ?? null,
113
+ [data.pluginSummaries, plugin],
113
114
  );
114
- const groupItems = useMemo(
115
- () => data.items.filter((i) => i.group === group),
116
- [data.items, group],
115
+ const pluginItems = useMemo(
116
+ () => data.items.filter((i) => i.plugin === plugin),
117
+ [data.items, plugin],
117
118
  );
118
119
  /** For the add dialog's name check — global, because a skill's id is global. */
119
120
  const allSkillNames = useMemo(
@@ -121,9 +122,9 @@ export function GroupPage() {
121
122
  [data.items],
122
123
  );
123
124
 
124
- const skillItems = groupItems.filter((i) => i.kind === 'skill');
125
- const toolItems = groupItems.filter((i) => i.kind === 'integration');
126
- const attention = attentionOf(data.items, group);
125
+ const skillItems = pluginItems.filter((i) => i.kind === 'skill');
126
+ const toolItems = pluginItems.filter((i) => i.kind === 'integration');
127
+ const attention = attentionOf(data.items, plugin);
127
128
  // What the Skills band actually renders. The filter is a VIEW over the band,
128
129
  // not a different query — flipping it back must show exactly what was there.
129
130
  const shownSkills = filterOn ? skillItems.filter((i) => i.status.state !== 'ok') : skillItems;
@@ -166,29 +167,29 @@ export function GroupPage() {
166
167
  setManageFolder(null);
167
168
  // Granting through the dialog can settle a pending join request —
168
169
  // refresh the roster, the catalog and the request surface together.
169
- data.reloadGroups();
170
+ data.reloadPlugins();
170
171
  data.reload();
171
172
  setAccessRevision((r) => r + 1);
172
173
  }}
173
174
  />
174
175
  ) : null;
175
176
 
176
- // Nothing has spoken yet: the catalog is still loading, the group index is
177
- // still loading, and no item has proven the group exists. Deciding now would
177
+ // Nothing has spoken yet: the catalog is still loading, the plugin index is
178
+ // still loading, and no item has proven the plugin exists. Deciding now would
178
179
  // flash "doesn't exist" (or a locked splash) at somebody who is simply early.
179
- if (groupItems.length === 0 && (data.loading || data.groupsLoading)) {
180
+ if (pluginItems.length === 0 && (data.loading || data.pluginsLoading)) {
180
181
  return <PageNote>Loading the library…</PageNote>;
181
182
  }
182
183
 
183
- if (summary && !summary.canRead && groupItems.length === 0) {
184
+ if (summary && !summary.canRead && pluginItems.length === 0) {
184
185
  return (
185
186
  <>
186
- <LockedGroupView
187
- group={summary}
188
- onRequested={data.reloadGroups}
187
+ <LockedPluginView
188
+ plugin={summary}
189
+ onRequested={data.reloadPlugins}
189
190
  onUnlocked={() => {
190
191
  data.reload();
191
- data.reloadGroups();
192
+ data.reloadPlugins();
192
193
  }}
193
194
  onManage={setManageFolder}
194
195
  />
@@ -197,18 +198,18 @@ export function GroupPage() {
197
198
  );
198
199
  }
199
200
 
200
- // No summary, no items, and the endpoint did NOT fail — the group really is
201
+ // No summary, no items, and the endpoint did NOT fail — the plugin really is
201
202
  // not there. With a failed endpoint the honest answer is the degraded member
202
203
  // view below, because "we couldn't ask" is not "it doesn't exist".
203
- if (!summary && groupItems.length === 0 && !data.groupsError) {
204
+ if (!summary && pluginItems.length === 0 && !data.pluginsError) {
204
205
  return (
205
206
  <div className="py-16 text-center">
206
- <p className="text-ui text-ink-faint">{"This group doesn't exist yet."}</p>
207
+ <p className="text-ui text-ink-faint">{"This plugin doesn't exist yet."}</p>
207
208
  <Link
208
- to={pathForGroupsIndex()}
209
+ to={pathForPluginsIndex()}
209
210
  className="mt-2 inline-block rounded-xs text-ui font-semibold text-ink underline"
210
211
  >
211
- All groups
212
+ All plugins
212
213
  </Link>
213
214
  </div>
214
215
  );
@@ -218,7 +219,7 @@ export function GroupPage() {
218
219
 
219
220
  return (
220
221
  <div className="pb-14">
221
- <GroupBreadcrumb name={group} />
222
+ <PluginBreadcrumb name={plugin} />
222
223
 
223
224
  {/* The title row carries the page's one persistent action. `Share` IS
224
225
  the manage-access dialog — not a doorway to it. It stays un-gated:
@@ -229,8 +230,9 @@ export function GroupPage() {
229
230
  Share stays un-gated: for a non-writer the dialog renders read-only,
230
231
  which is exactly what "who is this shared with?" should answer. */}
231
232
  <div className="flex items-start justify-between gap-4">
232
- <h1 className="mt-1.5 text-display font-semibold">{group}</h1>
233
- <div className="mt-1.5">
233
+ <h1 className="mt-1.5 text-display font-semibold">{plugin}</h1>
234
+ <div className="mt-1.5 flex items-center gap-1">
235
+ <ManifestButton kbDirName={kbDirName} folder={plugin} canWrite={summary?.canWrite === true} />
234
236
  <PageActions
235
237
  onShare={primaryFolder ? () => setManageFolder(primaryFolder) : undefined}
236
238
  onAdd={() => setAddOpen(true)}
@@ -239,17 +241,17 @@ export function GroupPage() {
239
241
  // route enforces, so the item appears for exactly the people the
240
242
  // backend will let through.
241
243
  onDelete={summary?.isOwner ? () => setDeleteOpen(true) : undefined}
242
- addLabel={`Add a skill or tool to ${group}`}
244
+ addLabel={`Add a skill or tool to ${plugin}`}
243
245
  />
244
246
  </div>
245
247
  </div>
246
248
 
247
249
  {/* Somebody is waiting on the person reading this. Rendered only for a
248
- group manager (canWrite) — every member can see the CRs elsewhere,
250
+ plugin manager (canWrite) — every member can see the CRs elsewhere,
249
251
  but only the people who can act on a request get its banner. */}
250
252
  {summary?.canWrite && (
251
- <GroupJoinRequests
252
- group={group}
253
+ <PluginJoinRequests
254
+ plugin={plugin}
253
255
  folders={summary.folders}
254
256
  onManage={setManageFolder}
255
257
  reloadSignal={accessRevision}
@@ -264,7 +266,7 @@ export function GroupPage() {
264
266
  attention === 1
265
267
  ? 'integration needs setup: connect it'
266
268
  : 'integrations need setup: connect them'
267
- } to unblock this group's skills.`}
269
+ } to unblock this plugin's skills.`}
268
270
  </span>{' '}
269
271
  <Button variant="outline" size="tiny" onClick={() => navigate('/connect')}>
270
272
  Finish setup
@@ -272,18 +274,18 @@ export function GroupPage() {
272
274
  </Banner>
273
275
  )}
274
276
 
275
- <GroupItemSections
277
+ <PluginItemSections
276
278
  skillItems={shownSkills}
277
279
  toolItems={toolItems}
278
280
  onOpen={openItem}
279
- // Removal is the GROUP MANAGER's verb — the same canWrite that lets
281
+ // Removal is the PLUGIN MANAGER's verb — the same canWrite that lets
280
282
  // them answer join requests. The backend's per-path gate enforces it
281
283
  // for real; this only decides who sees the affordance.
282
284
  onRemove={summary?.canWrite ? setRemoving : undefined}
283
285
  emptySkills={
284
286
  filterOn
285
287
  ? 'Nothing in this band needs you right now.'
286
- : `No skills yet. Add one, or ask your agent to write one for ${group}.`
288
+ : `No skills yet. Add one, or ask your agent to write one for ${plugin}.`
287
289
  }
288
290
  // The band fades its controls until you hover it, and `opacity`
289
291
  // composites — so "the filter stays lit when it is on" has to be said
@@ -300,7 +302,7 @@ export function GroupPage() {
300
302
  sawLoading.current = false;
301
303
  setRefreshState('spin');
302
304
  data.reload();
303
- data.reloadGroups();
305
+ data.reloadPlugins();
304
306
  }}
305
307
  />
306
308
  }
@@ -313,19 +315,19 @@ export function GroupPage() {
313
315
  onResolved={() => {
314
316
  setReviewing(null);
315
317
  // One reload moves it off the review shelf and into the catalog;
316
- // the group index follows because its skill count just changed.
318
+ // the plugin index follows because its skill count just changed.
317
319
  data.reload();
318
- data.reloadGroups();
320
+ data.reloadPlugins();
319
321
  }}
320
322
  />
321
323
  )}
322
324
 
323
325
  {addOpen && summary && primaryFolder && (
324
- <AddToGroupDialog
325
- name={group}
326
+ <AddToPluginDialog
327
+ name={plugin}
326
328
  primaryPath={primaryFolder}
327
329
  canWrite={summary.canWrite}
328
- // Every skill, not just this group's: a skill's id is its name and
330
+ // Every skill, not just this plugin's: a skill's id is its name and
329
331
  // ids are global, so the collision that matters is with any of them.
330
332
  existingSkills={allSkillNames}
331
333
  onClose={() => setAddOpen(false)}
@@ -333,18 +335,18 @@ export function GroupPage() {
333
335
  )}
334
336
 
335
337
  {deleteOpen && summary && (
336
- <DeleteGroupDialog
337
- name={group}
338
+ <DeletePluginDialog
339
+ name={plugin}
338
340
  skillCount={summary.skillCount}
339
341
  toolCount={summary.toolCount}
340
342
  onClose={() => setDeleteOpen(false)}
341
343
  onDeleted={() => {
342
- toast(`Deleted ${group}.`);
344
+ toast(`Deleted ${plugin}.`);
343
345
  // This page's place just ceased to exist — the index is the
344
346
  // honest landing. Reloads follow so the sidebar agrees.
345
- navigate(pathForGroupsIndex());
347
+ navigate(pathForPluginsIndex());
346
348
  data.reload();
347
- data.reloadGroups();
349
+ data.reloadPlugins();
348
350
  }}
349
351
  />
350
352
  )}
@@ -352,17 +354,18 @@ export function GroupPage() {
352
354
  {removing && (
353
355
  <RemoveLibraryItemDialog
354
356
  item={removing}
355
- place={group}
357
+ place={plugin}
356
358
  onClose={() => setRemoving(null)}
357
359
  onRemoved={() => {
358
- toast(`Removed ${removing.name} from ${group}.`);
359
- // Catalog for the card, group index for the counts.
360
+ toast(`Removed ${removing.name} from ${plugin}.`);
361
+ // Catalog for the card, plugin index for the counts.
360
362
  data.reload();
361
- data.reloadGroups();
363
+ data.reloadPlugins();
362
364
  }}
363
365
  />
364
366
  )}
365
367
 
368
+ <ClientExtensionsSection kbDirName={kbDirName} folder={plugin} />
366
369
  {manageDialog}
367
370
  </div>
368
371
  );