@bevel-software/platform-core-frontend 0.5.1 → 0.6.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bevel-software/platform-core-frontend",
3
- "version": "0.5.1",
3
+ "version": "0.6.1",
4
4
  "description": "Open-source core UI of the Bevel platform (raw TS/TSX source): workspace explorer/viewer, branches & change requests, Library, secrets, tools, access control.",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -41,7 +41,7 @@
41
41
  "tailwind-merge": "^3.5.0",
42
42
  "xlsx": "^0.18.5",
43
43
  "yaml": "^2.9.0",
44
- "@bevel-software/platform-shared": "0.5.1"
44
+ "@bevel-software/platform-shared": "0.6.1"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@testing-library/jest-dom": "^6.9.1",
@@ -306,6 +306,26 @@ export interface AppRegistry {
306
306
  * neither is provided the FileViewer hides its suggested-prompt buttons.
307
307
  */
308
308
  suggestedPromptSeed?: (prompt: string) => void;
309
+ /**
310
+ * Where the welcome page's exits go, and what the secondary one is called.
311
+ *
312
+ * The welcome page ends by sending a new person somewhere they can start,
313
+ * and WHERE that is, is a property of the product rather than of the page.
314
+ * Core sends them to their own skills shelf, because on a core deployment
315
+ * that is the product and a fresh knowledge base is empty. A distribution
316
+ * whose centre of gravity is the knowledge graph wants the opposite, and
317
+ * would otherwise greet every new user and then leave them in a surface
318
+ * they did not come for.
319
+ *
320
+ * Both exits use the value, so they cannot drift apart. A pending deep link
321
+ * still outranks it — someone who followed a link is owed that link, and
322
+ * onboarding must never eat an intention.
323
+ *
324
+ * The label travels WITH the path deliberately: "Go to your skills →"
325
+ * pointing at a knowledge base is a lie, and a caller changing one without
326
+ * the other is the likeliest way to produce it.
327
+ */
328
+ welcomeExit?: { path: string; label: string };
309
329
  }
310
330
 
311
331
  export const EMPTY_REGISTRY: AppRegistry = {
@@ -6,6 +6,7 @@ import { AuthContext } from '../../auth/state/auth.context';
6
6
  import { authValue } from '../../library/__tests__/auth-harness';
7
7
  import { LibraryToastProvider } from '../../library/state/toast';
8
8
  import { WelcomePage } from '../components/WelcomePage';
9
+ import { AppRegistryContext, EMPTY_REGISTRY } from '../../../core/registry';
9
10
  import { ConnectAgentPill } from '../components/ConnectAgentPill';
10
11
  import { RootLanding } from '../components/RootLanding';
11
12
  import { POST_LOGIN_REDIRECT_KEY } from '../../auth/services/sso';
@@ -454,6 +455,78 @@ describe('WelcomePage', () => {
454
455
  );
455
456
  expect(screen.getByTestId('pathname')).toHaveTextContent(DEEP);
456
457
  });
458
+
459
+ /**
460
+ * `AppRegistry.welcomeExit` moves where a new person starts. WHERE that is,
461
+ * is a property of the product: core sends them to their own skills shelf,
462
+ * because on a core deployment that is the product and a fresh knowledge
463
+ * base is empty. A distribution built around the knowledge graph wants the
464
+ * opposite and would otherwise greet someone and then leave them in a
465
+ * surface they did not come for.
466
+ *
467
+ * The tests above deliberately mount WITHOUT a registry, so they pin the
468
+ * default: the seam must be invisible to a deployment that does not use it.
469
+ */
470
+ describe('welcomeExit', () => {
471
+ const mountWithExit = (
472
+ welcomeExit: { path: string; label: string } | undefined,
473
+ // Same shape `mount` accepts — `typeof greeted` would pin `state` to
474
+ // `{ greeting: boolean }` and reject the deep-link case below.
475
+ route: string | { pathname: string; state?: unknown } = greeted,
476
+ ) =>
477
+ mount(
478
+ <AppRegistryContext.Provider value={{ ...EMPTY_REGISTRY, welcomeExit }}>
479
+ <Routes>
480
+ <Route path={WELCOME_PATH} element={<WelcomePage />} />
481
+ <Route path="/skills-and-tools/yours" element={<div>your group</div>} />
482
+ <Route path="/workspace" element={<div>knowledge</div>} />
483
+ </Routes>
484
+ </AppRegistryContext.Provider>,
485
+ newUser(),
486
+ route,
487
+ );
488
+
489
+ it('sends both exits to the configured destination', async () => {
490
+ mountWithExit({ path: '/workspace', label: 'Go to your knowledge base' });
491
+ await userEvent.click(screen.getByRole('button', { name: 'Done' }));
492
+ expect(screen.getByTestId('pathname')).toHaveTextContent('/workspace');
493
+ });
494
+
495
+ /**
496
+ * The label travels WITH the path. "Go to your skills →" pointing at a
497
+ * knowledge base is a lie, and letting a caller set one without the other
498
+ * is the likeliest way to produce it.
499
+ */
500
+ it('labels the skip link with the configured destination', () => {
501
+ mountWithExit({ path: '/workspace', label: 'Go to your knowledge base' });
502
+ expect(
503
+ screen.getByRole('button', { name: /Go to your knowledge base/ }),
504
+ ).toBeInTheDocument();
505
+ expect(screen.queryByRole('button', { name: /Go to your skills/ })).not.toBeInTheDocument();
506
+ });
507
+
508
+ it('falls back to the skills shelf when a registry sets nothing', async () => {
509
+ mountWithExit(undefined);
510
+ expect(screen.getByRole('button', { name: /Go to your skills/ })).toBeInTheDocument();
511
+ await userEvent.click(screen.getByRole('button', { name: 'Done' }));
512
+ expect(screen.getByTestId('pathname')).toHaveTextContent('/skills-and-tools/yours');
513
+ });
514
+
515
+ /**
516
+ * A deep link still outranks it. Someone who followed a link is owed that
517
+ * link, and no amount of deployment configuration may eat an intention.
518
+ */
519
+ it('does not override a carried deep link', async () => {
520
+ const DEEP = '/workspace/main/knowledge-base/KnowledgeBase/Start here.md';
521
+ mountWithExit(
522
+ { path: '/skills-and-tools/yours', label: 'Go to your skills' },
523
+ { pathname: WELCOME_PATH, state: { greeting: true, returnTo: DEEP } },
524
+ );
525
+ expect(screen.getByRole('button', { name: /Continue to your link/ })).toBeInTheDocument();
526
+ await userEvent.click(screen.getByRole('button', { name: 'Done' }));
527
+ expect(screen.getByTestId('pathname')).toHaveTextContent(DEEP);
528
+ });
529
+ });
457
530
  });
458
531
 
459
532
  describe('ConnectAgentPill', () => {
@@ -7,6 +7,7 @@ import { useAuth } from '../../auth/state/auth.context';
7
7
  import { useLibraryToast } from '../../library/state/toast.context';
8
8
  import { copyToClipboard, COPY_FAILED_TOAST } from '../../library/utils/clipboard';
9
9
  import { pathForLibraryFilter } from '../../library/routes/library-paths';
10
+ import { useAppRegistry } from '../../../core/registry';
10
11
  import { displayFirstName } from '../../library/utils/personal-group';
11
12
  import { setSidebarCollapsed } from '../../layout/state/sidebar';
12
13
  import { AGENT_CLIENTS, mcpUrlFromOrigin, type AgentClient } from '../agent-clients';
@@ -214,12 +215,20 @@ export function WelcomePage() {
214
215
  resetTimer.current = window.setTimeout(() => setCopied('idle'), 1500);
215
216
  }
216
217
 
217
- // Both exits land in the same place — the person's own group. Whether you
218
- // connected an agent or walked past it, where you want to be next is your
219
- // own shelf, not the whole company's catalog. Unless a deep link brought
220
- // them here: then both exits keep its promise instead.
221
- const yourGroup = pathForLibraryFilter({ kind: 'ungrouped' });
222
- const exitTo = returnTo ?? yourGroup;
218
+ // Both exits land in the same place. Whether you connected an agent or
219
+ // walked past it, where you want to be next is somewhere you can start —
220
+ // by default your own shelf, not the whole company's catalog. A deep link
221
+ // still outranks it: someone who followed a link is owed that link.
222
+ //
223
+ // `welcomeExit` lets a distribution move that destination, because WHERE a
224
+ // new person should start is a property of the product. A deployment built
225
+ // around the knowledge graph would otherwise greet someone and then leave
226
+ // them in a surface they did not come for. The label travels with the path
227
+ // so the two cannot contradict each other.
228
+ const { welcomeExit } = useAppRegistry();
229
+ const defaultExit = { path: pathForLibraryFilter({ kind: 'ungrouped' }), label: 'Go to your skills' };
230
+ const exit = welcomeExit ?? defaultExit;
231
+ const exitTo = returnTo ?? exit.path;
223
232
 
224
233
  /**
225
234
  * Conclude the onboarding and leave. The toast says where the setup went,
@@ -346,16 +355,17 @@ export function WelcomePage() {
346
355
  Done
347
356
  </Button>
348
357
  {/* The same destination Done goes to — one value drives both exits,
349
- so they cannot drift apart. Ordinarily that is your own shelf
350
- ("your skills" over "your library": the library is the whole
351
- company's); when a deep link brought you here, both exits keep
352
- its promise instead, and the label says so. */}
358
+ so they cannot drift apart. Ordinarily that is wherever the
359
+ deployment says a new person should start (core: your own shelf
360
+ — "your skills" over "your library", since the library is the
361
+ whole company's); when a deep link brought you here, both exits
362
+ keep its promise instead, and the label says so. */}
353
363
  <button
354
364
  type="button"
355
365
  onClick={() => navigate(exitTo)}
356
366
  className="text-detail text-ink-faint transition-colors hover:text-ink"
357
367
  >
358
- {returnTo ? 'Continue to your link →' : 'Go to your skills →'}
368
+ {returnTo ? 'Continue to your link →' : `${exit.label} →`}
359
369
  </button>
360
370
  </div>
361
371
  </div>