@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.
- package/LICENSE +202 -202
- package/THIRD-PARTY-NOTICES.md +344 -988
- package/package.json +5 -5
- package/src/core/CoreAppShell.tsx +4 -4
- package/src/core/__tests__/ShellRoutes.test.tsx +1 -1
- package/src/core/__tests__/bootstrap.test.ts +47 -2
- package/src/core/bootstrap.ts +20 -0
- package/src/css-side-effect-imports.d.ts +7 -7
- package/src/modules/access/__tests__/ManageAccessDialog.placement.test.tsx +1 -1
- package/src/modules/access/__tests__/ManageAccessDialog.test.tsx +5 -5
- package/src/modules/access/api.ts +5 -5
- package/src/modules/access/components/ManageAccessDialog.tsx +21 -20
- package/src/modules/admin/__tests__/AdminRolesPage.suggest.test.tsx +1 -1
- package/src/modules/admin/components/AdminRolesPage.tsx +1 -1
- package/src/modules/change-requests/__tests__/useFileOnBranch.test.tsx +2 -2
- package/src/modules/change-requests/components/ChangeRequestDialog.tsx +1 -1
- package/src/modules/change-requests/hooks/useApplyChangeRequest.ts +1 -1
- package/src/modules/layout/__tests__/SidebarFrameResponsive.test.tsx +4 -4
- package/src/modules/layout/__tests__/SidebarToggle.test.tsx +4 -4
- package/src/modules/layout/__tests__/breakpoints.test.ts +1 -1
- package/src/modules/layout/components/SidebarFrame.tsx +2 -2
- package/src/modules/library/__tests__/{AddToGroupDialog.test.tsx → AddToPluginDialog.test.tsx} +34 -34
- package/src/modules/library/__tests__/LibraryCard.test.tsx +30 -11
- package/src/modules/library/__tests__/LibraryRoutes.test.tsx +84 -59
- package/src/modules/library/__tests__/LibrarySidebarMenu.test.tsx +51 -51
- package/src/modules/library/__tests__/{LockedGroupView.test.tsx → LockedPluginView.test.tsx} +33 -33
- package/src/modules/library/__tests__/McpServerSection.test.tsx +138 -0
- package/src/modules/library/__tests__/{NewGroupDialog.test.tsx → NewPluginDialog.test.tsx} +22 -22
- package/src/modules/library/__tests__/PersonalAddDialog.test.tsx +7 -7
- package/src/modules/library/__tests__/PluginExtras.test.tsx +131 -0
- package/src/modules/library/__tests__/{GroupJoinRequests.test.tsx → PluginJoinRequests.test.tsx} +24 -24
- package/src/modules/library/__tests__/{GroupPage.test.tsx → PluginPage.test.tsx} +101 -101
- package/src/modules/library/__tests__/{GroupsIndexPage.test.tsx → PluginsIndexPage.test.tsx} +57 -57
- package/src/modules/library/__tests__/{GroupsSidebar.contextmenu.test.tsx → PluginsSidebar.contextmenu.test.tsx} +31 -31
- package/src/modules/library/__tests__/{GroupsSidebar.locked.test.tsx → PluginsSidebar.locked.test.tsx} +28 -28
- package/src/modules/library/__tests__/{GroupsSidebar.test.tsx → PluginsSidebar.test.tsx} +39 -39
- package/src/modules/library/__tests__/{GroupsSidebarMenu.test.tsx → PluginsSidebarMenu.test.tsx} +18 -18
- package/src/modules/library/__tests__/SkillPage.test.tsx +8 -8
- package/src/modules/library/__tests__/ToolConnectionSection.test.tsx +2 -2
- package/src/modules/library/__tests__/ToolPage.test.tsx +41 -12
- package/src/modules/library/__tests__/ToolSharePanel.test.tsx +1 -1
- package/src/modules/library/__tests__/WorkspaceItemRoute.test.tsx +57 -57
- package/src/modules/library/__tests__/auth-harness.tsx +4 -4
- package/src/modules/library/__tests__/status.test.ts +19 -19
- package/src/modules/library/__tests__/tools.api.test.ts +70 -0
- package/src/modules/library/__tests__/useToolPage.test.tsx +4 -4
- package/src/modules/library/components/AccessRequestsBanner.tsx +8 -8
- package/src/modules/library/components/{AddToGroupDialog.tsx → AddToPluginDialog.tsx} +11 -11
- package/src/modules/library/components/ChangeRequestDock.tsx +1 -1
- package/src/modules/library/components/{DeleteGroupDialog.tsx → DeletePluginDialog.tsx} +9 -9
- package/src/modules/library/components/LibraryCard.tsx +26 -2
- package/src/modules/library/components/LibraryLayout.tsx +70 -70
- package/src/modules/library/components/LibraryPage.tsx +8 -8
- package/src/modules/library/components/LockGlyph.tsx +1 -1
- package/src/modules/library/components/{LockedGroupView.tsx → LockedPluginView.tsx} +35 -35
- package/src/modules/library/components/{ManagedGroupRequests.tsx → ManagedPluginRequests.tsx} +13 -13
- package/src/modules/library/components/{NewGroupDialog.tsx → NewPluginDialog.tsx} +24 -24
- package/src/modules/library/components/NewSkillPanel.tsx +5 -5
- package/src/modules/library/components/PageActions.tsx +3 -3
- package/src/modules/library/components/PersonalAddDialog.tsx +5 -5
- package/src/modules/library/components/{PersonalGroupPage.tsx → PersonalPluginPage.tsx} +17 -17
- package/src/modules/library/components/PluginExtras.tsx +195 -0
- package/src/modules/library/components/{GroupIndexRow.tsx → PluginIndexRow.tsx} +6 -6
- package/src/modules/library/components/{GroupJoinRequests.tsx → PluginJoinRequests.tsx} +12 -12
- package/src/modules/library/components/{GroupPage.tsx → PluginPage.tsx} +72 -69
- package/src/modules/library/components/{GroupsIndexPage.tsx → PluginsIndexPage.tsx} +46 -46
- package/src/modules/library/components/{GroupsSidebar.tsx → PluginsSidebar.tsx} +55 -55
- package/src/modules/library/components/{GroupsSidebarMenu.tsx → PluginsSidebarMenu.tsx} +15 -15
- package/src/modules/library/components/{group-page-parts.tsx → plugin-page-parts.tsx} +35 -24
- package/src/modules/library/components/skill-page/SkillPage.tsx +12 -12
- package/src/modules/library/components/tool-page/McpServerSection.tsx +380 -0
- package/src/modules/library/components/tool-page/ToolPage.tsx +22 -5
- package/src/modules/library/hooks/useJoinRequests.ts +8 -8
- package/src/modules/library/routes/LibraryRoutes.tsx +30 -17
- package/src/modules/library/routes/WorkspaceItemRoute.tsx +24 -24
- package/src/modules/library/routes/library-paths.ts +36 -36
- package/src/modules/library/services/library.api.ts +9 -9
- package/src/modules/library/services/{groups.api.ts → plugins.api.ts} +43 -43
- package/src/modules/library/services/tools.api.ts +54 -0
- package/src/modules/library/state/library-data.tsx +46 -46
- package/src/modules/library/utils/names.ts +1 -1
- package/src/modules/library/utils/{personal-group.ts → personal-plugin.ts} +8 -8
- package/src/modules/library/utils/{group-summary.ts → plugin-summary.ts} +14 -14
- package/src/modules/library/utils/status.ts +17 -17
- package/src/modules/onboarding/__tests__/onboarding.test.tsx +86 -8
- package/src/modules/onboarding/agent-clients.ts +18 -14
- package/src/modules/onboarding/components/WelcomePage.tsx +19 -8
- package/src/modules/review/components/MarkdownDiffViewer.tsx +1 -1
- package/src/modules/review/components/ReviewPanel.tsx +11 -11
- package/src/modules/review/components/__tests__/{isGroupItemPath.test.ts → isPluginItemPath.test.ts} +24 -24
- package/src/modules/secrets-vault/components/ToolSecretsPanel.tsx +3 -3
- package/src/modules/secrets-vault/components/__tests__/SecretsPage.test.tsx +1 -1
- package/src/modules/settings/components/SettingsLayout.tsx +1 -1
- package/src/modules/settings/components/SettingsNav.tsx +5 -5
- package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +29 -107
- package/src/modules/toolbar/components/__tests__/AppSwitcher.test.tsx +1 -1
- package/src/modules/toolbar/components/__tests__/ExternalAgentAccessPage.test.tsx +228 -0
- package/src/modules/toolbar/components/__tests__/Toolbar.test.tsx +3 -3
- package/src/modules/workspace/components/FileExplorer.tsx +12 -12
- package/src/modules/workspace/components/__tests__/FileExplorer.test.tsx +14 -14
- package/src/modules/workspace/components/renderers/ToolRenderer.tsx +7 -2
- package/src/modules/workspace/utils/__tests__/diff.test.ts +1 -1
- package/src/modules/workspace/utils/fileTree.ts +3 -3
- package/src/shared/mcp/ClaudeInstallLink.tsx +88 -0
- package/src/shared/mcp/ConnectionInstructions.tsx +51 -0
- package/src/shared/mcp/CopyBlock.tsx +42 -0
- package/src/shared/mcp/__tests__/ClaudeInstallLink.test.tsx +40 -0
- package/src/shared/mcp/__tests__/connect-snippets.test.ts +431 -0
- package/src/shared/mcp/__tests__/useCopyFeedback.test.ts +112 -0
- package/src/shared/mcp/connect-snippets.ts +353 -0
- package/src/shared/mcp/index.ts +28 -0
- package/src/shared/mcp/useCopyFeedback.ts +46 -0
- package/src/test-setup.ts +11 -0
|
@@ -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 {
|
|
5
|
-
import { ownersTextOf, primaryFolderOf } from '../utils/
|
|
6
|
-
import { AlreadyReadableError,
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
33
|
-
|
|
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
|
|
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
|
|
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(
|
|
47
|
+
const admins = adminNamesOf(plugin);
|
|
48
48
|
// The prose name for the same people, from the SAME helper the member view
|
|
49
|
-
// uses — a
|
|
50
|
-
const adminsText = ownersTextOf(
|
|
51
|
-
const primaryFolder = primaryFolderOf(
|
|
52
|
-
const pending =
|
|
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
|
|
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
|
|
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
|
|
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={
|
|
84
|
-
All
|
|
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
|
-
{
|
|
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">{
|
|
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
|
-
|
|
104
|
-
<p className="mt-1 text-ui text-ink-muted">{countsLine(
|
|
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
|
|
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
|
-
{
|
|
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(
|
|
138
|
-
const skills = `${
|
|
139
|
-
const tools = `${
|
|
140
|
-
return `${skills} · ${tools}. Visible
|
|
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(
|
|
152
|
-
const owners = [...
|
|
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 [...
|
|
155
|
+
return [...plugin.writers.users.map((u) => u.name), ...plugin.writers.roles].filter(
|
|
156
156
|
(s) => s.length > 0,
|
|
157
157
|
);
|
|
158
158
|
}
|
package/src/modules/library/components/{ManagedGroupRequests.tsx → ManagedPluginRequests.tsx}
RENAMED
|
@@ -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 {
|
|
5
|
+
import { PluginJoinRequests } from './PluginJoinRequests';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* Every pending join request the CALLER can answer, one banner per
|
|
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
|
|
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-
|
|
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
|
|
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
|
|
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
|
|
22
|
-
const {
|
|
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
|
-
|
|
31
|
+
pluginSummaries
|
|
32
32
|
.filter((g) => g.canWrite)
|
|
33
33
|
.slice()
|
|
34
34
|
.sort((a, b) => a.name.localeCompare(b.name)),
|
|
35
|
-
[
|
|
35
|
+
[pluginSummaries],
|
|
36
36
|
);
|
|
37
37
|
|
|
38
38
|
return (
|
|
39
39
|
<>
|
|
40
40
|
{managed.map((g) => (
|
|
41
|
-
<
|
|
41
|
+
<PluginJoinRequests
|
|
42
42
|
key={g.name}
|
|
43
|
-
|
|
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
|
-
|
|
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 {
|
|
5
|
-
import {
|
|
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
|
|
9
|
-
/** Names already taken — readable
|
|
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
|
|
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
|
|
17
|
+
* Make a plugin — the prototype's `newSpaceModal` (line 2769).
|
|
18
18
|
*
|
|
19
|
-
* A
|
|
20
|
-
* endpoint (`POST /api/
|
|
21
|
-
* under `
|
|
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
|
|
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
|
|
25
|
+
* response arrives, the plugin exists and it is yours.
|
|
26
26
|
*/
|
|
27
|
-
export function
|
|
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
|
|
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 `
|
|
39
|
-
* `
|
|
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
|
|
43
|
+
? 'A plugin with that name already exists.'
|
|
44
44
|
: illegal
|
|
45
|
-
? "A
|
|
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
|
|
55
|
+
const { folder } = await createPlugin(trimmed);
|
|
56
56
|
onCreated();
|
|
57
57
|
onClose();
|
|
58
|
-
navigate(
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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="
|
|
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
|
|
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 (`
|
|
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
|
*/
|
|
@@ -60,8 +60,8 @@ export function NewSkillPanel({
|
|
|
60
60
|
const trimmed = name.trim();
|
|
61
61
|
/**
|
|
62
62
|
* 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 `
|
|
64
|
-
* applies to
|
|
63
|
+
* are the characters a name cannot have — the same rule `NewPluginDialog`
|
|
64
|
+
* applies to plugins, and the same one the backend enforces (`isSafeName`).
|
|
65
65
|
*/
|
|
66
66
|
const illegal = /[/\\]/.test(trimmed) || trimmed === '.' || trimmed === '..';
|
|
67
67
|
/**
|
|
@@ -103,7 +103,7 @@ export function NewSkillPanel({
|
|
|
103
103
|
// A proposal has no page yet — the skill exists only on the author's
|
|
104
104
|
// branch. It appears right here as an "In review" card (the pending
|
|
105
105
|
// shelf), which is also where its review happens.
|
|
106
|
-
toast(`Created ${trimmed}: sent to the
|
|
106
|
+
toast(`Created ${trimmed}: sent to the plugin's owners for review.`, 'ok');
|
|
107
107
|
}
|
|
108
108
|
} catch (err) {
|
|
109
109
|
// The workspace API forwards the backend's own refusal (e.g. "You don't
|
|
@@ -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
|
|
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,7 +33,7 @@ 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
|
|
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
|
*/
|
|
@@ -128,7 +128,7 @@ export function PageActions({
|
|
|
128
128
|
>
|
|
129
129
|
<span className="flex items-center gap-2.5">
|
|
130
130
|
<Trash2 size={14} />
|
|
131
|
-
Delete
|
|
131
|
+
Delete plugin
|
|
132
132
|
</span>
|
|
133
133
|
</MenuItem>
|
|
134
134
|
)}
|
|
@@ -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
|
|
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
|
|
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 `
|
|
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
|
|
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
|
|
60
|
+
{`It lands in ${name}. Yours alone until you add it to a plugin.`}
|
|
61
61
|
</p>
|
|
62
62
|
|
|
63
63
|
{isAdmin && (
|
|
@@ -5,23 +5,23 @@ import { useLibrary, type LibraryItem } from '../state/library-data';
|
|
|
5
5
|
import { useLibraryToast } from '../state/toast.context';
|
|
6
6
|
import { urlForItemFile } from '../routes/library-paths';
|
|
7
7
|
import { useWorkspace } from '../../workspace/state/workspace.context';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
} from './
|
|
8
|
+
import { personalPluginName } from '../utils/personal-plugin';
|
|
9
|
+
import { PluginBreadcrumb, PluginItemSections, PageNote, RemoveLibraryItemDialog,
|
|
10
|
+
} from './plugin-page-parts';
|
|
11
11
|
import { PageActions } from './PageActions';
|
|
12
12
|
import { PersonalAddDialog } from './PersonalAddDialog';
|
|
13
13
|
import { copyToClipboard } from '../utils/clipboard';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
* A person's own space, as a
|
|
16
|
+
* A person's own space, as a plugin: `/skills-and-tools/yours`.
|
|
17
17
|
*
|
|
18
|
-
* These are the items in NO
|
|
19
|
-
* and the skills no
|
|
20
|
-
* alone", a heading and a flat grid); now they get the same page every
|
|
18
|
+
* These are the items in NO plugin folder — the sign-ins that are yours alone
|
|
19
|
+
* and the skills no plugin has adopted. They were a filtered gallery ("Yours
|
|
20
|
+
* alone", a heading and a flat grid); now they get the same page every plugin
|
|
21
21
|
* gets, because from where you stand it is the same kind of thing: a place
|
|
22
22
|
* with your skills and your tools in it.
|
|
23
23
|
*
|
|
24
|
-
* It carries the same actions every
|
|
24
|
+
* It carries the same actions every plugin page carries, because it is the same
|
|
25
25
|
* kind of thing — with ONE exception, and it is a real one rather than a
|
|
26
26
|
* decision:
|
|
27
27
|
*
|
|
@@ -34,7 +34,7 @@ import { copyToClipboard } from '../utils/clipboard';
|
|
|
34
34
|
* Giving a person's own items a home folder is a backend change, and until
|
|
35
35
|
* that exists this stays absent.
|
|
36
36
|
*/
|
|
37
|
-
export function
|
|
37
|
+
export function PersonalPluginPage() {
|
|
38
38
|
const data = useLibrary();
|
|
39
39
|
const navigate = useNavigate();
|
|
40
40
|
const { kbDirName } = useWorkspace();
|
|
@@ -44,12 +44,12 @@ export function PersonalGroupPage() {
|
|
|
44
44
|
/** The card being removed, while its confirm dialog is up. */
|
|
45
45
|
const [removing, setRemoving] = useState<LibraryItem | null>(null);
|
|
46
46
|
|
|
47
|
-
const name =
|
|
48
|
-
const items = useMemo(() => data.items.filter((i) => i.
|
|
47
|
+
const name = personalPluginName(user?.name);
|
|
48
|
+
const items = useMemo(() => data.items.filter((i) => i.plugin === null), [data.items]);
|
|
49
49
|
/**
|
|
50
50
|
* For the add dialog's name check. Every skill, not only the ungrouped ones:
|
|
51
51
|
* a skill's id is its name and ids are global, so a new skill here collides
|
|
52
|
-
* with a
|
|
52
|
+
* with a plugin's just as surely as with one of your own.
|
|
53
53
|
*/
|
|
54
54
|
const allSkillNames = useMemo(
|
|
55
55
|
() => data.items.filter((i) => i.kind === 'skill').map((i) => i.name),
|
|
@@ -58,7 +58,7 @@ export function PersonalGroupPage() {
|
|
|
58
58
|
const skillItems = items.filter((i) => i.kind === 'skill');
|
|
59
59
|
const toolItems = items.filter((i) => i.kind === 'integration');
|
|
60
60
|
|
|
61
|
-
/** Identical to the gallery's and the
|
|
61
|
+
/** Identical to the gallery's and the plugin page's — one behaviour per card. */
|
|
62
62
|
function openItem(item: LibraryItem) {
|
|
63
63
|
if (kbDirName) navigate(urlForItemFile(kbDirName, item.path));
|
|
64
64
|
}
|
|
@@ -69,9 +69,9 @@ export function PersonalGroupPage() {
|
|
|
69
69
|
|
|
70
70
|
return (
|
|
71
71
|
<div className="pb-14">
|
|
72
|
-
<
|
|
72
|
+
<PluginBreadcrumb name={name} />
|
|
73
73
|
|
|
74
|
-
{/* The same title row every
|
|
74
|
+
{/* The same title row every plugin page has. The description line that
|
|
75
75
|
used to sit under it is gone: "Only you see this" is what the page's
|
|
76
76
|
own name already says, and a subtitle explaining a heading is the
|
|
77
77
|
heading admitting it did not work (proto: the personal list carries
|
|
@@ -87,7 +87,7 @@ export function PersonalGroupPage() {
|
|
|
87
87
|
</div>
|
|
88
88
|
</div>
|
|
89
89
|
|
|
90
|
-
<
|
|
90
|
+
<PluginItemSections
|
|
91
91
|
skillItems={skillItems}
|
|
92
92
|
toolItems={toolItems}
|
|
93
93
|
onOpen={openItem}
|
|
@@ -95,7 +95,7 @@ export function PersonalGroupPage() {
|
|
|
95
95
|
// per-path gate agrees, since your personal folder names you as owner.
|
|
96
96
|
onRemove={setRemoving}
|
|
97
97
|
// An empty room should say what to do in it, not explain its own filing
|
|
98
|
-
// rule. "Anything your agent writes outside a
|
|
98
|
+
// rule. "Anything your agent writes outside a plugin lands here" was
|
|
99
99
|
// true and told nobody how to make the first thing appear.
|
|
100
100
|
emptySkills="No skills of your own yet. Ask your agent to create skills."
|
|
101
101
|
emptyTools="No sign-ins of your own yet."
|