@bevel-software/platform-core-frontend 0.14.0 → 0.15.1

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 (89) hide show
  1. package/package.json +2 -2
  2. package/src/core/CoreAppShell.tsx +18 -17
  3. package/src/core/__tests__/bootstrap.test.ts +33 -1
  4. package/src/core/bootstrap.ts +30 -1
  5. package/src/lib/__tests__/api.test.ts +38 -0
  6. package/src/lib/api.ts +19 -2
  7. package/src/lib/utils.ts +2 -0
  8. package/src/modules/access/__tests__/ManageAccessDialog.test.tsx +111 -1
  9. package/src/modules/access/__tests__/plugin-token.test.ts +21 -0
  10. package/src/modules/access/api.ts +52 -4
  11. package/src/modules/access/components/ManageAccessDialog.tsx +112 -83
  12. package/src/modules/git/__tests__/GitSyncFailedBanner.test.tsx +65 -1
  13. package/src/modules/git/components/GitSyncFailedBanner.tsx +68 -5
  14. package/src/modules/layout/components/SidebarFrame.tsx +1 -1
  15. package/src/modules/library/__tests__/LibraryRoutes.test.tsx +1 -1
  16. package/src/modules/library/__tests__/LibrarySidebarMenu.test.tsx +1 -1
  17. package/src/modules/library/__tests__/LinkSkillPanel.test.tsx +121 -0
  18. package/src/modules/library/__tests__/LockedPluginView.test.tsx +6 -0
  19. package/src/modules/library/__tests__/NewPluginDialog.test.tsx +5 -4
  20. package/src/modules/library/__tests__/PluginExtras.test.tsx +15 -0
  21. package/src/modules/library/__tests__/PluginPage.test.tsx +195 -1
  22. package/src/modules/library/__tests__/PluginsSidebar.contextmenu.test.tsx +1 -1
  23. package/src/modules/library/__tests__/PluginsSidebar.locked.test.tsx +1 -1
  24. package/src/modules/library/__tests__/PluginsSidebar.test.tsx +64 -3
  25. package/src/modules/library/__tests__/SkillPage.test.tsx +9 -2
  26. package/src/modules/library/__tests__/SkillsTree.test.tsx +172 -0
  27. package/src/modules/library/__tests__/ToolPage.test.tsx +7 -0
  28. package/src/modules/library/__tests__/WorkspaceItemRoute.test.tsx +115 -4
  29. package/src/modules/library/__tests__/library-data.stale.test.tsx +90 -0
  30. package/src/modules/library/__tests__/library-paths.test.ts +32 -0
  31. package/src/modules/library/__tests__/link-membership.test.ts +120 -0
  32. package/src/modules/library/__tests__/plugin-summary.test.ts +32 -0
  33. package/src/modules/library/__tests__/useJoinRequests.test.tsx +46 -0
  34. package/src/modules/library/components/AddToPluginDialog.tsx +33 -0
  35. package/src/modules/library/components/LibraryCard.tsx +14 -0
  36. package/src/modules/library/components/LibraryLayout.tsx +24 -14
  37. package/src/modules/library/components/LinkSkillPanel.tsx +171 -0
  38. package/src/modules/library/components/LockedPluginView.tsx +2 -2
  39. package/src/modules/library/components/NewPluginDialog.tsx +4 -4
  40. package/src/modules/library/components/PageActions.tsx +21 -1
  41. package/src/modules/library/components/PersonalPluginPage.tsx +2 -1
  42. package/src/modules/library/components/PluginExtras.tsx +3 -1
  43. package/src/modules/library/components/PluginPage.tsx +92 -12
  44. package/src/modules/library/components/PluginsIndexPage.tsx +11 -6
  45. package/src/modules/library/components/PluginsSidebar.tsx +110 -53
  46. package/src/modules/library/components/RenamePluginDialog.tsx +136 -0
  47. package/src/modules/library/components/SkillsTree.tsx +91 -0
  48. package/src/modules/library/components/StatusDot.tsx +1 -0
  49. package/src/modules/library/components/plugin-page-parts.tsx +32 -9
  50. package/src/modules/library/components/skill-page/SharedViaPlugins.tsx +218 -0
  51. package/src/modules/library/components/skill-page/SkillPage.tsx +70 -6
  52. package/src/modules/library/components/tool-page/ToolPage.tsx +11 -2
  53. package/src/modules/library/hooks/useJoinRequests.ts +48 -18
  54. package/src/modules/library/routes/WorkspaceItemRoute.tsx +180 -83
  55. package/src/modules/library/routes/library-paths.ts +21 -8
  56. package/src/modules/library/services/library.api.ts +55 -1
  57. package/src/modules/library/services/plugins.api.ts +94 -3
  58. package/src/modules/library/state/library-data.tsx +115 -22
  59. package/src/modules/library/utils/plugin-summary.ts +36 -0
  60. package/src/modules/library/utils/status.ts +74 -7
  61. package/src/modules/onboarding/__tests__/creator-welcome.test.tsx +3 -2
  62. package/src/modules/settings/components/ClaudeConnectionCard.tsx +169 -0
  63. package/src/modules/settings/components/DeploymentPage.tsx +15 -1
  64. package/src/modules/settings/components/__tests__/ClaudeConnectionCard.test.tsx +63 -0
  65. package/src/modules/settings/components/__tests__/DeploymentPage.test.tsx +10 -0
  66. package/src/modules/settings/services/github-facade.api.ts +43 -0
  67. package/src/modules/setup/__tests__/setup.test.tsx +118 -0
  68. package/src/modules/setup/components/SetupGate.tsx +1 -1
  69. package/src/modules/setup/components/SetupScreen.tsx +195 -2
  70. package/src/modules/setup/services/setup.api.ts +78 -0
  71. package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +295 -83
  72. package/src/modules/toolbar/components/__tests__/ExternalAgentAccessPage.test.tsx +129 -6
  73. package/src/modules/toolbar/services/external-api-keys.api.ts +2 -0
  74. package/src/modules/workspace/__tests__/testFixtures.ts +1 -0
  75. package/src/modules/workspace/components/FileExplorer.tsx +292 -236
  76. package/src/modules/workspace/components/FileRoute.tsx +37 -0
  77. package/src/modules/workspace/components/__tests__/FileRoute.test.tsx +39 -0
  78. package/src/modules/workspace/components/__tests__/FileViewer.test.tsx +1 -0
  79. package/src/modules/workspace/hooks/useMergedWorkspaceTree.ts +70 -0
  80. package/src/modules/workspace/hooks/useWorkspaceState.ts +17 -3
  81. package/src/modules/workspace/routing/kb-routes.ts +1 -1
  82. package/src/modules/workspace/state/workspace.context.ts +8 -0
  83. package/src/modules/workspace/utils/__tests__/fileTree.test.ts +15 -0
  84. package/src/modules/workspace/utils/fileTree.ts +14 -16
  85. package/src/shared/__tests__/marketplace-url.test.ts +54 -0
  86. package/src/shared/components/Badge.tsx +3 -1
  87. package/src/shared/components/Banner.tsx +5 -1
  88. package/src/shared/marketplace-url.ts +90 -0
  89. package/src/shared/theme/tokens.css +9 -0
@@ -17,6 +17,8 @@ import {
17
17
  useCopyFeedback,
18
18
  workspaceBaseUrl,
19
19
  } from '../../../shared/mcp';
20
+ import { GITHUB_LINK_KIND, marketplaceCommands, marketplaceGitUrl } from '../../../shared/marketplace-url';
21
+ import { useAdmin } from '../../admin/state/admin.context';
20
22
  import {
21
23
  type ExternalApiKeySummary,
22
24
  type MintedExternalApiKey,
@@ -38,12 +40,17 @@ function formatRelative(ts: number | null): string {
38
40
 
39
41
  /**
40
42
  * The External agent access page, routed standalone at
41
- * `/external-agent-access` (below the persistent toolbar), in two tabs:
43
+ * `/external-agent-access` (below the persistent toolbar), in three tabs:
42
44
  *
43
45
  * - "Your agent" (default) — connecting the user's own interactive agent
44
46
  * (Claude Code, Claude Desktop, Cursor…). No key: the agent gets only the
45
47
  * server URL, and on first connect the browser opens our authorization
46
48
  * flow (sign in + choose tools on /connect). Copy-paste configs only.
49
+ * - "Marketplaces" — skills as native plugins rather than through the MCP
50
+ * server: the git remote Claude Code and Codex install from (with a key
51
+ * from the autonomous tab), and the Cowork / claude.ai route, where the
52
+ * person connects their Claude account and gets the marketplace compiled
53
+ * for what they may read. Their Claude links are listed here.
47
54
  * - "Autonomous agents" — the external-API-key surface for pipelines/CI
48
55
  * that can't open a browser: lists existing keys, mints new ones,
49
56
  * disconnects revoked ones, permanently deletes disconnected ones. The
@@ -73,7 +80,8 @@ export function ExternalAgentAccessPage() {
73
80
  */
74
81
  const workspaceUrl = workspaceBaseUrl();
75
82
 
76
- const [tab, setTab] = useState<'agent' | 'autonomous'>('agent');
83
+ const [tab, setTab] = useState<'agent' | 'marketplace' | 'autonomous'>('agent');
84
+ const { isAdmin } = useAdmin();
77
85
  const [keys, setKeys] = useState<ExternalApiKeySummary[]>([]);
78
86
  const [loading, setLoading] = useState(false);
79
87
  const [loadError, setLoadError] = useState<string | null>(null);
@@ -160,7 +168,14 @@ export function ExternalAgentAccessPage() {
160
168
  // top, never-used ones last among the active), with disconnected keys sunk
161
169
  // to the bottom. Non-destructive — nothing is hidden or deleted, just ordered
162
170
  // so a long list of stale/test keys doesn't bury the ones in use.
163
- const sortedKeys = [...keys].sort((a, b) => {
171
+ // ONE list from the server, two views of it: live Claude links belong to
172
+ // the Marketplaces tab (they were minted by a connection, not created
173
+ // here), everything else — hand-made keys, and Claude links once
174
+ // disconnected, so they can be deleted — to the autonomous tab. Told
175
+ // apart by the stored kind, never the label.
176
+ const isClaudeLink = (k: ExternalApiKeySummary) => k.kind === GITHUB_LINK_KIND;
177
+ const claudeLinks = keys.filter((k) => isClaudeLink(k) && k.revokedAt === null);
178
+ const sortedKeys = keys.filter((k) => !isClaudeLink(k) || k.revokedAt !== null).sort((a, b) => {
164
179
  const aRevoked = a.revokedAt !== null;
165
180
  const bRevoked = b.revokedAt !== null;
166
181
  if (aRevoked !== bRevoked) return aRevoked ? 1 : -1;
@@ -174,6 +189,7 @@ export function ExternalAgentAccessPage() {
174
189
  {(
175
190
  [
176
191
  ['agent', 'Your agent'],
192
+ ['marketplace', 'Marketplaces'],
177
193
  ['autonomous', 'Autonomous agents'],
178
194
  ] as const
179
195
  ).map(([id, name]) => (
@@ -280,6 +296,19 @@ export function ExternalAgentAccessPage() {
280
296
  </div>
281
297
  </details>
282
298
 
299
+ <p className="text-meta text-ink-muted leading-snug">
300
+ Prefer your skills installed as native plugins rather than read through the MCP
301
+ server? The{' '}
302
+ <button
303
+ type="button"
304
+ onClick={() => setTab('marketplace')}
305
+ className="underline text-ink-muted hover:text-ink"
306
+ >
307
+ Marketplaces
308
+ </button>{' '}
309
+ tab has the git remote for Claude Code and Codex, and the Cowork route.
310
+ </p>
311
+
283
312
  <p className="text-[11px] text-ink-muted leading-snug">
284
313
  Running an unattended pipeline or CI agent that can't open a browser? Use the{' '}
285
314
  <button
@@ -294,6 +323,134 @@ export function ExternalAgentAccessPage() {
294
323
  </div>
295
324
  )}
296
325
 
326
+ {tab === 'marketplace' && (
327
+ <div className="px-4 py-3 space-y-4">
328
+ <p className="text-xs text-ink-muted leading-snug">
329
+ Every skill you may read, compiled into a plugin marketplace. One address serves
330
+ every Claude surface: Claude Code and Codex clone it as a git remote, Cowork and
331
+ claude.ai fetch it as a repository once your account is connected.
332
+ </p>
333
+
334
+ <details className="border border-line rounded" data-testid="cowork-section">
335
+ <summary className="cursor-pointer px-3 py-2 text-xs font-medium text-ink">
336
+ Cowork and claude.ai
337
+ </summary>
338
+ <div className="px-3 pb-3 space-y-3">
339
+ <p className="text-meta text-ink-muted leading-snug">
340
+ Cowork and claude.ai take marketplaces only from GitHub, or from a GitHub
341
+ Enterprise Server your Claude organization registered. This deployment answers as
342
+ one: an Owner of your Claude organization registers it once
343
+ {isAdmin ? (
344
+ <>
345
+ {' '}
346
+ (the fields are on the{' '}
347
+ <Link to="/deployment" className="underline text-ink-muted hover:text-ink">
348
+ Deployment
349
+ </Link>{' '}
350
+ page)
351
+ </>
352
+ ) : (
353
+ <> (an admin here has the fields)</>
354
+ )}
355
+ , then every person connects their own account:
356
+ </p>
357
+ <ol className="text-meta text-ink-muted leading-snug list-decimal pl-4 space-y-0.5">
358
+ <li>In Cowork (or claude.ai), open Plugins → Add marketplace and paste the URL below.</li>
359
+ <li>
360
+ When it asks you to connect your GitHub Enterprise account, you land on this
361
+ deployment's sign-in: approve, and you are back in Claude.
362
+ </li>
363
+ <li>Install the plugins you want. Update in Claude pulls what changed.</li>
364
+ </ol>
365
+ <CopyBlock label="Marketplace URL" value={marketplaceGitUrl()} rows={2} />
366
+ <div className="space-y-1">
367
+ <div className="text-xs font-medium text-ink">Your Claude connections</div>
368
+ {loadError && (
369
+ <div className="text-xs text-red-600 bg-red-50 border border-red-200 rounded px-2 py-1.5">
370
+ {loadError}
371
+ </div>
372
+ )}
373
+ {loading ? (
374
+ <div className="text-meta text-ink-muted">Loading…</div>
375
+ ) : loadError ? null : claudeLinks.length === 0 ? (
376
+ <div className="text-meta text-ink-muted">
377
+ None yet. One appears here after you connect from Cowork or claude.ai.
378
+ </div>
379
+ ) : (
380
+ <ul className="divide-y divide-line border border-line rounded">
381
+ {claudeLinks.map((k) => (
382
+ <li key={k.id} className="flex items-center gap-3 px-3 py-2 text-sm">
383
+ <div className="flex-1 min-w-0">
384
+ <div className="font-medium truncate">{k.label}</div>
385
+ <div className="text-meta text-ink-muted">
386
+ Connected {formatRelative(k.createdAt)} · Last used {formatRelative(k.lastUsedAt)}
387
+ </div>
388
+ </div>
389
+ <button
390
+ onClick={() => handleDisconnect(k.id)}
391
+ className="text-xs px-2 py-1 rounded text-ink hover:bg-hover border border-line"
392
+ title="Disconnect this Claude account. Its marketplace stops updating; connect again from Claude to resume."
393
+ >
394
+ Disconnect
395
+ </button>
396
+ </li>
397
+ ))}
398
+ </ul>
399
+ )}
400
+ </div>
401
+ </div>
402
+ </details>
403
+
404
+ <details className="border border-line rounded" data-testid="marketplace-section">
405
+ <summary className="cursor-pointer px-3 py-2 text-xs font-medium text-ink">
406
+ Claude Code, Codex and the skills CLI
407
+ </summary>
408
+ <div className="px-3 pb-3 space-y-3">
409
+ <p className="text-meta text-ink-muted leading-snug">
410
+ These clone the marketplace as a git remote. The URL carries an external API
411
+ key from the{' '}
412
+ <button
413
+ type="button"
414
+ onClick={() => setTab('autonomous')}
415
+ className="underline text-ink-muted hover:text-ink"
416
+ >
417
+ Autonomous agents
418
+ </button>{' '}
419
+ tab — the key dialog there shows these commands filled in.
420
+ </p>
421
+ <CopyBlock label="Marketplace git remote" value={marketplaceGitUrl()} rows={2} />
422
+ <CopyBlock
423
+ label="Claude Code (one install, everything you may read)"
424
+ value={marketplaceCommands('<external-api-key>').claude}
425
+ rows={2}
426
+ />
427
+ <CopyBlock
428
+ label="Codex"
429
+ value={marketplaceCommands('<external-api-key>').codex}
430
+ rows={2}
431
+ />
432
+ <CopyBlock
433
+ label="Any other agent, via the skills CLI"
434
+ value={marketplaceCommands('<external-api-key>').skills}
435
+ rows={2}
436
+ />
437
+ <p className="text-meta text-ink-muted leading-snug">
438
+ The key stays in the URL: Claude Code refreshes marketplaces in the background
439
+ without credential helpers. Revoke the key to cut the agent off. In Claude Code
440
+ add it through the CLI or the Claude Code section of the Desktop app's
441
+ Customize screen; the Chat and Cowork screens use the route above instead.
442
+ </p>
443
+ <p className="text-meta text-ink-muted leading-snug">
444
+ Add it through Claude Code: the CLI, or the Claude Code section of the
445
+ Desktop app's Customize screen. The Chat and Cowork plugin screens accept
446
+ only GitHub, GitLab and Bitbucket remotes and refuse this one as an
447
+ unsupported host.
448
+ </p>
449
+ </div>
450
+ </details>
451
+ </div>
452
+ )}
453
+
297
454
  {tab === 'autonomous' && (
298
455
  <div className="px-4 py-3 space-y-4">
299
456
  <p className="text-xs text-ink-muted leading-snug">
@@ -343,8 +500,11 @@ export function ExternalAgentAccessPage() {
343
500
  )}
344
501
  {loading ? (
345
502
  <div className="text-xs text-ink-muted">Loading…</div>
346
- ) : keys.length === 0 ? (
347
- <div className="text-xs text-ink-muted">No external API keys yet.</div>
503
+ ) : sortedKeys.length === 0 ? (
504
+ <div className="text-xs text-ink-muted">
505
+ No external API keys yet.
506
+ {claudeLinks.length > 0 && ' Your Claude connections are on the Marketplaces tab.'}
507
+ </div>
348
508
  ) : (
349
509
  <ul className="divide-y divide-line border border-line rounded">
350
510
  {sortedKeys.map((k) => {
@@ -481,89 +641,141 @@ export function ExternalAgentAccessPage() {
481
641
  {copied ? <Check size={14} /> : <Copy size={14} />}
482
642
  </button>
483
643
  </div>
484
- <div>
485
- <div className="text-xs font-medium text-ink mb-1">
644
+ {/* The SAME three drawers as the interactive tab — local server,
645
+ hosted endpoint, marketplace — in the same order and CLOSED,
646
+ with the key filled in. The key is the news here; which
647
+ config the reader needs is their call, and five config walls
648
+ in a row buried the one thing the dialog exists to hand over.
649
+ Same summaries as the tab too, so a person who read the tab
650
+ first finds the drawer they already picked. */}
651
+ <details className="border border-line rounded">
652
+ <summary className="cursor-pointer px-3 py-2 text-xs font-medium text-ink">
486
653
  Desktop agents — the local server (recommended)
654
+ </summary>
655
+ <div className="px-3 pb-3 space-y-2">
656
+ <p className="text-meta text-ink-muted leading-snug">
657
+ For agents that run on your machine: Claude Code, Claude Desktop, Cursor,
658
+ Windsurf, Cline and similar. Runs this workspace as a local MCP server (needs
659
+ Node): the agent gets everything the hosted endpoint serves, plus your
660
+ plugins' local-only tools. In Claude Code:
661
+ </p>
662
+ <textarea
663
+ readOnly
664
+ value={hexisMcpClaudeCommand(workspaceUrl, reveal.plaintext)}
665
+ rows={3}
666
+ className="w-full font-mono text-meta bg-sunken border border-line rounded px-2 py-1.5 resize-none"
667
+ onFocus={(e) => e.currentTarget.select()}
668
+ />
669
+ <p className="text-meta text-ink-muted leading-snug">
670
+ On Windows, prefer the JSON config below — this one-liner assumes a POSIX
671
+ shell (macOS, Linux, WSL or Git Bash).
672
+ </p>
673
+ <p className="text-meta text-ink-muted leading-snug">
674
+ Or as a JSON config, for Claude Desktop, Cursor, Windsurf, Cline and
675
+ similar:
676
+ </p>
677
+ <textarea
678
+ readOnly
679
+ value={hexisMcpJsonSnippet(workspaceUrl, reveal.plaintext)}
680
+ rows={13}
681
+ className="w-full font-mono text-meta bg-sunken border border-line rounded px-2 py-1.5 resize-none"
682
+ onFocus={(e) => e.currentTarget.select()}
683
+ />
487
684
  </div>
488
- <p className="text-meta text-ink-muted mb-1 leading-snug">
489
- For agents that run on your machine: Claude Code, Claude Desktop, Cursor,
490
- Windsurf, Cline and similar. Runs this workspace as a local MCP server (needs
491
- Node): the agent gets everything the hosted endpoint serves, plus your
492
- plugins' local-only tools. In Claude Code:
493
- </p>
494
- <textarea
495
- readOnly
496
- value={hexisMcpClaudeCommand(workspaceUrl, reveal.plaintext)}
497
- rows={3}
498
- className="w-full font-mono text-meta bg-sunken border border-line rounded px-2 py-1.5 resize-none"
499
- onFocus={(e) => e.currentTarget.select()}
500
- />
501
- <p className="text-meta text-ink-muted mt-1 leading-snug">
502
- On Windows, prefer the JSON config below — this one-liner assumes a POSIX
503
- shell (macOS, Linux, WSL or Git Bash).
504
- </p>
505
- <p className="text-meta text-ink-muted mt-2 mb-1 leading-snug">
506
- Or as a JSON config, for Claude Desktop, Cursor, Windsurf, Cline and
507
- similar:
508
- </p>
509
- <textarea
510
- readOnly
511
- value={hexisMcpJsonSnippet(workspaceUrl, reveal.plaintext)}
512
- rows={13}
513
- className="w-full font-mono text-meta bg-sunken border border-line rounded px-2 py-1.5 resize-none"
514
- onFocus={(e) => e.currentTarget.select()}
515
- />
516
- </div>
517
- <div>
518
- <div className="text-xs font-medium text-ink mb-1">
685
+ </details>
686
+
687
+ <details className="border border-line rounded">
688
+ <summary className="cursor-pointer px-3 py-2 text-xs font-medium text-ink">
519
689
  Web agents and pipelines — the hosted endpoint
690
+ </summary>
691
+ <div className="px-3 pb-3 space-y-3">
692
+ <div>
693
+ <p className="text-meta text-ink-muted mb-1 leading-snug">
694
+ For agents that can't run a process on your machine, and for CI where
695
+ installing Node is unwanted. Claude Code, via the hosted endpoint:
696
+ </p>
697
+ <textarea
698
+ readOnly
699
+ value={claudeCodeCommand(mcpUrl, reveal.plaintext)}
700
+ rows={3}
701
+ className="w-full font-mono text-meta bg-sunken border border-line rounded px-2 py-1.5 resize-none"
702
+ onFocus={(e) => e.currentTarget.select()}
703
+ />
704
+ </div>
705
+ <div>
706
+ <div className="text-xs font-medium text-ink mb-1">Connect Langdock</div>
707
+ <ol className="text-meta text-ink-muted mb-1 leading-snug list-decimal pl-4 space-y-0.5">
708
+ <li>In Langdock, open your workspace settings and go to MCP servers → Add server.</li>
709
+ <li>Choose <span className="font-medium">HTTP</span> (Streamable HTTP) as the transport.</li>
710
+ <li>Give it a name (e.g. <span className="font-medium">Bevel</span>), paste the URL below into the server URL field, and add the Authorization header under custom headers.</li>
711
+ <li>Save, then enable the server in any assistant you want it available in.</li>
712
+ </ol>
713
+ <textarea
714
+ readOnly
715
+ value={langdockSnippet(mcpUrl, reveal.plaintext)}
716
+ rows={3}
717
+ className="w-full font-mono text-meta bg-sunken border border-line rounded px-2 py-1.5 resize-none"
718
+ onFocus={(e) => e.currentTarget.select()}
719
+ />
720
+ </div>
721
+ <div>
722
+ <div className="text-xs font-medium text-ink mb-1">Other agents (JSON config)</div>
723
+ <p className="text-meta text-ink-muted mb-1 leading-snug">
724
+ The hosted endpoint for most clients that load servers from a JSON config —
725
+ when the local server above isn't wanted.
726
+ </p>
727
+ <textarea
728
+ readOnly
729
+ value={jsonConfigSnippet(mcpUrl, reveal.plaintext)}
730
+ rows={11}
731
+ className="w-full font-mono text-meta bg-sunken border border-line rounded px-2 py-1.5 resize-none"
732
+ onFocus={(e) => e.currentTarget.select()}
733
+ />
734
+ </div>
520
735
  </div>
521
- <p className="text-meta text-ink-muted mb-1 leading-snug">
522
- For agents that can't run a process on your machine, and for CI where
523
- installing Node is unwanted. Claude Code, via the hosted endpoint:
524
- </p>
525
- <textarea
526
- readOnly
527
- value={claudeCodeCommand(mcpUrl, reveal.plaintext)}
528
- rows={3}
529
- className="w-full font-mono text-[11px] bg-sunken border border-line rounded px-2 py-1.5 resize-none"
530
- onFocus={(e) => e.currentTarget.select()}
531
- />
532
- </div>
533
- <div>
534
- <div className="text-xs font-medium text-ink mb-1">
535
- Connect Langdock
536
- </div>
537
- <ol className="text-[11px] text-ink-muted mb-1 leading-snug list-decimal pl-4 space-y-0.5">
538
- <li>In Langdock, open your workspace settings and go to MCP servers → Add server.</li>
539
- <li>Choose <span className="font-medium">HTTP</span> (Streamable HTTP) as the transport.</li>
540
- <li>Give it a name (e.g. <span className="font-medium">Bevel</span>), paste the URL below into the server URL field, and add the Authorization header under custom headers.</li>
541
- <li>Save, then enable the server in any assistant you want it available in.</li>
542
- </ol>
543
- <textarea
544
- readOnly
545
- value={langdockSnippet(mcpUrl, reveal.plaintext)}
546
- rows={3}
547
- className="w-full font-mono text-[11px] bg-sunken border border-line rounded px-2 py-1.5 resize-none"
548
- onFocus={(e) => e.currentTarget.select()}
549
- />
550
- </div>
551
- <div>
552
- <div className="text-xs font-medium text-ink mb-1">
553
- Other agents (JSON config)
736
+ </details>
737
+
738
+ <details className="border border-line rounded">
739
+ <summary className="cursor-pointer px-3 py-2 text-xs font-medium text-ink">
740
+ Skills as native plugins — the marketplace
741
+ </summary>
742
+ <div className="px-3 pb-3 space-y-2">
743
+ <p className="text-meta text-ink-muted leading-snug">
744
+ Every skill you may read, compiled into a plugin marketplace served as a git
745
+ remote. One install brings all of it; a later update fetches what changed.
746
+ The key stays in the URL because Claude Code refreshes marketplaces without
747
+ credential helpers. Add it through Claude Code (the CLI, or the Claude
748
+ Code section of the Desktop app's Customize screen): the Chat and Cowork
749
+ plugin screens accept only GitHub, GitLab and Bitbucket remotes.
750
+ </p>
751
+ <textarea
752
+ readOnly
753
+ aria-label="Claude Code marketplace command"
754
+ value={marketplaceCommands(reveal.plaintext).claude}
755
+ rows={2}
756
+ className="w-full font-mono text-meta bg-sunken border border-line rounded px-2 py-1.5 resize-none"
757
+ onFocus={(e) => e.currentTarget.select()}
758
+ />
759
+ <p className="text-meta text-ink-muted leading-snug">Codex installs every plugin on add:</p>
760
+ <textarea
761
+ readOnly
762
+ aria-label="Codex marketplace command"
763
+ value={marketplaceCommands(reveal.plaintext).codex}
764
+ rows={2}
765
+ className="w-full font-mono text-meta bg-sunken border border-line rounded px-2 py-1.5 resize-none"
766
+ onFocus={(e) => e.currentTarget.select()}
767
+ />
768
+ <p className="text-meta text-ink-muted leading-snug">Any other agent, through the skills CLI:</p>
769
+ <textarea
770
+ readOnly
771
+ aria-label="skills CLI command"
772
+ value={marketplaceCommands(reveal.plaintext).skills}
773
+ rows={2}
774
+ className="w-full font-mono text-meta bg-sunken border border-line rounded px-2 py-1.5 resize-none"
775
+ onFocus={(e) => e.currentTarget.select()}
776
+ />
554
777
  </div>
555
- <p className="text-[11px] text-ink-muted mb-1 leading-snug">
556
- The hosted endpoint for most clients that load servers from a JSON config —
557
- when the local server above isn't wanted.
558
- </p>
559
- <textarea
560
- readOnly
561
- value={jsonConfigSnippet(mcpUrl, reveal.plaintext)}
562
- rows={11}
563
- className="w-full font-mono text-[11px] bg-sunken border border-line rounded px-2 py-1.5 resize-none"
564
- onFocus={(e) => e.currentTarget.select()}
565
- />
566
- </div>
778
+ </details>
567
779
  </div>
568
780
  <div className="flex justify-end px-4 py-3 border-t border-line">
569
781
  <button
@@ -1,9 +1,10 @@
1
1
  import { describe, it, expect, vi, beforeEach } from 'vitest';
2
- import { render, screen } from '@testing-library/react';
2
+ import { render, screen, within } from '@testing-library/react';
3
3
  import userEvent from '@testing-library/user-event';
4
4
  import { MemoryRouter } from 'react-router-dom';
5
5
  import { ExternalAgentAccessPage } from '../ExternalAgentAccessPage';
6
6
  import { configureMcpUrl } from '../../../../shared/mcp';
7
+ import { GITHUB_LINK_KIND, configureMarketplaceGitUrl } from '../../../../shared/marketplace-url';
7
8
 
8
9
  /**
9
10
  * The Connect page's contract, and the reason this file exists at all: every
@@ -26,6 +27,10 @@ const { listMock, createMock } = vi.hoisted(() => ({
26
27
  createMock: vi.fn(),
27
28
  }));
28
29
 
30
+ vi.mock('../../../admin/state/admin.context', () => ({
31
+ useAdmin: () => ({ isAdmin: false }),
32
+ }));
33
+
29
34
  vi.mock('../../services/external-api-keys.api', () => ({
30
35
  listExternalApiKeys: listMock,
31
36
  createExternalApiKey: createMock,
@@ -56,6 +61,8 @@ beforeEach(() => {
56
61
 
57
62
  function mount(mcpUrl: string) {
58
63
  configureMcpUrl(mcpUrl);
64
+ // The marketplace remote is served from the same deployment address.
65
+ configureMarketplaceGitUrl(`${new URL(mcpUrl).origin}/git/marketplace.git`);
59
66
  return render(
60
67
  <MemoryRouter>
61
68
  <ExternalAgentAccessPage />
@@ -137,7 +144,12 @@ describe('the interactive tab: local first, hosted second, each with its own add
137
144
  it('keeps each family on its own address', () => {
138
145
  mount(PUBLIC_URL);
139
146
  for (const value of snippets()) {
140
- if (value.includes('hexis')) {
147
+ if (value.includes('marketplace.git')) {
148
+ // The marketplace remote is the deployment's own address (with the
149
+ // key in the userinfo, so the HOST is what survives), never the browser's.
150
+ expect(value).toContain(new URL(PUBLIC_URL).host);
151
+ expect(value).not.toContain(window.location.host);
152
+ } else if (value.includes('hexis')) {
141
153
  expect(value).toContain(window.location.origin);
142
154
  expect(value).not.toContain(PUBLIC_URL);
143
155
  } else {
@@ -220,6 +232,46 @@ describe('the key-bearing snippets quote the deployment too', () => {
220
232
  expect(json).not.toContain(PUBLIC_URL);
221
233
  });
222
234
 
235
+ /**
236
+ * The modal holds the SAME three drawers as the interactive tab, in the
237
+ * same order, and every one of them arrives closed: the key is what the
238
+ * dialog hands over, and the configs wait until the reader picks a side.
239
+ */
240
+ it('folds the configs into the tab\'s three drawers, all closed', async () => {
241
+ const user = userEvent.setup();
242
+ mount(PUBLIC_URL);
243
+ await revealAKey(user);
244
+ const dialog = screen.getByRole('alertdialog');
245
+ const summaries = [
246
+ 'Desktop agents — the local server (recommended)',
247
+ 'Web agents and pipelines — the hosted endpoint',
248
+ 'Skills as native plugins — the marketplace',
249
+ ].map((text) => within(dialog).getByText(text));
250
+ for (const summary of summaries) {
251
+ expect(summary.tagName).toBe('SUMMARY');
252
+ expect((summary.closest('details') as HTMLDetailsElement).open).toBe(false);
253
+ }
254
+ expect(summaries[0].compareDocumentPosition(summaries[1]) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
255
+ expect(summaries[1].compareDocumentPosition(summaries[2]) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
256
+ // The key itself is not behind a drawer.
257
+ expect(within(dialog).getByRole('button', { name: 'Copy external API key' }).closest('details')).toBeNull();
258
+ });
259
+
260
+ /**
261
+ * The placeholder in the keyless marketplace commands is a placeholder, not
262
+ * a percent-encoded one: `%3Cexternal-api-key%3E` looked like a secret to
263
+ * paste. The commands live on the Marketplaces tab now.
264
+ */
265
+ it('shows the marketplace placeholder verbatim in the keyless commands', async () => {
266
+ const user = userEvent.setup();
267
+ mount(PUBLIC_URL);
268
+ await user.click(screen.getByRole('tab', { name: 'Marketplaces' }));
269
+ const marketplace = snippets().filter((v) => v.includes('marketplace.git'));
270
+ expect(marketplace.length).toBeGreaterThan(0);
271
+ for (const v of marketplace) expect(v).not.toContain('%3C');
272
+ expect(marketplace.some((v) => v.includes('key:<external-api-key>@'))).toBe(true);
273
+ });
274
+
223
275
  /**
224
276
  * The consolidation's real risk: snippets that must carry a secret
225
277
  * and snippets that must not. Losing the token during the move would look
@@ -231,13 +283,84 @@ describe('the key-bearing snippets quote the deployment too', () => {
231
283
  expect(snippets().some((v) => v.includes(KEY))).toBe(false);
232
284
  await revealAKey(user);
233
285
  expect(snippets().filter((v) => v.includes(KEY))).toHaveLength(
234
- // the reveal textarea itself, the three keyed hosted snippets, and the
235
- // two local-server (hexis-mcp) snippets
236
- 6,
286
+ // the reveal textarea itself, the three keyed hosted snippets, the two
287
+ // local-server (hexis-mcp) snippets, and the three marketplace commands
288
+ 9,
237
289
  );
238
290
  });
239
291
  });
240
292
 
293
+ describe('the Marketplaces tab', () => {
294
+ it('is the third tab, and the interactive tab points at it instead of carrying the remote', async () => {
295
+ const user = userEvent.setup();
296
+ mount(PUBLIC_URL);
297
+ expect(screen.getAllByRole('tab').map((t) => t.textContent)).toEqual([
298
+ 'Your agent',
299
+ 'Marketplaces',
300
+ 'Autonomous agents',
301
+ ]);
302
+ // The remote no longer lives on the interactive tab.
303
+ expect(snippets().some((v) => v.includes('marketplace.git'))).toBe(false);
304
+ await user.click(screen.getByRole('button', { name: 'Marketplaces' }));
305
+ expect(screen.getByRole('tab', { name: 'Marketplaces' })).toHaveAttribute('aria-selected', 'true');
306
+ });
307
+
308
+ it('leads with the Cowork route and follows with the git remote, both closed, one URL for both', async () => {
309
+ const user = userEvent.setup();
310
+ mount(PUBLIC_URL);
311
+ await user.click(screen.getByRole('tab', { name: 'Marketplaces' }));
312
+ const cowork = screen.getByText('Cowork and claude.ai');
313
+ const git = screen.getByText('Claude Code, Codex and the skills CLI');
314
+ expect(cowork.compareDocumentPosition(git) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
315
+ for (const drawer of [cowork, git]) {
316
+ expect((drawer.closest('details') as HTMLDetailsElement).open).toBe(false);
317
+ }
318
+ const remote = `${new URL(PUBLIC_URL).origin}/git/marketplace.git`;
319
+ // The same address in both drawers: what Cowork adds is what Claude Code clones.
320
+ expect(snippets().filter((v) => v === remote)).toHaveLength(2);
321
+ // The keyed commands point at the deployment's host.
322
+ const commands = snippets().filter((v) => v.includes('key:'));
323
+ expect(commands.length).toBeGreaterThan(0);
324
+ for (const v of commands) expect(v).toContain(new URL(PUBLIC_URL).host);
325
+ });
326
+
327
+ it('tells Claude connections from keys by their stored kind — never by the label', async () => {
328
+ listMock.mockResolvedValue([
329
+ { id: 'c1', kind: GITHUB_LINK_KIND, label: 'My Cowork link', createdAt: Date.now(), lastUsedAt: null, revokedAt: null },
330
+ // A hand-made key wearing the link's usual label is still a key.
331
+ { id: 'k1', kind: 'key', label: 'Claude (claude.ai and Cowork)', createdAt: Date.now(), lastUsedAt: null, revokedAt: null },
332
+ ]);
333
+ const user = userEvent.setup();
334
+ mount(PUBLIC_URL);
335
+ await user.click(screen.getByRole('tab', { name: 'Marketplaces' }));
336
+ const cowork = screen.getByText('Cowork and claude.ai').closest('details') as HTMLElement;
337
+ await screen.findByText('My Cowork link');
338
+ expect(cowork).toHaveTextContent('My Cowork link');
339
+ expect(cowork).not.toHaveTextContent('Claude (claude.ai and Cowork)');
340
+
341
+ await user.click(screen.getByRole('tab', { name: 'Autonomous agents' }));
342
+ await screen.findByText('Claude (claude.ai and Cowork)');
343
+ expect(screen.queryByText('My Cowork link')).toBeNull();
344
+ });
345
+
346
+ it('says where the keys went when only Claude connections exist, and shows a load error on both tabs', async () => {
347
+ listMock.mockResolvedValue([
348
+ { id: 'c1', kind: GITHUB_LINK_KIND, label: 'Claude', createdAt: Date.now(), lastUsedAt: null, revokedAt: null },
349
+ ]);
350
+ const user = userEvent.setup();
351
+ const first = mount(PUBLIC_URL);
352
+ await user.click(screen.getByRole('tab', { name: 'Autonomous agents' }));
353
+ await screen.findByText(/Your Claude connections are on the Marketplaces tab/);
354
+ first.unmount();
355
+
356
+ listMock.mockRejectedValue(new Error('keys are down'));
357
+ mount(PUBLIC_URL);
358
+ await user.click(screen.getByRole('tab', { name: 'Marketplaces' }));
359
+ await screen.findByText('keys are down');
360
+ expect(screen.queryByText(/None yet/)).toBeNull();
361
+ });
362
+ });
363
+
241
364
  describe('the one-click install link', () => {
242
365
  it('offers Add to Claude on a reachable deployment', () => {
243
366
  mount(PUBLIC_URL);
@@ -313,7 +436,7 @@ describe('tabs', () => {
313
436
  it('starts on the interactive tab', () => {
314
437
  mount(PUBLIC_URL);
315
438
  const tabs = screen.getAllByRole('tab');
316
- expect(tabs.map((t) => t.textContent)).toEqual(['Your agent', 'Autonomous agents']);
439
+ expect(tabs.map((t) => t.textContent)).toEqual(['Your agent', 'Marketplaces', 'Autonomous agents']);
317
440
  expect(tabs[0]).toHaveAttribute('aria-selected', 'true');
318
441
  expect(tabs[1]).toHaveAttribute('aria-selected', 'false');
319
442
  });
@@ -3,6 +3,8 @@ import { authFetch } from '../../../lib/api';
3
3
  export interface ExternalApiKeySummary {
4
4
  id: string;
5
5
  label: string;
6
+ /** `key` for one created by hand; `github-link` for one minted when a product (Claude) connected through the GitHub facade. */
7
+ kind: string;
6
8
  createdAt: number;
7
9
  lastUsedAt: number | null;
8
10
  revokedAt: number | null;
@@ -13,6 +13,7 @@ export function makeWorkspaceFixture(
13
13
  workspaceId: 'ws-1',
14
14
  kbDirName: 'knowledge-base',
15
15
  fileTree: null,
16
+ bootstrapError: null,
16
17
  openTabs: [],
17
18
  activeTab: null,
18
19
  dirtyTabFilenames: [],