@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.
Files changed (132) 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/core/registry.ts +16 -4
  9. package/src/css-side-effect-imports.d.ts +7 -7
  10. package/src/modules/access/__tests__/ManageAccessDialog.placement.test.tsx +1 -1
  11. package/src/modules/access/__tests__/ManageAccessDialog.test.tsx +5 -5
  12. package/src/modules/access/api.ts +5 -5
  13. package/src/modules/access/components/ManageAccessDialog.tsx +21 -20
  14. package/src/modules/admin/__tests__/AdminRolesPage.suggest.test.tsx +1 -1
  15. package/src/modules/admin/components/AdminRolesPage.tsx +1 -1
  16. package/src/modules/admin/state/admin.context.tsx +15 -0
  17. package/src/modules/change-requests/__tests__/useFileOnBranch.test.tsx +2 -2
  18. package/src/modules/change-requests/components/ChangeRequestDialog.tsx +1 -1
  19. package/src/modules/change-requests/hooks/useApplyChangeRequest.ts +1 -1
  20. package/src/modules/layout/__tests__/SidebarFrameResponsive.test.tsx +4 -4
  21. package/src/modules/layout/__tests__/SidebarToggle.test.tsx +4 -4
  22. package/src/modules/layout/__tests__/breakpoints.test.ts +1 -1
  23. package/src/modules/layout/components/SidebarFrame.tsx +2 -2
  24. package/src/modules/library/__tests__/{AddToGroupDialog.test.tsx → AddToPluginDialog.test.tsx} +34 -34
  25. package/src/modules/library/__tests__/LibraryCard.test.tsx +30 -11
  26. package/src/modules/library/__tests__/LibraryRoutes.test.tsx +84 -59
  27. package/src/modules/library/__tests__/LibrarySidebarMenu.test.tsx +51 -51
  28. package/src/modules/library/__tests__/{LockedGroupView.test.tsx → LockedPluginView.test.tsx} +33 -33
  29. package/src/modules/library/__tests__/McpServerSection.test.tsx +138 -0
  30. package/src/modules/library/__tests__/{NewGroupDialog.test.tsx → NewPluginDialog.test.tsx} +22 -22
  31. package/src/modules/library/__tests__/PersonalAddDialog.test.tsx +7 -7
  32. package/src/modules/library/__tests__/PluginExtras.test.tsx +131 -0
  33. package/src/modules/library/__tests__/{GroupJoinRequests.test.tsx → PluginJoinRequests.test.tsx} +24 -24
  34. package/src/modules/library/__tests__/{GroupPage.test.tsx → PluginPage.test.tsx} +197 -106
  35. package/src/modules/library/__tests__/PluginsIndexPage.test.tsx +363 -0
  36. package/src/modules/library/__tests__/{GroupsSidebar.contextmenu.test.tsx → PluginsSidebar.contextmenu.test.tsx} +32 -31
  37. package/src/modules/library/__tests__/{GroupsSidebar.locked.test.tsx → PluginsSidebar.locked.test.tsx} +29 -28
  38. package/src/modules/library/__tests__/PluginsSidebar.test.tsx +171 -0
  39. package/src/modules/library/__tests__/{GroupsSidebarMenu.test.tsx → PluginsSidebarMenu.test.tsx} +18 -18
  40. package/src/modules/library/__tests__/SkillPage.test.tsx +8 -8
  41. package/src/modules/library/__tests__/ToolConnectionSection.test.tsx +2 -2
  42. package/src/modules/library/__tests__/ToolPage.test.tsx +41 -12
  43. package/src/modules/library/__tests__/ToolSharePanel.test.tsx +1 -1
  44. package/src/modules/library/__tests__/WorkspaceItemRoute.test.tsx +57 -57
  45. package/src/modules/library/__tests__/auth-harness.tsx +4 -4
  46. package/src/modules/library/__tests__/library-data.test.ts +82 -0
  47. package/src/modules/library/__tests__/status.test.ts +19 -19
  48. package/src/modules/library/__tests__/tools.api.test.ts +70 -0
  49. package/src/modules/library/__tests__/useToolPage.test.tsx +4 -4
  50. package/src/modules/library/components/AccessRequestsBanner.tsx +8 -8
  51. package/src/modules/library/components/{AddToGroupDialog.tsx → AddToPluginDialog.tsx} +11 -11
  52. package/src/modules/library/components/ChangeRequestDock.tsx +1 -1
  53. package/src/modules/library/components/{DeleteGroupDialog.tsx → DeletePluginDialog.tsx} +9 -9
  54. package/src/modules/library/components/LibraryCard.tsx +26 -2
  55. package/src/modules/library/components/LibraryLayout.tsx +80 -71
  56. package/src/modules/library/components/LibraryPage.tsx +8 -8
  57. package/src/modules/library/components/LockGlyph.tsx +1 -1
  58. package/src/modules/library/components/{LockedGroupView.tsx → LockedPluginView.tsx} +35 -35
  59. package/src/modules/library/components/{ManagedGroupRequests.tsx → ManagedPluginRequests.tsx} +13 -13
  60. package/src/modules/library/components/{NewGroupDialog.tsx → NewPluginDialog.tsx} +24 -24
  61. package/src/modules/library/components/NewSkillPanel.tsx +23 -5
  62. package/src/modules/library/components/PageActions.tsx +34 -11
  63. package/src/modules/library/components/PersonalAddDialog.tsx +5 -5
  64. package/src/modules/library/components/{PersonalGroupPage.tsx → PersonalPluginPage.tsx} +29 -19
  65. package/src/modules/library/components/PluginExtras.tsx +195 -0
  66. package/src/modules/library/components/{GroupIndexRow.tsx → PluginIndexRow.tsx} +6 -6
  67. package/src/modules/library/components/PluginJoinRequests.tsx +77 -0
  68. package/src/modules/library/components/{GroupPage.tsx → PluginPage.tsx} +112 -72
  69. package/src/modules/library/components/{GroupsIndexPage.tsx → PluginsIndexPage.tsx} +91 -48
  70. package/src/modules/library/components/{GroupsSidebar.tsx → PluginsSidebar.tsx} +105 -55
  71. package/src/modules/library/components/{GroupsSidebarMenu.tsx → PluginsSidebarMenu.tsx} +15 -15
  72. package/src/modules/library/components/{group-page-parts.tsx → plugin-page-parts.tsx} +218 -27
  73. package/src/modules/library/components/skill-page/SkillPage.tsx +12 -12
  74. package/src/modules/library/components/tool-page/McpServerSection.tsx +380 -0
  75. package/src/modules/library/components/tool-page/ToolPage.tsx +22 -5
  76. package/src/modules/library/hooks/useJoinRequests.ts +8 -8
  77. package/src/modules/library/routes/LibraryRoutes.tsx +32 -19
  78. package/src/modules/library/routes/WorkspaceItemRoute.tsx +24 -24
  79. package/src/modules/library/routes/library-paths.ts +36 -36
  80. package/src/modules/library/services/library.api.ts +9 -9
  81. package/src/modules/library/services/{groups.api.ts → plugins.api.ts} +43 -43
  82. package/src/modules/library/services/tools.api.ts +54 -0
  83. package/src/modules/library/state/library-data.tsx +67 -46
  84. package/src/modules/library/utils/names.ts +1 -1
  85. package/src/modules/library/utils/{personal-group.ts → personal-plugin.ts} +8 -8
  86. package/src/modules/library/utils/{group-summary.ts → plugin-summary.ts} +14 -14
  87. package/src/modules/library/utils/status.ts +17 -17
  88. package/src/modules/onboarding/__tests__/creator-welcome.test.tsx +318 -0
  89. package/src/modules/onboarding/__tests__/onboarding.test.tsx +86 -8
  90. package/src/modules/onboarding/agent-clients.ts +18 -14
  91. package/src/modules/onboarding/components/CreatorWelcomePage.tsx +143 -0
  92. package/src/modules/onboarding/components/WelcomePage.tsx +30 -22
  93. package/src/modules/onboarding/components/WelcomeRoute.tsx +57 -0
  94. package/src/modules/onboarding/welcome-state.ts +36 -0
  95. package/src/modules/review/components/MarkdownDiffViewer.tsx +1 -1
  96. package/src/modules/review/components/ReviewPanel.tsx +11 -11
  97. package/src/modules/review/components/__tests__/{isGroupItemPath.test.ts → isPluginItemPath.test.ts} +24 -24
  98. package/src/modules/secrets-vault/components/ToolSecretsPanel.tsx +3 -3
  99. package/src/modules/secrets-vault/components/__tests__/SecretsPage.test.tsx +1 -1
  100. package/src/modules/settings/components/SettingsLayout.tsx +1 -1
  101. package/src/modules/settings/components/SettingsNav.tsx +5 -5
  102. package/src/modules/setup/__tests__/setup.test.tsx +203 -0
  103. package/src/modules/setup/components/SetupScreen.tsx +235 -68
  104. package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +29 -107
  105. package/src/modules/toolbar/components/__tests__/AppSwitcher.test.tsx +1 -1
  106. package/src/modules/toolbar/components/__tests__/ExternalAgentAccessPage.test.tsx +228 -0
  107. package/src/modules/toolbar/components/__tests__/Toolbar.test.tsx +3 -3
  108. package/src/modules/workspace/components/FileExplorer.tsx +12 -12
  109. package/src/modules/workspace/components/FileRoute.tsx +8 -1
  110. package/src/modules/workspace/components/FileViewer.tsx +95 -38
  111. package/src/modules/workspace/components/__tests__/FileExplorer.test.tsx +14 -14
  112. package/src/modules/workspace/components/__tests__/FileRoute.test.tsx +20 -0
  113. package/src/modules/workspace/components/__tests__/FileViewer.test.tsx +227 -18
  114. package/src/modules/workspace/components/renderers/ToolRenderer.tsx +7 -2
  115. package/src/modules/workspace/routing/__tests__/kb-routes.test.tsx +25 -0
  116. package/src/modules/workspace/routing/kb-routes.ts +23 -1
  117. package/src/modules/workspace/utils/__tests__/diff.test.ts +1 -1
  118. package/src/modules/workspace/utils/fileTree.ts +54 -3
  119. package/src/shared/components/Surface.tsx +15 -0
  120. package/src/shared/mcp/ClaudeInstallLink.tsx +88 -0
  121. package/src/shared/mcp/ConnectionInstructions.tsx +51 -0
  122. package/src/shared/mcp/CopyBlock.tsx +42 -0
  123. package/src/shared/mcp/__tests__/ClaudeInstallLink.test.tsx +40 -0
  124. package/src/shared/mcp/__tests__/connect-snippets.test.ts +431 -0
  125. package/src/shared/mcp/__tests__/useCopyFeedback.test.ts +112 -0
  126. package/src/shared/mcp/connect-snippets.ts +353 -0
  127. package/src/shared/mcp/index.ts +28 -0
  128. package/src/shared/mcp/useCopyFeedback.ts +46 -0
  129. package/src/test-setup.ts +11 -0
  130. package/src/modules/library/__tests__/GroupsIndexPage.test.tsx +0 -283
  131. package/src/modules/library/__tests__/GroupsSidebar.test.tsx +0 -142
  132. package/src/modules/library/components/GroupJoinRequests.tsx +0 -56
@@ -1,22 +1,22 @@
1
1
  import { useState } from 'react';
2
2
  import { Link } from 'react-router-dom';
3
3
  import { Badge, Button, Surface } from '../../../shared/components';
4
- import { pathForGroupsIndex } from '../routes/library-paths';
5
- import { ownersTextOf, primaryFolderOf } from '../utils/group-summary';
6
- import { AlreadyReadableError, requestGroupAccess, type GroupSummary } from '../services/groups.api';
4
+ import { pathForPluginsIndex } from '../routes/library-paths';
5
+ import { ownersTextOf, primaryFolderOf } from '../utils/plugin-summary';
6
+ import { AlreadyReadableError, requestPluginAccess, type PluginSummary } from '../services/plugins.api';
7
7
  import { firstNames, joinNames } from '../utils/names';
8
8
  import { useLibraryToast } from '../state/toast.context';
9
9
  import { LockGlyph } from './LockGlyph';
10
10
 
11
11
  /**
12
- * A group you cannot read, as a place you can still stand in.
12
+ * A plugin you cannot read, as a place you can still stand in.
13
13
  *
14
- * Reaching this view means the caller could read the group's `access.md`
14
+ * Reaching this view means the caller could read the plugin's `access.md`
15
15
  * file (the `read: everyone` discovery grant in its frontmatter) but not the
16
16
  * folder — the same tier the backend used to include the summary at all. It
17
- * states four facts and offers one action: the group exists, who runs it,
17
+ * states four facts and offers one action: the plugin exists, who runs it,
18
18
  * how much is in it, and how to ask. Item names and descriptions stay
19
- * members-only; asking opens a plain change request that the group's
19
+ * members-only; asking opens a plain change request that the plugin's
20
20
  * writers approve by merging.
21
21
  *
22
22
  * It is the SAME frame as the member view — breadcrumb, h1, run-by lede — so
@@ -24,45 +24,45 @@ import { LockGlyph } from './LockGlyph';
24
24
  *
25
25
  * `Manage access` is the escape hatch for a locked-out platform Admin. Admin
26
26
  * rescue applies to WRITING `access.md`, not to reading the folder, so an Admin
27
- * can genuinely be locked out of a group they are nevertheless the right person
27
+ * can genuinely be locked out of a plugin they are nevertheless the right person
28
28
  * to unlock. `canWrite` is exactly that verdict, which is why the button hangs
29
29
  * off it and not off any role check.
30
30
  */
31
31
 
32
- export interface LockedGroupViewProps {
33
- group: GroupSummary;
32
+ export interface LockedPluginViewProps {
33
+ plugin: PluginSummary;
34
34
  /** A request landed — refetch the index so `hasRequested` comes back true. */
35
35
  onRequested(): void;
36
- /** Access was already granted: reload everything and let the group open. */
36
+ /** Access was already granted: reload everything and let the plugin open. */
37
37
  onUnlocked(): void;
38
38
  /** Open `ManageAccessDialog` on this repo-relative folder. */
39
39
  onManage(folder: string): void;
40
40
  }
41
41
 
42
- export function LockedGroupView({ group, onRequested, onUnlocked, onManage }: LockedGroupViewProps) {
42
+ export function LockedPluginView({ plugin, onRequested, onUnlocked, onManage }: LockedPluginViewProps) {
43
43
  const toast = useLibraryToast();
44
44
  const [requesting, setRequesting] = useState(false);
45
45
  const [requested, setRequested] = useState(false);
46
46
 
47
- const admins = adminNamesOf(group);
47
+ const admins = adminNamesOf(plugin);
48
48
  // The prose name for the same people, from the SAME helper the member view
49
- // uses — a group has to describe itself identically on both sides of the lock.
50
- const adminsText = ownersTextOf(group);
51
- const primaryFolder = primaryFolderOf(group);
52
- const pending = group.hasRequested || requested;
49
+ // uses — a plugin has to describe itself identically on both sides of the lock.
50
+ const adminsText = ownersTextOf(plugin);
51
+ const primaryFolder = primaryFolderOf(plugin);
52
+ const pending = plugin.hasRequested || requested;
53
53
 
54
54
  async function request() {
55
55
  setRequesting(true);
56
56
  try {
57
- await requestGroupAccess(group.name);
57
+ await requestPluginAccess(plugin.name);
58
58
  setRequested(true);
59
59
  toast(
60
- `Asked ${admins.length > 0 ? joinNames(firstNames(admins)) : 'the admins'}. You get its skills and tools if they let you in.`,
60
+ `Asked ${admins.length > 0 ? joinNames(firstNames(admins)) : 'the admins'}. You get its skills and tools once they grant access.`,
61
61
  );
62
62
  onRequested();
63
63
  } catch (err) {
64
64
  // Access arrived between the page load and the click. Nothing went
65
- // wrong — the group is simply open now, so open it.
65
+ // wrong — the plugin is simply open now, so open it.
66
66
  if (err instanceof AlreadyReadableError) {
67
67
  // Released BEFORE handing off, because `onUnlocked` is not guaranteed
68
68
  // to swap this view out synchronously — if it kicks off an async
@@ -80,17 +80,17 @@ export function LockedGroupView({ group, onRequested, onUnlocked, onManage }: Lo
80
80
  return (
81
81
  <div className="pb-14">
82
82
  <nav aria-label="Breadcrumb" className="flex items-center gap-1.5 text-detail text-ink-faint">
83
- <Link to={pathForGroupsIndex()} className="rounded-xs hover:text-ink">
84
- All groups
83
+ <Link to={pathForPluginsIndex()} className="rounded-xs hover:text-ink">
84
+ All plugins
85
85
  </Link>
86
86
  <span aria-hidden="true">›</span>
87
87
  <span aria-current="page" className="truncate text-ink-muted">
88
- {group.name}
88
+ {plugin.name}
89
89
  </span>
90
90
  </nav>
91
91
 
92
92
  <div className="mt-1.5 flex items-center gap-2.5">
93
- <h1 className="text-display font-semibold">{group.name}</h1>
93
+ <h1 className="text-display font-semibold">{plugin.name}</h1>
94
94
  <Badge tone="outline" size="sm">
95
95
  <LockGlyph className="size-3 shrink-0" />
96
96
  Locked
@@ -100,14 +100,14 @@ export function LockedGroupView({ group, onRequested, onUnlocked, onManage }: Lo
100
100
  <p className="mt-1 text-lede text-ink-muted">{`Run by ${adminsText}.`}</p>
101
101
 
102
102
  {/* Volume, never contents. A number tells you whether it is worth asking
103
- to join; a name would tell you what is inside. */}
104
- <p className="mt-1 text-ui text-ink-muted">{countsLine(group)}</p>
103
+ for access; a name would tell you what is inside. */}
104
+ <p className="mt-1 text-ui text-ink-muted">{countsLine(plugin)}</p>
105
105
 
106
106
  <div className="mt-5">
107
107
  {pending ? (
108
108
  <Surface tone="sunken" radius="lg" elevation="none" padded className="max-w-lg">
109
109
  <p className="text-body">
110
- {`Requested: ${adminsText} ${admins.length === 1 ? 'decides' : 'decide'} who joins.`}
110
+ {`Requested: ${adminsText} ${admins.length === 1 ? 'decides' : 'decide'} who gets access.`}
111
111
  </p>
112
112
  </Surface>
113
113
  ) : (
@@ -117,7 +117,7 @@ export function LockedGroupView({ group, onRequested, onUnlocked, onManage }: Lo
117
117
  )}
118
118
  </div>
119
119
 
120
- {group.canWrite && primaryFolder && (
120
+ {plugin.canWrite && primaryFolder && (
121
121
  <div className="mt-3">
122
122
  <Button variant="quiet" onClick={() => onManage(primaryFolder)}>
123
123
  Manage access
@@ -134,10 +134,10 @@ export function LockedGroupView({ group, onRequested, onUnlocked, onManage }: Lo
134
134
  * Singular is honoured here (unlike the index rows' fixed-width label) because
135
135
  * this is a sentence somebody reads, not a column that has to line up.
136
136
  */
137
- function countsLine(group: Pick<GroupSummary, 'skillCount' | 'toolCount'>): string {
138
- const skills = `${group.skillCount} ${group.skillCount === 1 ? 'skill' : 'skills'}`;
139
- const tools = `${group.toolCount} ${group.toolCount === 1 ? 'tool' : 'tools'}`;
140
- return `${skills} · ${tools}. Visible to members only.`;
137
+ function countsLine(plugin: Pick<PluginSummary, 'skillCount' | 'toolCount'>): string {
138
+ const skills = `${plugin.skillCount} ${plugin.skillCount === 1 ? 'skill' : 'skills'}`;
139
+ const tools = `${plugin.toolCount} ${plugin.toolCount === 1 ? 'tool' : 'tools'}`;
140
+ return `${skills} · ${tools}. Visible once you have access.`;
141
141
  }
142
142
 
143
143
  /**
@@ -148,11 +148,11 @@ function countsLine(group: Pick<GroupSummary, 'skillCount' | 'toolCount'>): stri
148
148
  * separate function only because the toast needs the NAMES (to take first
149
149
  * names) and the verb needs the COUNT, and prose gives back neither.
150
150
  */
151
- function adminNamesOf(group: Pick<GroupSummary, 'owners' | 'writers'>): string[] {
152
- const owners = [...group.owners.users.map((u) => u.name), ...group.owners.roles];
151
+ function adminNamesOf(plugin: Pick<PluginSummary, 'owners' | 'writers'>): string[] {
152
+ const owners = [...plugin.owners.users.map((u) => u.name), ...plugin.owners.roles];
153
153
  const named = owners.filter((s) => s.length > 0);
154
154
  if (named.length > 0) return named;
155
- return [...group.writers.users.map((u) => u.name), ...group.writers.roles].filter(
155
+ return [...plugin.writers.users.map((u) => u.name), ...plugin.writers.roles].filter(
156
156
  (s) => s.length > 0,
157
157
  );
158
158
  }
@@ -2,24 +2,24 @@ import { useMemo, useState } from 'react';
2
2
  import { useLibrary } from '../state/library-data';
3
3
  import { useWorkspace } from '../../workspace/state/workspace.context';
4
4
  import { ManageAccessDialog } from '../../access/components/ManageAccessDialog';
5
- import { GroupJoinRequests } from './GroupJoinRequests';
5
+ import { PluginJoinRequests } from './PluginJoinRequests';
6
6
 
7
7
  /**
8
- * Every pending join request the CALLER can answer, one banner per group they
8
+ * Every pending join request the CALLER can answer, one banner per plugin they
9
9
  * manage.
10
10
  *
11
- * It belongs on whatever page the Library opens on — nobody visits a group to
11
+ * It belongs on whatever page the Library opens on — nobody visits a plugin to
12
12
  * find out that somebody wants into it, so the landing view is the one place a
13
- * request is guaranteed to be seen. That page is the all-groups index now; it
13
+ * request is guaranteed to be seen. That page is the all-plugins index now; it
14
14
  * was the Everything gallery before, and this component exists so the surface
15
- * could move without being rebuilt. The group's own page carries the identical
15
+ * could move without being rebuilt. The plugin's own page carries the identical
16
16
  * banner for the person who is already there.
17
17
  *
18
- * It fetches per group and renders nothing for a group with nothing pending, so
18
+ * It fetches per plugin and renders nothing for a plugin with nothing pending, so
19
19
  * mounting it on a page is not a promise that anything will appear.
20
20
  */
21
- export function ManagedGroupRequests() {
22
- const { groupSummaries, reload, reloadGroups } = useLibrary();
21
+ export function ManagedPluginRequests() {
22
+ const { pluginSummaries, reload, reloadPlugins } = useLibrary();
23
23
  const { kbDirName } = useWorkspace();
24
24
  /** Repo-relative folder whose `access.md` the Manage-access dialog is on. */
25
25
  const [manageFolder, setManageFolder] = useState<string | null>(null);
@@ -28,19 +28,19 @@ export function ManagedGroupRequests() {
28
28
 
29
29
  const managed = useMemo(
30
30
  () =>
31
- groupSummaries
31
+ pluginSummaries
32
32
  .filter((g) => g.canWrite)
33
33
  .slice()
34
34
  .sort((a, b) => a.name.localeCompare(b.name)),
35
- [groupSummaries],
35
+ [pluginSummaries],
36
36
  );
37
37
 
38
38
  return (
39
39
  <>
40
40
  {managed.map((g) => (
41
- <GroupJoinRequests
41
+ <PluginJoinRequests
42
42
  key={g.name}
43
- group={g.name}
43
+ plugin={g.name}
44
44
  folders={g.folders}
45
45
  onManage={setManageFolder}
46
46
  reloadSignal={accessRevision}
@@ -59,7 +59,7 @@ export function ManagedGroupRequests() {
59
59
  }}
60
60
  onClose={() => {
61
61
  setManageFolder(null);
62
- reloadGroups();
62
+ reloadPlugins();
63
63
  reload();
64
64
  setAccessRevision((r) => r + 1);
65
65
  }}
@@ -1,30 +1,30 @@
1
1
  import { useState } from 'react';
2
2
  import { useNavigate } from 'react-router-dom';
3
3
  import { Button, Dialog, TextField } from '../../../shared/components';
4
- import { createGroup } from '../services/groups.api';
5
- import { pathForGroup } from '../routes/library-paths';
4
+ import { createPlugin } from '../services/plugins.api';
5
+ import { pathForPlugin } from '../routes/library-paths';
6
6
  import { useLibraryToast } from '../state/toast.context';
7
7
 
8
- export interface NewGroupDialogProps {
9
- /** Names already taken — readable groups AND locked ones. */
8
+ export interface NewPluginDialogProps {
9
+ /** Names already taken — readable plugins AND locked ones. */
10
10
  existing: string[];
11
11
  onClose(): void;
12
- /** The catalog and the group index both have to hear about a new folder. */
12
+ /** The catalog and the plugin index both have to hear about a new folder. */
13
13
  onCreated(): void;
14
14
  }
15
15
 
16
16
  /**
17
- * Make a group — the prototype's `newSpaceModal` (line 2769).
17
+ * Make a plugin — the prototype's `newSpaceModal` (line 2769).
18
18
  *
19
- * A group IS a folder, and the folder comes from the DEDICATED provisioning
20
- * endpoint (`POST /api/groups`) — the one privileged door for claiming a name
21
- * under `Groups/`. The endpoint writes the folder's `access.md` naming the
19
+ * A plugin IS a folder, and the folder comes from the DEDICATED provisioning
20
+ * endpoint (`POST /api/plugins`) — the one privileged door for claiming a name
21
+ * under `Plugins/`. The endpoint writes the folder's `access.md` naming the
22
22
  * creator under read, write and owner (with the file itself readable by
23
- * everyone, so the group is discoverable and joinable) and commits it before
23
+ * everyone, so the plugin is discoverable and joinable) and commits it before
24
24
  * answering. So there is no access step in this dialog: by the time the
25
- * response arrives, the group exists and it is yours.
25
+ * response arrives, the plugin exists and it is yours.
26
26
  */
27
- export function NewGroupDialog({ existing, onClose, onCreated }: NewGroupDialogProps) {
27
+ export function NewPluginDialog({ existing, onClose, onCreated }: NewPluginDialogProps) {
28
28
  const navigate = useNavigate();
29
29
  const toast = useLibraryToast();
30
30
  const [name, setName] = useState('');
@@ -33,16 +33,16 @@ export function NewGroupDialog({ existing, onClose, onCreated }: NewGroupDialogP
33
33
  const trimmed = name.trim();
34
34
  const taken = existing.some((g) => g.toLowerCase() === trimmed.toLowerCase());
35
35
  /**
36
- * A group name becomes a folder name, so the characters a path cannot carry
36
+ * A plugin name becomes a folder name, so the characters a path cannot carry
37
37
  * are the characters a name cannot have. Checked here rather than left to the
38
- * server because `Groups/A/B` would silently create a NESTED folder — which
39
- * `groupOfPath` would then read as the group "A", not "A/B".
38
+ * server because `Plugins/A/B` would silently create a NESTED folder — which
39
+ * `pluginOfPath` would then read as the plugin "A", not "A/B".
40
40
  */
41
41
  const illegal = /[/\\]/.test(trimmed);
42
42
  const error = taken
43
- ? 'A group with that name already exists.'
43
+ ? 'A plugin with that name already exists.'
44
44
  : illegal
45
- ? "A group name can't contain / or \\."
45
+ ? "A plugin name can't contain / or \\."
46
46
  : null;
47
47
  const canCreate = trimmed.length > 0 && !error && !busy;
48
48
 
@@ -52,14 +52,14 @@ export function NewGroupDialog({ existing, onClose, onCreated }: NewGroupDialogP
52
52
  try {
53
53
  // Navigate with the SERVER's folder name, not the typed one — the
54
54
  // endpoint owns the canonical spelling of what it created.
55
- const { folder } = await createGroup(trimmed);
55
+ const { folder } = await createPlugin(trimmed);
56
56
  onCreated();
57
57
  onClose();
58
- navigate(pathForGroup(folder));
58
+ navigate(pathForPlugin(folder));
59
59
  } catch (err) {
60
60
  // The server's refusal names the problem (name taken, reserved
61
61
  // prefix…) — worth more than a generic apology.
62
- const msg = err instanceof Error ? err.message : "Couldn't create that group. Try again.";
62
+ const msg = err instanceof Error ? err.message : "Couldn't create that plugin. Try again.";
63
63
  toast(msg, 'danger');
64
64
  setBusy(false);
65
65
  }
@@ -69,7 +69,7 @@ export function NewGroupDialog({ existing, onClose, onCreated }: NewGroupDialogP
69
69
  <Dialog
70
70
  open
71
71
  onClose={onClose}
72
- title="New group"
72
+ title="New plugin"
73
73
  size="md"
74
74
  busy={busy}
75
75
  footer={
@@ -78,19 +78,19 @@ export function NewGroupDialog({ existing, onClose, onCreated }: NewGroupDialogP
78
78
  Cancel
79
79
  </Button>
80
80
  <Button variant="primary" onClick={() => void create()} disabled={!canCreate}>
81
- {busy ? 'Creating…' : 'Create group'}
81
+ {busy ? 'Creating…' : 'Create plugin'}
82
82
  </Button>
83
83
  </>
84
84
  }
85
85
  >
86
86
  <p className="text-ui text-ink-muted">
87
- A group carries skills and tools for the people in it. You run the ones you create.
87
+ A plugin carries skills and tools for the people in it. You run the ones you create.
88
88
  </p>
89
89
 
90
90
  <TextField
91
91
  className="mt-3.5 w-full"
92
92
  autoFocus
93
- aria-label="Group name"
93
+ aria-label="Plugin name"
94
94
  placeholder="Design, Support, Leadership…"
95
95
  value={name}
96
96
  onChange={(e) => setName(e.target.value)}
@@ -11,11 +11,11 @@ import { useLibraryToast } from '../state/toast.context';
11
11
  /**
12
12
  * Where the new skill lands.
13
13
  *
14
- * - A GROUP destination carries the folder and the caller's write verdict
14
+ * - A PLUGIN destination carries the folder and the caller's write verdict
15
15
  * on it. `canWrite: null` (verdict not in yet) is treated as "not a
16
16
  * writer", same rule the surrounding dialogs use: the cautious path —
17
17
  * a change request — is correct either way, the confident one is not.
18
- * - PERSONAL means the caller's own folder (`Groups/personal-<id>/`),
18
+ * - PERSONAL means the caller's own folder (`Plugins/personal-<id>/`),
19
19
  * which `createEmptySkill` ensures via the provisioning endpoint before
20
20
  * writing. Always direct: the ensured folder is theirs by construction.
21
21
  */
@@ -29,6 +29,15 @@ export interface NewSkillPanelProps {
29
29
  existingSkills: string[];
30
30
  /** Fired once the file exists; the host dialog closes on it. */
31
31
  onCreated(): void;
32
+ /**
33
+ * Follows the panel's in-flight state, for a host that can dismiss it. A
34
+ * create that is already running does not stop when this panel unmounts —
35
+ * it finishes, and (direct case) NAVIGATES. A host dialog that stayed
36
+ * closable while that was pending let someone dismiss "New skill" and be
37
+ * carried off the page seconds later; with this it holds its close doors
38
+ * shut (`Dialog.busy`) until the request settles.
39
+ */
40
+ onBusyChange?(busy: boolean): void;
32
41
  }
33
42
 
34
43
  /**
@@ -49,6 +58,7 @@ export function NewSkillPanel({
49
58
  destination,
50
59
  existingSkills,
51
60
  onCreated,
61
+ onBusyChange,
52
62
  }: NewSkillPanelProps) {
53
63
  const { user } = useAuth();
54
64
  const reloadLibrary = useLibraryReload();
@@ -60,8 +70,8 @@ export function NewSkillPanel({
60
70
  const trimmed = name.trim();
61
71
  /**
62
72
  * A skill name becomes a folder name, so the characters a path cannot carry
63
- * are the characters a name cannot have — the same rule `NewGroupDialog`
64
- * applies to groups, and the same one the backend enforces (`isSafeName`).
73
+ * are the characters a name cannot have — the same rule `NewPluginDialog`
74
+ * applies to plugins, and the same one the backend enforces (`isSafeName`).
65
75
  */
66
76
  const illegal = /[/\\]/.test(trimmed) || trimmed === '.' || trimmed === '..';
67
77
  /**
@@ -81,6 +91,7 @@ export function NewSkillPanel({
81
91
  async function create() {
82
92
  if (!canCreate || !user) return;
83
93
  setBusy(true);
94
+ onBusyChange?.(true);
84
95
  try {
85
96
  const created = await createEmptySkill({
86
97
  ...('personal' in destination
@@ -93,6 +104,12 @@ export function NewSkillPanel({
93
104
  // The library is where the result lives, whichever way it went — nobody
94
105
  // is bounced to the Knowledge app to meet the thing they just made.
95
106
  reloadLibrary();
107
+ // Settled, and said so BEFORE handing back: the panel owns the whole
108
+ // lifecycle it advertises. Leaving the success case to the host works
109
+ // only while every host remembers to clear the flag in `onCreated` — a
110
+ // host that merely closes its dialog there (as `PersonalAddDialog` does
111
+ // with `onCreated={onClose}`) would stay busy forever.
112
+ onBusyChange?.(false);
96
113
  onCreated();
97
114
  if (created.direct) {
98
115
  // Straight into the new skill's page, editor open: an empty SKILL.md
@@ -103,7 +120,7 @@ export function NewSkillPanel({
103
120
  // A proposal has no page yet — the skill exists only on the author's
104
121
  // branch. It appears right here as an "In review" card (the pending
105
122
  // shelf), which is also where its review happens.
106
- toast(`Created ${trimmed}: sent to the group's owners for review.`, 'ok');
123
+ toast(`Created ${trimmed}: sent to the plugin's owners for review.`, 'ok');
107
124
  }
108
125
  } catch (err) {
109
126
  // The workspace API forwards the backend's own refusal (e.g. "You don't
@@ -112,6 +129,7 @@ export function NewSkillPanel({
112
129
  const msg = err instanceof Error ? err.message : String(err);
113
130
  toast(`Couldn't create that skill: ${msg}`, 'danger');
114
131
  setBusy(false);
132
+ onBusyChange?.(false);
115
133
  }
116
134
  }
117
135
 
@@ -14,7 +14,7 @@ import {
14
14
  * (proto:3012-3025).
15
15
  *
16
16
  * Everyone sees all three, and they do the same thing for everyone. That is
17
- * the whole point of the component existing: the group page used to render
17
+ * the whole point of the component existing: the plugin page used to render
18
18
  * `canWrite ? "Add skills or tools" : "Propose a skill or tool"` — the same
19
19
  * button, in the same spot, opening a different flow with different words
20
20
  * depending on who pressed it. In the prototype's words, "the person who
@@ -33,13 +33,22 @@ import {
33
33
  export interface PageActionsProps {
34
34
  /**
35
35
  * Opens Manage access. Omitted when there is no folder to manage — the
36
- * personal page is the live case: its items are the ones in NO group, so
36
+ * personal page is the live case: its items are the ones in NO plugin, so
37
37
  * there is no `access.md` behind them and a Share button would promise an
38
38
  * editor with nothing to edit.
39
39
  */
40
40
  onShare?: () => void;
41
- /** Opens the add dialog. Never gated on role — see the note above. */
42
- onAdd(): void;
41
+ /**
42
+ * Opens the add dialog. Never gated on ROLE — see the note above; that is
43
+ * the whole point of this component.
44
+ *
45
+ * Omitted when there is nothing to add INTO, exactly as `onShare` is: the
46
+ * dialog needs the group's summary and its primary folder, so without them
47
+ * the button could only ever be a no-op. A control that is present and does
48
+ * nothing teaches people that buttons lie, which is worse than a control
49
+ * that is not there.
50
+ */
51
+ onAdd?: () => void;
43
52
  /** Copies a link to this page. Resolves false if the clipboard refused. */
44
53
  onCopyLink(): Promise<boolean>;
45
54
  /**
@@ -78,7 +87,7 @@ export function PageActions({
78
87
  }, [close, onCopyLink]);
79
88
 
80
89
  return (
81
- <div className="flex flex-none items-center gap-1.5">
90
+ <div className="relative flex flex-none items-center gap-1.5">
82
91
  {onShare && (
83
92
  <Button variant="outline" size="sm" onClick={onShare}>
84
93
  <Users size={13} />
@@ -86,9 +95,11 @@ export function PageActions({
86
95
  </Button>
87
96
  )}
88
97
 
89
- <IconButton aria-label={addLabel} title={addLabel} onClick={onAdd}>
90
- <Plus size={15} />
91
- </IconButton>
98
+ {onAdd && (
99
+ <IconButton aria-label={addLabel} title={addLabel} onClick={onAdd}>
100
+ <Plus size={15} />
101
+ </IconButton>
102
+ )}
92
103
 
93
104
  <div className="relative">
94
105
  <IconButton
@@ -128,7 +139,7 @@ export function PageActions({
128
139
  >
129
140
  <span className="flex items-center gap-2.5">
130
141
  <Trash2 size={14} />
131
- Delete group
142
+ Delete plugin
132
143
  </span>
133
144
  </MenuItem>
134
145
  )}
@@ -139,12 +150,24 @@ export function PageActions({
139
150
 
140
151
  {/* The copy's answer, announced once. A clipboard write can be refused
141
152
  outright on a non-secure origin, and a silent no-op is the worst
142
- possible reply to "copy this". */}
153
+ possible reply to "copy this".
154
+
155
+ OUT of the flex flow, BELOW the row: in flow, the appearing text
156
+ widened the row and slid every button — including the `+` an empty
157
+ page's chalk arrow is aimed at — left for the 1.8s the answer shows.
158
+ A status is an annotation on the actions, not a fourth action, so it
159
+ must not move them.
160
+
161
+ Below rather than beside, because beside (`right-full`) reaches into
162
+ whatever shares the row — on a narrow column, or under a long group
163
+ name, that is the page title, and an answer that covers the heading
164
+ traded one layout bug for a worse one. Under the row it is clear of
165
+ every sibling at any width. */}
143
166
  <span
144
167
  role="status"
145
168
  aria-live="polite"
146
169
  className={cn(
147
- 'text-meta transition-opacity',
170
+ 'absolute right-0 top-full mt-1 whitespace-nowrap text-meta transition-opacity',
148
171
  copied ? 'opacity-100' : 'opacity-0',
149
172
  copied === 'fail' ? 'text-danger' : 'text-ink-faint',
150
173
  )}
@@ -16,15 +16,15 @@ export interface PersonalAddDialogProps {
16
16
  * "Add a skill or tool" for a person's own list — the prototype's
17
17
  * `personalAddModal` (proto:3366-3369).
18
18
  *
19
- * The same role split as a group's add flow. Everyone can copy a prompt for
19
+ * The same role split as a plugin's add flow. Everyone can copy a prompt for
20
20
  * their agent. Admins can also start an empty skill directly; non-admins do
21
21
  * not get a placeholder they would have to finish in a separate follow-up.
22
22
  *
23
23
  * This page used to have no first door at all. The reason was real but narrow:
24
- * the group dialog's first half was a LINK into the destination folder, and
24
+ * the plugin dialog's first half was a LINK into the destination folder, and
25
25
  * this page is defined as the items in no folder, so there was nothing to open.
26
26
  * That objection died with the link: a personal skill has a perfectly definite
27
- * home — the caller's own `Groups/personal-<id>/` folder, which
27
+ * home — the caller's own `Plugins/personal-<id>/` folder, which
28
28
  * `createEmptySkill` ensures through the provisioning endpoint before the
29
29
  * first write. The folder's seeded access.md names you as its owner, so the
30
30
  * write that follows passes the ordinary gate on its own merits — no
@@ -33,7 +33,7 @@ export interface PersonalAddDialogProps {
33
33
  export function PersonalAddDialog({ name, existingSkills, onClose }: PersonalAddDialogProps) {
34
34
  const { isAdmin } = useAdmin();
35
35
  const toast = useLibraryToast();
36
- const prompt = `Help me build a new skill or tool at Bevel. Keep it to myself for now. It goes in my own list, not a group.`;
36
+ const prompt = `Help me build a new skill or tool at Bevel. Keep it to myself for now. It goes in my own list, not a plugin.`;
37
37
 
38
38
  async function copyPrompt() {
39
39
  const copied = await copyToClipboard(prompt);
@@ -57,7 +57,7 @@ export function PersonalAddDialog({ name, existingSkills, onClose }: PersonalAdd
57
57
  }
58
58
  >
59
59
  <p className="text-ui text-ink-muted">
60
- {`It lands in ${name}. Yours alone until you add it to a group.`}
60
+ {`It lands in ${name}. Yours alone until you add it to a plugin.`}
61
61
  </p>
62
62
 
63
63
  {isAdmin && (