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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -2,105 +2,105 @@ import { authFetch } from '../../../lib/api';
2
2
  import { handleApiResponse } from '../../git/services/git.api';
3
3
 
4
4
  /**
5
- * Group enumeration + join requests — the browser half of the backend's
6
- * `modules/groups`.
5
+ * Plugin enumeration + join requests — the browser half of the backend's
6
+ * `modules/plugins`.
7
7
  *
8
8
  * Enumeration is fail-closed with three ordinary access verdicts: a listed
9
- * group is one the caller is a MEMBER of (`canRead`), MANAGES (`canWrite`,
10
- * admin-rescued), or may DISCOVER (they can read the group's `access.md`
11
- * file — granted by its own `read: everyone` frontmatter). A group with no
9
+ * plugin is one the caller is a MEMBER of (`canRead`), MANAGES (`canWrite`,
10
+ * admin-rescued), or may DISCOVER (they can read the plugin's `access.md`
11
+ * file — granted by its own `read: everyone` frontmatter). A plugin with no
12
12
  * verdict is absent. Asking to join opens a plain change request; nothing
13
13
  * request-shaped is stored anywhere else.
14
14
  *
15
- * Every type below MIRRORS the backend contract (`groups.contract.ts`). Keep
15
+ * Every type below MIRRORS the backend contract (`plugins.contract.ts`). Keep
16
16
  * them in step.
17
17
  */
18
18
 
19
- export interface GroupPrincipals {
19
+ export interface PluginPrincipals {
20
20
  roles: string[];
21
21
  users: { name: string; email: string }[];
22
22
  }
23
23
 
24
- export interface GroupReaders extends GroupPrincipals {
24
+ export interface PluginReaders extends PluginPrincipals {
25
25
  /** False when `read: everyone` applies cleanly (the lists are then empty). */
26
26
  restricted: boolean;
27
27
  }
28
28
 
29
- export interface GroupSummary {
30
- /** Group folder name, e.g. `GTM`. */
29
+ export interface PluginSummary {
30
+ /** Plugin folder name, e.g. `GTM`. */
31
31
  name: string;
32
- /** Repo-relative constituent folders, e.g. `['Groups/GTM']`. */
32
+ /** Repo-relative constituent folders, e.g. `['Plugins/GTM']`. */
33
33
  folders: string[];
34
34
  /** Per-caller: can read the folder (membership). Locked === !canRead. */
35
35
  canRead: boolean;
36
- /** Per-caller; true ⇒ may manage the group's access (admin-rescue applies). */
36
+ /** Per-caller; true ⇒ may manage the plugin's access (admin-rescue applies). */
37
37
  canWrite: boolean;
38
38
  /**
39
39
  * Per-caller: holds the `owner` verb on the folder (owner-lists only, no
40
- * admin rescue). Deleting the group is the owner's verb — the DELETE route
40
+ * admin rescue). Deleting the plugin is the owner's verb — the DELETE route
41
41
  * enforces this same verdict, so it also decides who sees the affordance.
42
42
  */
43
43
  isOwner: boolean;
44
- /** The group's TOTALS, not the caller's slice. */
44
+ /** The plugin's TOTALS, not the caller's slice. */
45
45
  skillCount: number;
46
46
  toolCount: number;
47
- owners: GroupPrincipals;
48
- writers: GroupPrincipals;
49
- readers: GroupReaders;
50
- /** The caller has an OPEN join change request for this group. */
47
+ owners: PluginPrincipals;
48
+ writers: PluginPrincipals;
49
+ readers: PluginReaders;
50
+ /** The caller has an OPEN join change request for this plugin. */
51
51
  hasRequested: boolean;
52
52
  /** That CR's number when `hasRequested` (deep-links the review UI). */
53
53
  requestNumber: number | null;
54
54
  }
55
55
 
56
- export async function listGroups(): Promise<GroupSummary[]> {
57
- const res = await authFetch('/api/groups');
58
- if (!res.ok) throw new Error("Couldn't load groups.");
59
- const data = (await res.json()) as { groups: GroupSummary[] };
60
- return data.groups;
56
+ export async function listPlugins(): Promise<PluginSummary[]> {
57
+ const res = await authFetch('/api/plugins');
58
+ if (!res.ok) throw new Error("Couldn't load plugins.");
59
+ const data = (await res.json()) as { plugins: PluginSummary[] };
60
+ return data.plugins;
61
61
  }
62
62
 
63
63
  /**
64
- * Create a group — the dedicated provisioning endpoint, not a workspace
64
+ * Create a plugin — the dedicated provisioning endpoint, not a workspace
65
65
  * write. The server owns name validation and the collision verdict (its
66
66
  * check is against the live tree, ours against a stale catalog), commits the
67
67
  * seeded `access.md` before answering, and refuses with its own words —
68
68
  * worth surfacing verbatim.
69
69
  */
70
- export async function createGroup(name: string): Promise<{ folder: string }> {
71
- const res = await authFetch('/api/groups', {
70
+ export async function createPlugin(name: string): Promise<{ folder: string }> {
71
+ const res = await authFetch('/api/plugins', {
72
72
  method: 'POST',
73
73
  headers: { 'Content-Type': 'application/json' },
74
74
  body: JSON.stringify({ name }),
75
75
  });
76
76
  if (!res.ok) {
77
77
  const body = (await res.json().catch(() => ({}))) as { error?: string };
78
- throw new Error(body.error ?? "Couldn't create that group.");
78
+ throw new Error(body.error ?? "Couldn't create that plugin.");
79
79
  }
80
80
  return (await res.json()) as { folder: string };
81
81
  }
82
82
 
83
83
  /**
84
- * Delete a group — the whole folder, skills and tools included, in one
84
+ * Delete a plugin — the whole folder, skills and tools included, in one
85
85
  * commit. Owner-gated server-side (the `owner` verdict on the folder); a
86
86
  * refusal names the rule and is worth surfacing verbatim. Fail-closed: a
87
- * group the caller doesn't own answers exactly like one that doesn't exist.
87
+ * plugin the caller doesn't own answers exactly like one that doesn't exist.
88
88
  */
89
- export async function deleteGroup(name: string): Promise<void> {
90
- const res = await authFetch(`/api/groups/${encodeURIComponent(name)}`, { method: 'DELETE' });
89
+ export async function deletePlugin(name: string): Promise<void> {
90
+ const res = await authFetch(`/api/plugins/${encodeURIComponent(name)}`, { method: 'DELETE' });
91
91
  if (!res.ok) {
92
92
  const body = (await res.json().catch(() => ({}))) as { error?: string };
93
- throw new Error(body.error ?? "Couldn't delete that group.");
93
+ throw new Error(body.error ?? "Couldn't delete that plugin.");
94
94
  }
95
95
  }
96
96
 
97
97
  /**
98
- * Ensure the caller's personal folder (`Groups/personal-<id>/`) exists.
98
+ * Ensure the caller's personal folder (`Plugins/personal-<id>/`) exists.
99
99
  * Idempotent; the server answers only after the folder's access.md is
100
100
  * COMMITTED, so a write into the folder may follow immediately.
101
101
  */
102
- export async function ensurePersonalGroup(): Promise<{ folder: string; created: boolean }> {
103
- const res = await authFetch('/api/groups/personal', { method: 'POST' });
102
+ export async function ensurePersonalPlugin(): Promise<{ folder: string; created: boolean }> {
103
+ const res = await authFetch('/api/plugins/personal', { method: 'POST' });
104
104
  if (!res.ok) {
105
105
  const body = (await res.json().catch(() => ({}))) as { error?: string };
106
106
  throw new Error(body.error ?? "Couldn't prepare your personal folder.");
@@ -111,18 +111,18 @@ export async function ensurePersonalGroup(): Promise<{ folder: string; created:
111
111
  /**
112
112
  * Thrown when a join request is refused because access already landed —
113
113
  * between the page load and the click. Not an error to show: the right
114
- * response is to reload the library and let the group appear unlocked.
114
+ * response is to reload the library and let the plugin appear unlocked.
115
115
  */
116
116
  export class AlreadyReadableError extends Error {
117
117
  constructor() {
118
- super('You can already read this group');
118
+ super('You can already read this plugin');
119
119
  this.name = 'AlreadyReadableError';
120
120
  }
121
121
  }
122
122
 
123
123
  /** Open (or return the existing) join change request. Idempotent server-side. */
124
- export async function requestGroupAccess(name: string): Promise<{ number: number }> {
125
- const res = await authFetch(`/api/groups/${encodeURIComponent(name)}/join-request`, {
124
+ export async function requestPluginAccess(name: string): Promise<{ number: number }> {
125
+ const res = await authFetch(`/api/plugins/${encodeURIComponent(name)}/join-request`, {
126
126
  method: 'POST',
127
127
  });
128
128
  if (res.status === 409) {
@@ -162,13 +162,13 @@ export interface JoinRequest {
162
162
  }
163
163
 
164
164
  /**
165
- * Open join requests for a group the caller MANAGES, each with what it still
165
+ * Open join requests for a plugin the caller MANAGES, each with what it still
166
166
  * proposes. Non-managers get `[]` (never a 403), so the caller may ask
167
- * unconditionally — the same posture every other group surface takes.
167
+ * unconditionally — the same posture every other plugin surface takes.
168
168
  */
169
169
  export async function listJoinRequests(name: string): Promise<JoinRequest[]> {
170
170
  const data = await handleApiResponse<{ requests: JoinRequest[] }>(
171
- await authFetch(`/api/groups/${encodeURIComponent(name)}/join-requests`),
171
+ await authFetch(`/api/plugins/${encodeURIComponent(name)}/join-requests`),
172
172
  );
173
173
  return data.requests;
174
174
  }
@@ -181,7 +181,7 @@ export async function listJoinRequests(name: string): Promise<JoinRequest[]> {
181
181
  export async function reconcileJoinRequest(name: string, number: number): Promise<boolean> {
182
182
  const data = await handleApiResponse<{ closed: boolean }>(
183
183
  await authFetch(
184
- `/api/groups/${encodeURIComponent(name)}/join-requests/${number}/reconcile`,
184
+ `/api/plugins/${encodeURIComponent(name)}/join-requests/${number}/reconcile`,
185
185
  { method: 'POST' },
186
186
  ),
187
187
  );
@@ -58,3 +58,57 @@ export async function getToolDetail(slug: string): Promise<ToolManualDetail> {
58
58
  if (!res.ok) await unwrap(res, "Couldn't load this tool.");
59
59
  return ((await res.json()) as { tool: ToolManualDetail }).tool;
60
60
  }
61
+
62
+ /**
63
+ * The server-scoped view/edit surface for an mcp.json-backed tool. One
64
+ * server's truth spans two files (mcp.json + plugin.json's extensions block);
65
+ * these endpoints are the pair kept in step, so the form never shows a writer
66
+ * half of it. Absent (404) for `.tool`-backed manuals — those edit as files.
67
+ */
68
+ export type McpTransport = 'streamable-http' | 'sse' | 'stdio';
69
+
70
+ export interface McpServerView {
71
+ name: string;
72
+ transport: McpTransport;
73
+ url?: string;
74
+ command?: string;
75
+ args?: string[];
76
+ cwd?: string;
77
+ env?: Record<string, string>;
78
+ literalHeaders: Record<string, string>;
79
+ authHeaders: Record<string, string>;
80
+ variables: { name: string; scope: 'admin' | 'user'; label?: string }[];
81
+ description?: string;
82
+ local: boolean;
83
+ canWrite: boolean;
84
+ }
85
+
86
+ export type McpServerWrite = Omit<Partial<McpServerView>, 'name' | 'canWrite'> & {
87
+ transport: McpTransport;
88
+ newName?: string;
89
+ };
90
+
91
+ export async function getMcpServer(slug: string): Promise<McpServerView | null> {
92
+ const res = await authFetch(`/api/tools/${encodeURIComponent(slug)}/server`);
93
+ if (res.status === 404) {
94
+ // Two 404s share this status and only ONE is an absence: `Not found` is
95
+ // the expected no-server-pair case (a .tool-backed manual), while `Not
96
+ // available` means the edit service isn't wired at all — a deployment
97
+ // fault that must surface, not render as a quietly server-less page.
98
+ const body = (await res.json().catch(() => null)) as { error?: string } | null;
99
+ if (body?.error === 'Not found') return null;
100
+ throw new Error(body?.error ?? "Couldn't load the server configuration.");
101
+ }
102
+ if (!res.ok) await unwrap(res, "Couldn't load the server configuration.");
103
+ return (await res.json()) as McpServerView;
104
+ }
105
+
106
+ export async function putMcpServer(slug: string, write: McpServerWrite): Promise<{ name: string }> {
107
+ const res = await authFetch(`/api/tools/${encodeURIComponent(slug)}/server`, {
108
+ method: 'PUT',
109
+ headers: { 'Content-Type': 'application/json' },
110
+ body: JSON.stringify(write),
111
+ });
112
+ if (!res.ok) await unwrap(res, "Couldn't save the server configuration.");
113
+ return (await res.json()) as { name: string };
114
+ }
@@ -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 { groupOfPath, isPersonalGroupFolder } from '@bevel-software/platform-shared';
3
+ import { pluginOfPath, isPersonalPluginFolder } from '@bevel-software/platform-shared';
4
4
 
5
5
  /**
6
- * The group a card files under — with personal folders mapped to `null`, the
7
- * "yours alone" bucket. A personal folder (`Groups/personal-<id>/`) is where
8
- * a person's own skills live; it is a place, not a group, and the only
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 displayGroupOf(path: string): string | null {
13
- const group = groupOfPath(path);
14
- return group !== null && isPersonalGroupFolder(group) ? null : group;
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 { listGroups, type GroupSummary } from '../services/groups.api';
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 group pages, the
29
- * all-groups index — reads the SAME catalog, so it is fetched once here rather
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 group index (`GET /api/groups`), whose failure degrades to `[]` and is
38
- * reported through `groupsError` for the surfaces that want to say so.
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 group from the KB path, or null when the item is in none. */
50
- group: string | null;
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
- groupSummaries: GroupSummary[];
81
- groupsLoading: boolean;
82
- groupsError: string | null;
83
- reloadGroups(): void;
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 [groupSummaries, setGroupSummaries] = useState<GroupSummary[]>([]);
90
- const [groupsLoading, setGroupsLoading] = useState(true);
91
- const [groupsError, setGroupsError] = useState<string | null>(null);
92
- const [groupsRevision, setGroupsRevision] = useState(0);
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
- listGroups()
97
- .then((groups) => {
96
+ listPlugins()
97
+ .then((plugins) => {
98
98
  if (cancelled) return;
99
- setGroupSummaries(groups);
100
- setGroupsError(null);
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
- setGroupsError(err instanceof Error ? err.message : "Couldn't load groups.");
106
+ setPluginsError(err instanceof Error ? err.message : "Couldn't load plugins.");
107
107
  })
108
108
  .finally(() => {
109
- if (!cancelled) setGroupsLoading(false);
109
+ if (!cancelled) setPluginsLoading(false);
110
110
  });
111
111
  return () => {
112
112
  cancelled = true;
113
113
  };
114
- }, [groupsRevision]);
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
- group: displayGroupOf(s.path),
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 group have one?", and a separate shelf answers the
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
- * group's amber count as though something were broken.
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
- group: displayGroupOf(s.path),
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
- group: displayGroupOf(t.path),
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 reloadGroups = useCallback(() => {
184
- setGroupsLoading(true);
185
- setGroupsRevision((r) => r + 1);
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
- groupSummaries,
193
- groupsLoading,
194
- groupsError,
195
- reloadGroups,
192
+ pluginSummaries,
193
+ pluginsLoading,
194
+ pluginsError,
195
+ reloadPlugins,
196
196
  }),
197
- [data, items, groupSummaries, groupsLoading, groupsError, reloadGroups],
197
+ [data, items, pluginSummaries, pluginsLoading, pluginsError, reloadPlugins],
198
198
  );
199
199
 
200
200
  return <LibraryContext.Provider value={value}>{children}</LibraryContext.Provider>;
@@ -207,8 +207,8 @@ export function useLibrary(): LibraryContextValue {
207
207
  }
208
208
 
209
209
  /**
210
- * How many of a group's integrations need setup — the amber count on the
211
- * sidebar row and the group page's banner, computed from one place so the two
210
+ * How many of a plugin's integrations need setup — the amber count on the
211
+ * sidebar row and the plugin page's banner, computed from one place so the two
212
212
  * can never disagree.
213
213
  *
214
214
  * Only integrations count. A skill that reports `warn` is warning about the
@@ -216,8 +216,8 @@ export function useLibrary(): LibraryContextValue {
216
216
  * broken connection; pending change requests are a review concern, not a setup
217
217
  * one, and belong to a different surface.
218
218
  */
219
- export function attentionOf(items: LibraryItem[], group: string): number {
219
+ export function attentionOf(items: LibraryItem[], plugin: string): number {
220
220
  return items.filter(
221
- (i) => i.group === group && i.kind === 'integration' && i.status.state !== 'ok',
221
+ (i) => i.plugin === plugin && i.kind === 'integration' && i.status.state !== 'ok',
222
222
  ).length;
223
223
  }
@@ -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-group view (its request toast) and the owner-side
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 GROUP here rather than a list because that is what it now is:
6
- * the same page, the same sections, the same card grid as `Groups/Engineering`.
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 Group" is what a colleague would call
10
- * it out loud; "Juan Viera's Group" is what a directory would call it.
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 personalGroupName(displayName: string | null | undefined): string {
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 Group`;
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 group heading cannot disagree about how
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 group heading says "Yours", the welcome page says "there".
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 { GroupPrincipals, GroupSummary } from '../services/groups.api';
1
+ import type { PluginPrincipals, PluginSummary } from '../services/plugins.api';
2
2
 
3
3
  /**
4
- * How a group describes its membership in prose.
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 group would describe itself differently
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: GroupPrincipals): string[] {
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: GroupPrincipals): string[] {
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 group: owners, falling back to writers, falling back to 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 group with no named principals genuinely is run by them.
40
+ * `access.md`, so a plugin with no named principals genuinely is run by them.
41
41
  */
42
- export function ownersTextOf(summary: Pick<GroupSummary, 'owners' | 'writers'>): string {
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 group is shared with, or `null` when there is nothing honest to say
52
- * — either the reader list was withheld (the caller cannot read the group, and
53
- * a locked group never advertises its share list) or it resolved empty.
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<GroupSummary, 'readers'>): string | null {
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 group's writes and links point at — its single `Groups/<G>` folder. */
66
- export function primaryFolderOf(summary: Pick<GroupSummary, 'folders'>): string | null {
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
  }