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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/LICENSE +202 -202
  2. package/THIRD-PARTY-NOTICES.md +344 -988
  3. package/package.json +5 -5
  4. package/src/core/CoreAppShell.tsx +4 -4
  5. package/src/core/__tests__/ShellRoutes.test.tsx +1 -1
  6. package/src/core/__tests__/bootstrap.test.ts +47 -2
  7. package/src/core/bootstrap.ts +20 -0
  8. package/src/css-side-effect-imports.d.ts +7 -7
  9. package/src/modules/access/__tests__/ManageAccessDialog.placement.test.tsx +1 -1
  10. package/src/modules/access/__tests__/ManageAccessDialog.test.tsx +5 -5
  11. package/src/modules/access/api.ts +5 -5
  12. package/src/modules/access/components/ManageAccessDialog.tsx +21 -20
  13. package/src/modules/admin/__tests__/AdminRolesPage.suggest.test.tsx +1 -1
  14. package/src/modules/admin/components/AdminRolesPage.tsx +1 -1
  15. package/src/modules/change-requests/__tests__/useFileOnBranch.test.tsx +2 -2
  16. package/src/modules/change-requests/components/ChangeRequestDialog.tsx +1 -1
  17. package/src/modules/change-requests/hooks/useApplyChangeRequest.ts +1 -1
  18. package/src/modules/layout/__tests__/SidebarFrameResponsive.test.tsx +4 -4
  19. package/src/modules/layout/__tests__/SidebarToggle.test.tsx +4 -4
  20. package/src/modules/layout/__tests__/breakpoints.test.ts +1 -1
  21. package/src/modules/layout/components/SidebarFrame.tsx +2 -2
  22. package/src/modules/library/__tests__/{AddToGroupDialog.test.tsx → AddToPluginDialog.test.tsx} +34 -34
  23. package/src/modules/library/__tests__/LibraryCard.test.tsx +30 -11
  24. package/src/modules/library/__tests__/LibraryRoutes.test.tsx +84 -59
  25. package/src/modules/library/__tests__/LibrarySidebarMenu.test.tsx +51 -51
  26. package/src/modules/library/__tests__/{LockedGroupView.test.tsx → LockedPluginView.test.tsx} +33 -33
  27. package/src/modules/library/__tests__/McpServerSection.test.tsx +138 -0
  28. package/src/modules/library/__tests__/{NewGroupDialog.test.tsx → NewPluginDialog.test.tsx} +22 -22
  29. package/src/modules/library/__tests__/PersonalAddDialog.test.tsx +7 -7
  30. package/src/modules/library/__tests__/PluginExtras.test.tsx +131 -0
  31. package/src/modules/library/__tests__/{GroupJoinRequests.test.tsx → PluginJoinRequests.test.tsx} +24 -24
  32. package/src/modules/library/__tests__/{GroupPage.test.tsx → PluginPage.test.tsx} +101 -101
  33. package/src/modules/library/__tests__/{GroupsIndexPage.test.tsx → PluginsIndexPage.test.tsx} +57 -57
  34. package/src/modules/library/__tests__/{GroupsSidebar.contextmenu.test.tsx → PluginsSidebar.contextmenu.test.tsx} +31 -31
  35. package/src/modules/library/__tests__/{GroupsSidebar.locked.test.tsx → PluginsSidebar.locked.test.tsx} +28 -28
  36. package/src/modules/library/__tests__/{GroupsSidebar.test.tsx → PluginsSidebar.test.tsx} +39 -39
  37. package/src/modules/library/__tests__/{GroupsSidebarMenu.test.tsx → PluginsSidebarMenu.test.tsx} +18 -18
  38. package/src/modules/library/__tests__/SkillPage.test.tsx +8 -8
  39. package/src/modules/library/__tests__/ToolConnectionSection.test.tsx +2 -2
  40. package/src/modules/library/__tests__/ToolPage.test.tsx +41 -12
  41. package/src/modules/library/__tests__/ToolSharePanel.test.tsx +1 -1
  42. package/src/modules/library/__tests__/WorkspaceItemRoute.test.tsx +57 -57
  43. package/src/modules/library/__tests__/auth-harness.tsx +4 -4
  44. package/src/modules/library/__tests__/status.test.ts +19 -19
  45. package/src/modules/library/__tests__/tools.api.test.ts +70 -0
  46. package/src/modules/library/__tests__/useToolPage.test.tsx +4 -4
  47. package/src/modules/library/components/AccessRequestsBanner.tsx +8 -8
  48. package/src/modules/library/components/{AddToGroupDialog.tsx → AddToPluginDialog.tsx} +11 -11
  49. package/src/modules/library/components/ChangeRequestDock.tsx +1 -1
  50. package/src/modules/library/components/{DeleteGroupDialog.tsx → DeletePluginDialog.tsx} +9 -9
  51. package/src/modules/library/components/LibraryCard.tsx +26 -2
  52. package/src/modules/library/components/LibraryLayout.tsx +70 -70
  53. package/src/modules/library/components/LibraryPage.tsx +8 -8
  54. package/src/modules/library/components/LockGlyph.tsx +1 -1
  55. package/src/modules/library/components/{LockedGroupView.tsx → LockedPluginView.tsx} +35 -35
  56. package/src/modules/library/components/{ManagedGroupRequests.tsx → ManagedPluginRequests.tsx} +13 -13
  57. package/src/modules/library/components/{NewGroupDialog.tsx → NewPluginDialog.tsx} +24 -24
  58. package/src/modules/library/components/NewSkillPanel.tsx +5 -5
  59. package/src/modules/library/components/PageActions.tsx +3 -3
  60. package/src/modules/library/components/PersonalAddDialog.tsx +5 -5
  61. package/src/modules/library/components/{PersonalGroupPage.tsx → PersonalPluginPage.tsx} +17 -17
  62. package/src/modules/library/components/PluginExtras.tsx +195 -0
  63. package/src/modules/library/components/{GroupIndexRow.tsx → PluginIndexRow.tsx} +6 -6
  64. package/src/modules/library/components/{GroupJoinRequests.tsx → PluginJoinRequests.tsx} +12 -12
  65. package/src/modules/library/components/{GroupPage.tsx → PluginPage.tsx} +72 -69
  66. package/src/modules/library/components/{GroupsIndexPage.tsx → PluginsIndexPage.tsx} +46 -46
  67. package/src/modules/library/components/{GroupsSidebar.tsx → PluginsSidebar.tsx} +55 -55
  68. package/src/modules/library/components/{GroupsSidebarMenu.tsx → PluginsSidebarMenu.tsx} +15 -15
  69. package/src/modules/library/components/{group-page-parts.tsx → plugin-page-parts.tsx} +35 -24
  70. package/src/modules/library/components/skill-page/SkillPage.tsx +12 -12
  71. package/src/modules/library/components/tool-page/McpServerSection.tsx +380 -0
  72. package/src/modules/library/components/tool-page/ToolPage.tsx +22 -5
  73. package/src/modules/library/hooks/useJoinRequests.ts +8 -8
  74. package/src/modules/library/routes/LibraryRoutes.tsx +30 -17
  75. package/src/modules/library/routes/WorkspaceItemRoute.tsx +24 -24
  76. package/src/modules/library/routes/library-paths.ts +36 -36
  77. package/src/modules/library/services/library.api.ts +9 -9
  78. package/src/modules/library/services/{groups.api.ts → plugins.api.ts} +43 -43
  79. package/src/modules/library/services/tools.api.ts +54 -0
  80. package/src/modules/library/state/library-data.tsx +46 -46
  81. package/src/modules/library/utils/names.ts +1 -1
  82. package/src/modules/library/utils/{personal-group.ts → personal-plugin.ts} +8 -8
  83. package/src/modules/library/utils/{group-summary.ts → plugin-summary.ts} +14 -14
  84. package/src/modules/library/utils/status.ts +17 -17
  85. package/src/modules/onboarding/__tests__/onboarding.test.tsx +86 -8
  86. package/src/modules/onboarding/agent-clients.ts +18 -14
  87. package/src/modules/onboarding/components/WelcomePage.tsx +19 -8
  88. package/src/modules/review/components/MarkdownDiffViewer.tsx +1 -1
  89. package/src/modules/review/components/ReviewPanel.tsx +11 -11
  90. package/src/modules/review/components/__tests__/{isGroupItemPath.test.ts → isPluginItemPath.test.ts} +24 -24
  91. package/src/modules/secrets-vault/components/ToolSecretsPanel.tsx +3 -3
  92. package/src/modules/secrets-vault/components/__tests__/SecretsPage.test.tsx +1 -1
  93. package/src/modules/settings/components/SettingsLayout.tsx +1 -1
  94. package/src/modules/settings/components/SettingsNav.tsx +5 -5
  95. package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +29 -107
  96. package/src/modules/toolbar/components/__tests__/AppSwitcher.test.tsx +1 -1
  97. package/src/modules/toolbar/components/__tests__/ExternalAgentAccessPage.test.tsx +228 -0
  98. package/src/modules/toolbar/components/__tests__/Toolbar.test.tsx +3 -3
  99. package/src/modules/workspace/components/FileExplorer.tsx +12 -12
  100. package/src/modules/workspace/components/__tests__/FileExplorer.test.tsx +14 -14
  101. package/src/modules/workspace/components/renderers/ToolRenderer.tsx +7 -2
  102. package/src/modules/workspace/utils/__tests__/diff.test.ts +1 -1
  103. package/src/modules/workspace/utils/fileTree.ts +3 -3
  104. package/src/shared/mcp/ClaudeInstallLink.tsx +88 -0
  105. package/src/shared/mcp/ConnectionInstructions.tsx +51 -0
  106. package/src/shared/mcp/CopyBlock.tsx +42 -0
  107. package/src/shared/mcp/__tests__/ClaudeInstallLink.test.tsx +40 -0
  108. package/src/shared/mcp/__tests__/connect-snippets.test.ts +431 -0
  109. package/src/shared/mcp/__tests__/useCopyFeedback.test.ts +112 -0
  110. package/src/shared/mcp/connect-snippets.ts +353 -0
  111. package/src/shared/mcp/index.ts +28 -0
  112. package/src/shared/mcp/useCopyFeedback.ts +46 -0
  113. package/src/test-setup.ts +11 -0
@@ -3,13 +3,13 @@ import {
3
3
  DATA_DIR,
4
4
  KNOWLEDGE_BASE_DIR,
5
5
  PIPELINES_DIR,
6
- GROUPS_DIR,
6
+ PLUGINS_DIR,
7
7
  type FileTreeEntry,
8
8
  } from '@bevel-software/platform-shared';
9
9
  import type { PendingEntry } from '../state/workspace.context';
10
10
 
11
11
  // RESERVED is not the same as CREATED (see kb-layout.ts): core only seeds
12
- // KnowledgeBase/ and Groups/, but every reserved name renders as its own root
12
+ // KnowledgeBase/ and Plugins/, but every reserved name renders as its own root
13
13
  // when present — a distribution that owns the execution layer seeds Data/,
14
14
  // Agents/ and Pipelines/, and a KB that has them must not see them folded
15
15
  // into Knowledge as stray content.
@@ -18,7 +18,7 @@ export const KB_ROOT_DIRS = new Set([
18
18
  DATA_DIR,
19
19
  AGENTS_DIR,
20
20
  PIPELINES_DIR,
21
- GROUPS_DIR,
21
+ PLUGINS_DIR,
22
22
  ]);
23
23
 
24
24
  /**
@@ -0,0 +1,88 @@
1
+ import { ExternalLink } from 'lucide-react';
2
+ import { cn } from '../../lib/utils';
3
+ import { buttonClasses } from '../components';
4
+ import { canDeepLink, claudeInstallUrl, connectorName } from './connect-snippets';
5
+
6
+ /**
7
+ * One click instead of "copy this, open claude.ai, find Settings, find
8
+ * Connectors, find Add custom connector, paste".
9
+ *
10
+ * Anthropic publishes an install link that opens the add-custom-connector
11
+ * dialog with the name and URL prefilled. It only PREFILLS — the person still
12
+ * reviews and confirms, and Claude marks the values as having come from an
13
+ * external link. So this is a shortcut through a menu, not a grant of
14
+ * anything, which is why it needs no warning of its own.
15
+ *
16
+ * It renders nothing when the endpoint cannot possibly be reached from
17
+ * Anthropic's side (see `canDeepLink` — plain http, localhost, private
18
+ * ranges). That is the default configuration, not an edge case, and a bright
19
+ * button that always fails is worse on a first-run screen than no button.
20
+ *
21
+ * `showHint` is for the surface whose audience can DO something about it. On
22
+ * the settings page the reader is plausibly the person holding the env file,
23
+ * so the dead state names the variable to set. On the welcome page the reader
24
+ * is an employee who cannot change deployment config, and telling them about
25
+ * `PUBLIC_BACKEND_URL` is noise — they just get the copy-paste URL, which
26
+ * works regardless.
27
+ */
28
+ /**
29
+ * The address with any userinfo removed, for rendering. `configureMcpUrl`
30
+ * strips credentials at the boot boundary, but this component is exported and
31
+ * takes `mcpUrl` as a prop — a caller that bypasses that door must not get a
32
+ * password printed into the hint. An unparseable value passes through: it is
33
+ * not a URL, so it has no userinfo component to strip.
34
+ */
35
+ function withoutCredentials(mcpUrl: string): string {
36
+ try {
37
+ const parsed = new URL(mcpUrl);
38
+ parsed.username = '';
39
+ parsed.password = '';
40
+ return parsed.toString();
41
+ } catch {
42
+ return mcpUrl;
43
+ }
44
+ }
45
+
46
+ export function ClaudeInstallLink({
47
+ mcpUrl,
48
+ showHint = false,
49
+ className,
50
+ }: {
51
+ mcpUrl: string;
52
+ showHint?: boolean;
53
+ /**
54
+ * Spacing belongs to the caller, ON the element — a wrapping `<div>` with a
55
+ * margin would leave a gap behind on the surface where this renders
56
+ * nothing.
57
+ */
58
+ className?: string;
59
+ }) {
60
+ if (!canDeepLink(mcpUrl)) {
61
+ if (!showHint) return null;
62
+ return (
63
+ /* `text-meta`, not the arbitrary pixel size its neighbours use: those
64
+ predate the token scale and the ratchet counts every one of them, so
65
+ new copy goes on-scale even when it sits beside copy that is not. */
66
+ <p className={cn('text-meta text-ink-muted leading-snug', className)}>
67
+ One-click connect is off because this deployment&rsquo;s public address is{' '}
68
+ <code className="font-mono">{withoutCredentials(mcpUrl)}</code>, which Claude cannot reach from the
69
+ internet. Set <code className="font-mono">PUBLIC_BACKEND_URL</code> to the https
70
+ address people actually use to turn it on. The URL below works either way.
71
+ </p>
72
+ );
73
+ }
74
+
75
+ return (
76
+ <a
77
+ href={claudeInstallUrl(mcpUrl, connectorName(mcpUrl))}
78
+ target="_blank"
79
+ rel="noopener noreferrer"
80
+ className={buttonClasses({ variant: 'primary', size: 'sm', className })}
81
+ >
82
+ Add to Claude
83
+ {/* Decoration: the link's own text is its accessible name, and a second
84
+ reading of "external link" adds nothing for a screen reader. */}
85
+ <ExternalLink size={12} className="opacity-70" aria-hidden="true" />
86
+ </a>
87
+ );
88
+ }
@@ -0,0 +1,51 @@
1
+ import { CopyBlock } from './CopyBlock';
2
+ import { ClaudeInstallLink } from './ClaudeInstallLink';
3
+ import { claudeCodeCommand, jsonConfigSnippet } from './connect-snippets';
4
+
5
+ /**
6
+ * How to point an interactive agent at this workspace: the three
7
+ * no-key connection configs, plus the one-click Claude install link when the
8
+ * deployment is reachable enough for it to work.
9
+ *
10
+ * Its own component rather than a block inside `ExternalAgentAccessPage`
11
+ * because that page fetches external API keys on mount. Testing "does the
12
+ * install button appear" by rendering the whole page meant mocking the
13
+ * credential API first — a test coupled to code it does not care about, which
14
+ * breaks whenever that API changes. This takes a URL and renders; there is
15
+ * nothing to mock.
16
+ *
17
+ * Every URL here comes from the one `mcpUrl` prop. That is the point: the
18
+ * six sites this replaced each rebuilt the address from
19
+ * `window.location.origin`, which is the browser's idea of where we are
20
+ * rather than the deployment's.
21
+ */
22
+ export function ConnectionInstructions({ mcpUrl }: { mcpUrl: string }) {
23
+ return (
24
+ <>
25
+ <CopyBlock label="Connect Claude Code" value={claudeCodeCommand(mcpUrl)} rows={2} />
26
+ <div>
27
+ <div className="text-xs font-medium text-ink mb-1">claude.ai / Claude Desktop</div>
28
+ {/* The button first, then the manual route underneath — the fallback
29
+ has to stay visible, because one-click is unavailable on any
30
+ deployment Claude cannot reach and the copy-paste URL is the only
31
+ thing that always works. */}
32
+ <div className="mb-1.5">
33
+ <ClaudeInstallLink mcpUrl={mcpUrl} showHint />
34
+ </div>
35
+ <p className="text-[11px] text-ink-muted mb-1 leading-snug">
36
+ Or add it by hand: Settings → Connectors → Add custom connector, then paste this
37
+ URL. When asked to authorize, your browser opens this app to finish connecting.
38
+ </p>
39
+ <CopyBlock label={null} value={mcpUrl} rows={1} />
40
+ </div>
41
+ <div>
42
+ <div className="text-xs font-medium text-ink mb-1">Other agents (JSON config)</div>
43
+ <p className="text-[11px] text-ink-muted mb-1 leading-snug">
44
+ Works with Cursor, Windsurf, Cline, and most clients that load servers from a JSON
45
+ config and support signing in.
46
+ </p>
47
+ <CopyBlock label={null} value={jsonConfigSnippet(mcpUrl)} rows={9} />
48
+ </div>
49
+ </>
50
+ );
51
+ }
@@ -0,0 +1,42 @@
1
+ import { Check, Copy } from 'lucide-react';
2
+ import { useCopyFeedback } from './useCopyFeedback';
3
+
4
+ /** Read-only snippet with a copy button, for the no-key connection configs. */
5
+ export function CopyBlock({
6
+ label,
7
+ value,
8
+ rows,
9
+ }: {
10
+ label: string | null;
11
+ value: string;
12
+ rows: number;
13
+ }) {
14
+ const { copied, copy } = useCopyFeedback();
15
+
16
+ return (
17
+ <div>
18
+ <div className="flex items-center justify-between mb-1">
19
+ {label !== null && <div className="text-xs font-medium text-ink">{label}</div>}
20
+ <button
21
+ // Explicit: a bare <button> inside a <form> defaults to `submit`,
22
+ // and this is a shared component now — it does not get to assume
23
+ // which tree it renders in.
24
+ type="button"
25
+ onClick={() => copy(value)}
26
+ className="ml-auto p-1 rounded hover:bg-hover text-ink-muted"
27
+ aria-label={label ? `Copy: ${label}` : 'Copy to clipboard'}
28
+ title="Copy to clipboard"
29
+ >
30
+ {copied ? <Check size={14} /> : <Copy size={14} />}
31
+ </button>
32
+ </div>
33
+ <textarea
34
+ readOnly
35
+ value={value}
36
+ rows={rows}
37
+ className="w-full font-mono text-[11px] bg-sunken border border-line rounded px-2 py-1.5 resize-none"
38
+ onFocus={(e) => e.currentTarget.select()}
39
+ />
40
+ </div>
41
+ );
42
+ }
@@ -0,0 +1,40 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { render, screen } from '@testing-library/react';
3
+ import { ClaudeInstallLink } from '../ClaudeInstallLink';
4
+
5
+ /**
6
+ * The three states of the connect affordance: a live button on a reachable
7
+ * address, nothing on a dead one, and the operator hint when asked for — plus
8
+ * the rule that the hint never prints a credential, whatever it was handed.
9
+ */
10
+ describe('ClaudeInstallLink', () => {
11
+ it('renders the install link for a reachable https address', () => {
12
+ render(<ClaudeInstallLink mcpUrl="https://kb.acme.com/api/mcp" />);
13
+ const link = screen.getByRole('link', { name: 'Add to Claude' });
14
+ expect(link).toHaveAttribute('href', expect.stringContaining('claude.ai'));
15
+ });
16
+
17
+ it('renders nothing for an unreachable address without the hint', () => {
18
+ const { container } = render(<ClaudeInstallLink mcpUrl="http://localhost:3001/api/mcp" />);
19
+ expect(container).toBeEmptyDOMElement();
20
+ });
21
+
22
+ it('names the dead address in the hint', () => {
23
+ render(<ClaudeInstallLink mcpUrl="http://localhost:3001/api/mcp" showHint />);
24
+ expect(screen.getByText('http://localhost:3001/api/mcp')).toBeInTheDocument();
25
+ expect(screen.getByText(/PUBLIC_BACKEND_URL/)).toBeInTheDocument();
26
+ });
27
+
28
+ /**
29
+ * `configureMcpUrl` strips credentials at the boot boundary, but `mcpUrl`
30
+ * is a prop — a caller that bypasses that door must not get the password
31
+ * printed on screen. (`canDeepLink` already refuses such a URL, which is
32
+ * exactly what routes it INTO the hint branch.)
33
+ */
34
+ it('strips credentials from the URL it prints, rather than leaking a bypass caller’s secret', () => {
35
+ render(<ClaudeInstallLink mcpUrl="http://someone:hunter2@kb.acme.com/api/mcp" showHint />);
36
+ expect(screen.getByText('http://kb.acme.com/api/mcp')).toBeInTheDocument();
37
+ expect(screen.queryByText(/hunter2/)).not.toBeInTheDocument();
38
+ expect(screen.queryByText(/someone/)).not.toBeInTheDocument();
39
+ });
40
+ });