@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
@@ -0,0 +1,380 @@
1
+ import { useEffect, useState } from 'react';
2
+ import { useNavigate } from 'react-router-dom';
3
+ import { Badge, Banner, Button, Dialog } from '../../../../shared/components';
4
+ import {
5
+ getMcpServer,
6
+ putMcpServer,
7
+ type McpServerView,
8
+ type McpTransport,
9
+ } from '../../services/tools.api';
10
+ import { pathForTool } from '../../routes/library-paths';
11
+
12
+ /**
13
+ * The server-scoped editor for an mcp.json-backed tool — the form that
14
+ * replaces dropping a writer into raw JSON. It shows nothing for `.tool`
15
+ * manuals (the GET 404s: those edit as files) and renders read-only facts for
16
+ * non-writers, whose editing surface this page has never been.
17
+ *
18
+ * RENAME CONFIRMS, WITH THE COST NAMED. The server's name is the namespace
19
+ * its vault secrets bind to (`<name>_<VAR>`), so renaming disconnects every
20
+ * configured value and completed sign-in under the old name. The page already
21
+ * knows how many that is; the dialog says the number instead of "are you
22
+ * sure".
23
+ */
24
+ export function McpServerSection({
25
+ slug,
26
+ configuredCount,
27
+ onSaved,
28
+ onError,
29
+ }: {
30
+ slug: string;
31
+ /** Configured secrets + sign-ins under this server's name — what a rename disconnects. */
32
+ configuredCount: number;
33
+ /** Called after a save lands; the new slug when the server was renamed. */
34
+ onSaved(newSlug?: string): void;
35
+ onError(message: string): void;
36
+ }) {
37
+ const navigate = useNavigate();
38
+ const [server, setServer] = useState<McpServerView | null>(null);
39
+ const [editing, setEditing] = useState(false);
40
+ const [saving, setSaving] = useState(false);
41
+ const [confirmingRename, setConfirmingRename] = useState(false);
42
+
43
+ // Draft fields, seeded from the loaded view when editing opens.
44
+ const [name, setName] = useState('');
45
+ const [transport, setTransport] = useState<McpTransport>('streamable-http');
46
+ const [url, setUrl] = useState('');
47
+ const [command, setCommand] = useState('');
48
+ const [args, setArgs] = useState('');
49
+ const [literalHeaders, setLiteralHeaders] = useState('');
50
+ const [authHeaders, setAuthHeaders] = useState('');
51
+ const [local, setLocal] = useState(false);
52
+ const [variables, setVariables] = useState<McpServerView['variables']>([]);
53
+
54
+ useEffect(() => {
55
+ let live = true;
56
+ getMcpServer(slug)
57
+ .then((view) => {
58
+ if (live) setServer(view);
59
+ })
60
+ .catch((err: unknown) => {
61
+ // A 404 already came back as null (a .tool-backed manual). Anything
62
+ // ELSE is a real failure, and vanishing silently would make it
63
+ // indistinguishable from that expected case.
64
+ if (live) onError(err instanceof Error ? err.message : 'Could not load the server configuration.');
65
+ });
66
+ return () => {
67
+ live = false;
68
+ };
69
+ }, [slug]);
70
+
71
+ if (!server) return null;
72
+
73
+ const openEditor = () => {
74
+ setName(server.name);
75
+ setTransport(server.transport);
76
+ setUrl(server.url ?? '');
77
+ setCommand(server.command ?? '');
78
+ setArgs((server.args ?? []).join('\n'));
79
+ setLiteralHeaders(headersToLines(server.literalHeaders));
80
+ setAuthHeaders(headersToLines(server.authHeaders));
81
+ setLocal(server.local);
82
+ setVariables(server.variables);
83
+ setEditing(true);
84
+ };
85
+
86
+ const save = async () => {
87
+ const renaming = name.trim() !== server.name;
88
+ // EVERY rename confirms: this caller's page only knows their own and the
89
+ // shared credentials — other members' user-scoped values and sign-ins are
90
+ // invisible here, so a zero count proves nothing about what disconnects.
91
+ if (renaming && !confirmingRename) {
92
+ setConfirmingRename(true);
93
+ return;
94
+ }
95
+ setSaving(true);
96
+ setConfirmingRename(false);
97
+ try {
98
+ const result = await putMcpServer(slug, {
99
+ ...(renaming ? { newName: name.trim() } : {}),
100
+ transport,
101
+ ...(transport === 'stdio'
102
+ ? {
103
+ command: command.trim(),
104
+ args: args.split('\n').map((a) => a.trim()).filter(Boolean),
105
+ // `cwd`/`env` have no fields in this form. The PUT preserves
106
+ // omitted fields, but echoing them as read keeps values a
107
+ // hand-edited mcp.json carries safe on any backend semantics.
108
+ ...(server.cwd ? { cwd: server.cwd } : {}),
109
+ ...(server.env ? { env: server.env } : {}),
110
+ }
111
+ : { url: url.trim() }),
112
+ literalHeaders: linesToHeaders(literalHeaders),
113
+ authHeaders: linesToHeaders(authHeaders),
114
+ variables: variables
115
+ .map((v) => ({ ...v, name: v.name.trim(), label: v.label?.trim() || undefined }))
116
+ .filter((v) => v.name.length > 0),
117
+ ...(server.description ? { description: server.description } : {}),
118
+ local,
119
+ });
120
+ setEditing(false);
121
+ if (result.name !== server.name) {
122
+ // The slug IS the name — the old page no longer exists.
123
+ navigate(pathForTool(result.name), { replace: true });
124
+ onSaved(result.name);
125
+ } else {
126
+ setServer(null); // refetch on next render via onSaved's reload
127
+ onSaved();
128
+ }
129
+ } catch (err) {
130
+ onError(err instanceof Error ? err.message : 'Save failed.');
131
+ } finally {
132
+ setSaving(false);
133
+ }
134
+ };
135
+
136
+ return (
137
+ <section className="mt-8">
138
+ <h2 className="mb-2.5 flex items-center gap-2 text-label font-semibold uppercase text-ink-faint">
139
+ Server
140
+ <Badge tone="outline" size="xs" className="uppercase">
141
+ MCP server
142
+ </Badge>
143
+ </h2>
144
+
145
+ {!editing && (
146
+ <div className="flex items-start justify-between gap-4 rounded-md border border-line px-3.5 py-2.5">
147
+ <dl className="min-w-0 text-detail text-ink-muted">
148
+ <div className="flex gap-2">
149
+ <dt className="shrink-0 font-semibold">Transport</dt>
150
+ <dd>{server.transport}</dd>
151
+ </div>
152
+ {server.url && (
153
+ <div className="flex gap-2">
154
+ <dt className="shrink-0 font-semibold">URL</dt>
155
+ <dd className="truncate">{server.url}</dd>
156
+ </div>
157
+ )}
158
+ {server.command && (
159
+ <div className="flex gap-2">
160
+ <dt className="shrink-0 font-semibold">Command</dt>
161
+ <dd className="truncate">
162
+ {server.command} {(server.args ?? []).join(' ')}
163
+ </dd>
164
+ </div>
165
+ )}
166
+ {server.local && (
167
+ <div className="mt-1 text-ink-faint">
168
+ Runs locally — served by hexis-mcp on each member's machine, never by the workspace.
169
+ </div>
170
+ )}
171
+ </dl>
172
+ {server.canWrite && (
173
+ <Button variant="outline" size="sm" onClick={openEditor}>
174
+ Edit server
175
+ </Button>
176
+ )}
177
+ </div>
178
+ )}
179
+
180
+ {editing && (
181
+ <div className="flex flex-col gap-3 rounded-md border border-line px-3.5 py-3">
182
+ <LabeledInput label="Name" value={name} onChange={setName} mono
183
+ hint="The name is this server's secret namespace — renaming disconnects configured secrets." />
184
+ <label className="flex flex-col gap-1 text-detail">
185
+ <span className="font-semibold text-ink">Transport</span>
186
+ <select
187
+ className="rounded-md border border-line bg-white px-2.5 py-1.5 text-ui"
188
+ value={transport}
189
+ onChange={(e) => setTransport(e.target.value as McpTransport)}
190
+ >
191
+ <option value="streamable-http">streamable-http</option>
192
+ <option value="sse">sse (legacy)</option>
193
+ <option value="stdio">stdio — runs on each member's machine</option>
194
+ </select>
195
+ </label>
196
+ {transport === 'stdio' ? (
197
+ <>
198
+ <LabeledInput label="Command" value={command} onChange={setCommand} mono
199
+ hint="A bare executable name, or a ./ path inside the plugin." />
200
+ <LabeledTextarea label="Arguments" value={args} onChange={setArgs}
201
+ hint="One argument per line — spaces inside an argument survive. ${PLUGIN_ROOT} and ${PLUGIN_DATA} expand at launch." />
202
+ </>
203
+ ) : (
204
+ <LabeledInput label="URL" value={url} onChange={setUrl} mono />
205
+ )}
206
+ <LabeledTextarea label="Headers (portable)" value={literalHeaders} onChange={setLiteralHeaders}
207
+ hint="One `Header: value` per line. Visible package data — no secrets here." />
208
+ <LabeledTextarea label="Auth headers" value={authHeaders} onChange={setAuthHeaders}
209
+ hint="One per line; values may use ${VAR} vault references, e.g. `Authorization: Bearer ${API_KEY}`." />
210
+ <VariablesEditor variables={variables} onChange={setVariables} />
211
+ {transport !== 'stdio' && (
212
+ <label className="flex items-center gap-2 text-detail text-ink-muted">
213
+ <input type="checkbox" checked={local} onChange={(e) => setLocal(e.target.checked)} />
214
+ Local-only — reachable only from a member's own machine (e.g. localhost)
215
+ </label>
216
+ )}
217
+ <div className="flex gap-2">
218
+ <Button size="sm" onClick={() => void save()} disabled={saving}>
219
+ {saving ? 'Saving…' : 'Save'}
220
+ </Button>
221
+ <Button variant="quiet" size="sm" onClick={() => setEditing(false)} disabled={saving}>
222
+ Cancel
223
+ </Button>
224
+ </div>
225
+ </div>
226
+ )}
227
+
228
+ {confirmingRename && (
229
+ <Dialog open onClose={() => setConfirmingRename(false)} title="Rename this server?">
230
+ <Banner tone="danger" role="alert" className="mb-3">
231
+ Renaming <b>{server.name}</b> to <b>{name.trim()}</b> disconnects every secret and
232
+ sign-in stored under the old name
233
+ {configuredCount > 0
234
+ ? ` — at least ${configuredCount === 1 ? 'one is' : `${configuredCount} are`} configured from your view alone, and other members' sign-ins disconnect too.`
235
+ : " — including other members' values, which this page cannot see."}
236
+ </Banner>
237
+ <div className="flex justify-end gap-2">
238
+ <Button variant="quiet" size="sm" onClick={() => setConfirmingRename(false)}>
239
+ Keep the name
240
+ </Button>
241
+ <Button size="sm" onClick={() => void save()}>
242
+ Rename anyway
243
+ </Button>
244
+ </div>
245
+ </Dialog>
246
+ )}
247
+ </section>
248
+ );
249
+ }
250
+
251
+ function LabeledInput({
252
+ label,
253
+ value,
254
+ onChange,
255
+ hint,
256
+ mono,
257
+ }: {
258
+ label: string;
259
+ value: string;
260
+ onChange(v: string): void;
261
+ hint?: string;
262
+ mono?: boolean;
263
+ }) {
264
+ return (
265
+ <label className="flex flex-col gap-1 text-detail">
266
+ <span className="font-semibold text-ink">{label}</span>
267
+ <input
268
+ className={`rounded-md border border-line bg-white px-2.5 py-1.5 text-ui ${mono ? 'font-mono' : ''}`}
269
+ value={value}
270
+ onChange={(e) => onChange(e.target.value)}
271
+ />
272
+ {hint && <span className="text-ink-faint">{hint}</span>}
273
+ </label>
274
+ );
275
+ }
276
+
277
+ function LabeledTextarea({
278
+ label,
279
+ value,
280
+ onChange,
281
+ hint,
282
+ }: {
283
+ label: string;
284
+ value: string;
285
+ onChange(v: string): void;
286
+ hint?: string;
287
+ }) {
288
+ return (
289
+ <label className="flex flex-col gap-1 text-detail">
290
+ <span className="font-semibold text-ink">{label}</span>
291
+ <textarea
292
+ className="min-h-16 rounded-md border border-line bg-white px-2.5 py-1.5 font-mono text-ui"
293
+ value={value}
294
+ onChange={(e) => onChange(e.target.value)}
295
+ />
296
+ {hint && <span className="text-ink-faint">{hint}</span>}
297
+ </label>
298
+ );
299
+ }
300
+
301
+ /**
302
+ * Declared `${VAR}`s and who provisions each: `admin` (one shared value, set
303
+ * by a tool writer) or `user` (each member their own, on the Connect page).
304
+ * The names must match the `${VAR}` references in the auth headers — the vault
305
+ * key is `<server>_<VAR>`, derived from exactly these names.
306
+ */
307
+ function VariablesEditor({
308
+ variables,
309
+ onChange,
310
+ }: {
311
+ variables: McpServerView['variables'];
312
+ onChange(next: McpServerView['variables']): void;
313
+ }) {
314
+ const update = (i: number, patch: Partial<McpServerView['variables'][number]>) =>
315
+ onChange(variables.map((v, j) => (j === i ? { ...v, ...patch } : v)));
316
+ return (
317
+ <div className="flex flex-col gap-1 text-detail">
318
+ <span className="font-semibold text-ink">Variables</span>
319
+ {variables.map((v, i) => (
320
+ // Index keys are correct here: rows are edited in place and have no
321
+ // identity beyond their position until saved.
322
+ // eslint-disable-next-line react/no-array-index-key
323
+ <div key={i} className="flex items-center gap-2">
324
+ <input
325
+ aria-label={`Variable ${i + 1} name`}
326
+ className="w-40 rounded-md border border-line bg-white px-2 py-1 font-mono text-ui"
327
+ value={v.name}
328
+ onChange={(e) => update(i, { name: e.target.value })}
329
+ />
330
+ <select
331
+ aria-label={`Variable ${i + 1} scope`}
332
+ className="rounded-md border border-line bg-white px-2 py-1 text-ui"
333
+ value={v.scope}
334
+ onChange={(e) => update(i, { scope: e.target.value as 'admin' | 'user' })}
335
+ >
336
+ <option value="admin">admin — one shared value</option>
337
+ <option value="user">user — each member their own</option>
338
+ </select>
339
+ <input
340
+ aria-label={`Variable ${i + 1} label`}
341
+ className="min-w-0 flex-1 rounded-md border border-line bg-white px-2 py-1 text-ui"
342
+ placeholder="Label shown in the secrets UI"
343
+ value={v.label ?? ''}
344
+ onChange={(e) => update(i, { label: e.target.value || undefined })}
345
+ />
346
+ <Button variant="quiet" size="sm" onClick={() => onChange(variables.filter((_, j) => j !== i))}>
347
+ Remove
348
+ </Button>
349
+ </div>
350
+ ))}
351
+ <div>
352
+ <Button variant="outline" size="sm" onClick={() => onChange([...variables, { name: '', scope: 'admin' }])}>
353
+ Add variable
354
+ </Button>
355
+ </div>
356
+ <span className="text-ink-faint">
357
+ Names must match the {'`${VAR}`'} references in the auth headers; secrets are stored under{' '}
358
+ <code>&lt;server&gt;_&lt;VAR&gt;</code>.
359
+ </span>
360
+ </div>
361
+ );
362
+ }
363
+
364
+ function headersToLines(headers: Record<string, string>): string {
365
+ return Object.entries(headers)
366
+ .map(([k, v]) => `${k}: ${v}`)
367
+ .join('\n');
368
+ }
369
+
370
+ function linesToHeaders(text: string): Record<string, string> {
371
+ const out: Record<string, string> = {};
372
+ for (const line of text.split('\n')) {
373
+ const idx = line.indexOf(':');
374
+ if (idx <= 0) continue;
375
+ const key = line.slice(0, idx).trim();
376
+ const value = line.slice(idx + 1).trim();
377
+ if (key) out[key] = value;
378
+ }
379
+ return out;
380
+ }
@@ -2,6 +2,7 @@ import { useEffect, useState, type ReactNode } from 'react';
2
2
  import { Link, useNavigate, useParams } from 'react-router-dom';
3
3
  import { Banner, Button, buttonClasses } from '../../../../shared/components';
4
4
  import { useToolPage } from '../../hooks/useToolPage';
5
+ import { McpServerSection } from './McpServerSection';
5
6
  import { libraryHomeForItemPath, LIBRARY_ROOT } from '../../routes/library-paths';
6
7
  import { readOAuthFragment } from '../../utils/oauth-fragment';
7
8
  import type { ToolCapability } from '../../services/tools.api';
@@ -52,7 +53,7 @@ export function ToolPage({
52
53
  }, [oauthOutcome]);
53
54
 
54
55
  // Same rule as the skill page: back goes to the page the tool LIVES on —
55
- // its group, or the personal page — never to a root the reader may not
56
+ // its plugin, or the personal page — never to a root the reader may not
56
57
  // have come from. Falls back to the root while the tool is still loading.
57
58
  const home = libraryHomeForItemPath(page.tool?.path ?? '');
58
59
  const backLink = (
@@ -121,10 +122,10 @@ export function ToolPage({
121
122
  )}
122
123
  </div>
123
124
  {/* No `Manage access` here, deliberately. Access is decided at the
124
- GROUP — a tool inherits its folder's `access.md`, so an editor on
125
- this page would either duplicate the group's one or quietly write a
126
- per-file override that nobody looking at the group would see. The
127
- group's `Share` panel is the single place. */}
125
+ PLUGIN — a tool inherits its folder's `access.md`, so an editor on
126
+ this page would either duplicate the plugin's one or quietly write a
127
+ per-file override that nobody looking at the plugin would see. The
128
+ plugin's `Share` panel is the single place. */}
128
129
  </header>
129
130
 
130
131
  {actionError && (
@@ -142,6 +143,22 @@ export function ToolPage({
142
143
  onError={setActionError}
143
144
  />
144
145
 
146
+ {/* Only an mcp-type tool can have an mcp.json server pair — mounting the
147
+ section for inline/http manuals sends a `/server` GET whose 404 is
148
+ guaranteed. (A `.tool`-declared mcp manual still 404s and the section
149
+ self-hides on the null; the type cannot pre-decide that case.) */}
150
+ {tool.type === 'mcp' && (
151
+ <McpServerSection
152
+ slug={tool.slug}
153
+ configuredCount={tool.variables.filter((v) => v.adminConfigured || v.userConfigured || v.authorized === true).length}
154
+ onSaved={() => {
155
+ setActionError(null);
156
+ page.reload();
157
+ }}
158
+ onError={setActionError}
159
+ />
160
+ )}
161
+
145
162
  {page.detail && page.detail.capabilities.length > 0 && (
146
163
  <CapabilitiesSection capabilities={page.detail.capabilities} />
147
164
  )}
@@ -7,15 +7,15 @@ import {
7
7
  reconcileJoinRequest,
8
8
  type JoinProposal,
9
9
  type JoinRequest,
10
- } from '../services/groups.api';
10
+ } from '../services/plugins.api';
11
11
  import { useLibraryToast } from '../state/toast.context';
12
12
 
13
13
  /**
14
- * The join requests one group's managers can answer, and the two ways to
14
+ * The join requests one plugin's managers can answer, and the two ways to
15
15
  * answer them.
16
16
  *
17
17
  * ACCEPTING IS A GRANT, NOT A MERGE. A proposal is "give this principal this
18
- * verb on the group folder", so accepting it calls the ordinary access-grant
18
+ * verb on the plugin folder", so accepting it calls the ordinary access-grant
19
19
  * API — the same endpoint the Manage-access dialog uses, with the same gate,
20
20
  * lock and commit. The request's branch is never merged, so nothing else it
21
21
  * carries can ride in on an approval, and a request naming five people can be
@@ -40,14 +40,14 @@ export interface JoinRequestsState {
40
40
  reload(): void;
41
41
  }
42
42
 
43
- export function useJoinRequests(group: string, folder: string | null): JoinRequestsState {
43
+ export function useJoinRequests(plugin: string, folder: string | null): JoinRequestsState {
44
44
  const [requests, setRequests] = useState<JoinRequest[]>([]);
45
45
  const [revision, setRevision] = useState(0);
46
46
  const toast = useLibraryToast();
47
47
 
48
48
  useEffect(() => {
49
49
  let cancelled = false;
50
- listJoinRequests(group)
50
+ listJoinRequests(plugin)
51
51
  .then((rows) => {
52
52
  if (!cancelled) setRequests(rows);
53
53
  })
@@ -58,7 +58,7 @@ export function useJoinRequests(group: string, folder: string | null): JoinReque
58
58
  return () => {
59
59
  cancelled = true;
60
60
  };
61
- }, [group, revision]);
61
+ }, [plugin, revision]);
62
62
 
63
63
  const reload = useCallback(() => setRevision((r) => r + 1), []);
64
64
 
@@ -92,10 +92,10 @@ export function useJoinRequests(group: string, folder: string | null): JoinReque
92
92
  ),
93
93
  );
94
94
  toast(`${proposal.label} now has ${proposal.verb} access.`);
95
- await reconcileJoinRequest(group, request.number).catch(() => false);
95
+ await reconcileJoinRequest(plugin, request.number).catch(() => false);
96
96
  setRevision((r) => r + 1);
97
97
  },
98
- [folder, group, toast],
98
+ [folder, plugin, toast],
99
99
  );
100
100
 
101
101
  const decline = useCallback(
@@ -4,19 +4,19 @@ import { LibraryProvider, useLibrary } from '../state/library-data';
4
4
  import { useWorkspace } from '../../workspace/state/workspace.context';
5
5
  import { LibraryLayout } from '../components/LibraryLayout';
6
6
  import { LibraryPage } from '../components/LibraryPage';
7
- import { GroupPage } from '../components/GroupPage';
8
- import { GroupsIndexPage } from '../components/GroupsIndexPage';
9
- import { PersonalGroupPage } from '../components/PersonalGroupPage';
10
- import { WelcomePage } from '../../onboarding/components/WelcomePage';
7
+ import { PluginPage } from '../components/PluginPage';
8
+ import { PluginsIndexPage } from '../components/PluginsIndexPage';
9
+ import { PersonalPluginPage } from '../components/PersonalPluginPage';
10
+ import { WelcomeRoute } from '../../onboarding/components/WelcomeRoute';
11
11
  import { WorkspaceItemRoute } from './WorkspaceItemRoute';
12
- import { decodeGroupSegment, LIBRARY_ROOT, urlForItemFile, urlForSkillFile } from './library-paths';
12
+ import { decodePluginSegment, LIBRARY_ROOT, pathForPlugin, urlForItemFile, urlForSkillFile } from './library-paths';
13
13
 
14
14
  /**
15
15
  * The Skills & Tools surface — everything under `/skills-and-tools/*`.
16
16
  *
17
17
  * The shell mounts this once (`CORE_APPS`), so the toast host and the data
18
18
  * provider wrap the WHOLE surface rather than one page: navigating between the
19
- * gallery, a group and an item must not refetch the catalog or drop a toast
19
+ * gallery, a plugin and an item must not refetch the catalog or drop a toast
20
20
  * mid-flight.
21
21
  *
22
22
  * Paths below are RELATIVE — the shell already matched `/skills-and-tools/*`.
@@ -32,11 +32,11 @@ export function LibraryRoutes() {
32
32
  <LibraryProvider>
33
33
  <Routes>
34
34
  <Route element={<LibraryLayout />}>
35
- {/* The Library OPENS on its groups. A group is where skills and
35
+ {/* The Library OPENS on its plugins. A plugin is where skills and
36
36
  tools live and who they are for, so the index of them is the
37
37
  orienting view; the undifferentiated card grid is a lens on
38
38
  the same catalog and keeps its own row and URL below. */}
39
- <Route index element={<GroupsIndexPage />} />
39
+ <Route index element={<PluginsIndexPage />} />
40
40
 
41
41
  {/* The whole catalog as cards, with the library-wide search. */}
42
42
  <Route path="everything" element={<LibraryPage filter={{ kind: 'all' }} />} />
@@ -45,30 +45,30 @@ export function LibraryRoutes() {
45
45
  sidebar (and the pill's selected state) is on screen with it.
46
46
  Auto-reached once, on first sign-in (see `RootLanding`);
47
47
  reachable forever through the pill and by URL. */}
48
- <Route path="welcome" element={<WelcomePage />} />
48
+ <Route path="welcome" element={<WelcomeRoute />} />
49
49
 
50
50
  <Route path="owned" element={<LibraryPage filter={{ kind: 'owned' }} />} />
51
51
 
52
- {/* `yours` is a GROUP page, not a gallery filter — the items in no
52
+ {/* `yours` is a PLUGIN page, not a gallery filter — the items in no
53
53
  folder, given the same page the folders get. The sidebar still
54
54
  lights it through the `ungrouped` filter, so the URL and the
55
55
  selection stay the pair they were. */}
56
- <Route path="yours" element={<PersonalGroupPage />} />
56
+ <Route path="yours" element={<PersonalPluginPage />} />
57
57
 
58
- {/* A group is a PLACE: `groups/:group` is a real page with a real
59
- URL, and `GroupPage` — not the router — decides whether the
58
+ {/* A plugin is a PLACE: `plugins/:plugin` is a real page with a real
59
+ URL, and `PluginPage` — not the router — decides whether the
60
60
  caller gets the member view or the locked one. */}
61
61
  {/* The index moved to the root. This path is where every older
62
62
  link points, so it redirects rather than 404s or duplicates
63
63
  the page at a second URL. */}
64
- <Route path="groups" element={<Navigate to={LIBRARY_ROOT} replace />} />
65
- <Route path="groups/:group" element={<GroupPage />} />
64
+ <Route path="plugins" element={<Navigate to={LIBRARY_ROOT} replace />} />
65
+ <Route path="plugins/:plugin" element={<PluginPage />} />
66
66
 
67
67
  {/* The canonical item addresses. This surface is mounted at TWO
68
68
  shell paths (`/skills-and-tools/*` and, for default-branch
69
- `Groups/` URLs, `/workspace/*` — see `isLibraryLocation` and
69
+ `Plugins/` URLs, `/workspace/*` — see `isLibraryLocation` and
70
70
  the shell's `CoreSurfaces`), and under the second the remainder
71
- is `<branch>/<kbDir>/Groups/...`. Matching it HERE, inside the
71
+ is `<branch>/<kbDir>/Plugins/...`. Matching it HERE, inside the
72
72
  layout route, is what makes a skill page share the exact
73
73
  sidebar instance the reader browsed in with — one surface, not
74
74
  a second implementation of it. Static siblings above outrank
@@ -88,6 +88,13 @@ export function LibraryRoutes() {
88
88
  <Route path="tools/:slug" element={<LegacyToolRedirect />} />
89
89
  <Route path="skills/:name" element={<LegacySkillRedirect />} />
90
90
 
91
+ {/* LEGACY plugin addresses: `groups/…` is the pre-rename URL shape,
92
+ and links to it exist in the wild. Same posture as the other
93
+ legacy routes — a redirect to the current URL, outside the
94
+ layout route. */}
95
+ <Route path="groups" element={<Navigate to={LIBRARY_ROOT} replace />} />
96
+ <Route path="groups/:plugin" element={<LegacyGroupRedirect />} />
97
+
91
98
  {/* An unknown subpath is a stale or mistyped link, not an error page —
92
99
  send it home. Outside the layout route so a redirect never paints
93
100
  a sidebar on its way through. */}
@@ -98,12 +105,18 @@ export function LibraryRoutes() {
98
105
  );
99
106
  }
100
107
 
108
+ /** `groups/:plugin` → `plugins/:plugin` — the pre-rename plugin URL. */
109
+ function LegacyGroupRedirect() {
110
+ const { plugin = '' } = useParams<{ plugin: string }>();
111
+ return <Navigate to={pathForPlugin(decodePluginSegment(plugin))} replace />;
112
+ }
113
+
101
114
  /** `skills/:name` → the skill's canonical workspace URL (its SKILL.md). */
102
115
  function LegacySkillRedirect() {
103
116
  const { name = '' } = useParams<{ name: string }>();
104
117
  const data = useLibrary();
105
118
  const { kbDirName } = useWorkspace();
106
- const decoded = decodeGroupSegment(name);
119
+ const decoded = decodePluginSegment(name);
107
120
  const skill = data.items.find((i) => i.kind === 'skill' && i.id === decoded);
108
121
  if (skill && kbDirName) return <Navigate to={urlForSkillFile(kbDirName, skill.path)} replace />;
109
122
  if (kbDirName === null) return null;
@@ -121,7 +134,7 @@ function LegacyToolRedirect() {
121
134
  const location = useLocation();
122
135
  const data = useLibrary();
123
136
  const { kbDirName } = useWorkspace();
124
- const decoded = decodeGroupSegment(slug);
137
+ const decoded = decodePluginSegment(slug);
125
138
  const tool = data.items.find((i) => i.kind === 'integration' && i.id === decoded);
126
139
  if (kbDirName === null) return null;
127
140
  if (tool) {