@bevel-software/platform-core-frontend 0.26.0 → 0.28.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 (206) hide show
  1. package/package.json +2 -2
  2. package/src/core/CoreAppShell.tsx +87 -25
  3. package/src/core/ProductName.tsx +49 -0
  4. package/src/core/__tests__/ProductName.test.tsx +46 -0
  5. package/src/core/__tests__/ShellRoutes.test.tsx +22 -0
  6. package/src/core/__tests__/core-contributions.test.ts +16 -0
  7. package/src/core/core-contributions.ts +17 -0
  8. package/src/core/maker-url.ts +30 -0
  9. package/src/core/registry.ts +78 -1
  10. package/src/index.css +23 -5
  11. package/src/index.ts +5 -0
  12. package/src/lib/__tests__/latest-request.test.ts +48 -0
  13. package/src/lib/latest-request.ts +45 -0
  14. package/src/modules/access/__tests__/ManageAccessDialog.no-sso-invite.test.tsx +222 -0
  15. package/src/modules/access/__tests__/ManageAccessDialog.proposal.test.tsx +1 -1
  16. package/src/modules/access/api.ts +19 -3
  17. package/src/modules/access/components/ManageAccessDialog.tsx +61 -8
  18. package/src/modules/admin/__tests__/AdminRolesPage.fixed-admin.test.tsx +16 -1
  19. package/src/modules/admin/__tests__/RolesCorruptedBanner.test.tsx +70 -0
  20. package/src/modules/admin/__tests__/UserAccountsPage.test.tsx +284 -39
  21. package/src/modules/admin/components/AdminRolesPage.tsx +13 -14
  22. package/src/modules/admin/components/RolesCorruptedBanner.tsx +9 -4
  23. package/src/modules/admin/components/UserAccountsPage.tsx +91 -107
  24. package/src/modules/admin/services/roles.api.ts +14 -1
  25. package/src/modules/auth/__tests__/LoginScreen.test.tsx +80 -5
  26. package/src/modules/auth/__tests__/sso-strict-probe.test.ts +66 -0
  27. package/src/modules/auth/components/LoginScreen.tsx +101 -73
  28. package/src/modules/auth/services/account.api.ts +59 -3
  29. package/src/modules/auth/services/sso.ts +30 -10
  30. package/src/modules/auth/state/use-sign-in-methods.ts +41 -0
  31. package/src/modules/change-requests/__tests__/ChangeRequestDialog.sync-banner.test.tsx +176 -0
  32. package/src/modules/change-requests/__tests__/ChangeRequestDialog.unreadable.test.tsx +68 -0
  33. package/src/modules/change-requests/__tests__/ChangeRequestLink.test.tsx +182 -0
  34. package/src/modules/change-requests/__tests__/FileChangeBoxes.test.tsx +1 -1
  35. package/src/modules/change-requests/__tests__/readFileOnBranch.test.ts +79 -0
  36. package/src/modules/change-requests/components/ChangeBox.tsx +6 -1
  37. package/src/modules/change-requests/components/ChangeRequestDialog.tsx +45 -15
  38. package/src/modules/change-requests/components/ChangeRequestLink.tsx +151 -0
  39. package/src/modules/change-requests/components/CrFileTree.tsx +2 -1
  40. package/src/modules/change-requests/components/FileChangeBoxes.tsx +4 -2
  41. package/src/modules/change-requests/hooks/useApplyChangeRequest.ts +6 -3
  42. package/src/modules/change-requests/services/change-requests.api.ts +15 -2
  43. package/src/modules/change-requests/utils/readFailure.ts +22 -0
  44. package/src/modules/embed/__tests__/EmbedLinkPage.test.tsx +74 -0
  45. package/src/modules/embed/__tests__/EmbedView.test.tsx +473 -0
  46. package/src/modules/embed/__tests__/embed-config.test.ts +128 -0
  47. package/src/modules/embed/__tests__/embed-host.test.ts +111 -0
  48. package/src/modules/embed/__tests__/mcp-app-view.test.ts +295 -0
  49. package/src/modules/embed/__tests__/mount.test.tsx +157 -0
  50. package/src/modules/embed/components/EmbedLinkPage.tsx +109 -0
  51. package/src/modules/embed/components/EmbedView.tsx +545 -0
  52. package/src/modules/embed/embed-config.ts +132 -0
  53. package/src/modules/embed/embed-host.ts +120 -0
  54. package/src/modules/embed/mount.tsx +80 -0
  55. package/src/modules/embed/services/embed-token.ts +22 -0
  56. package/src/modules/embed/services/embed.api.ts +158 -0
  57. package/src/modules/git/__tests__/BranchSwitcher.test.tsx +202 -4
  58. package/src/modules/git/__tests__/GitSyncFailedBanner.test.tsx +59 -1
  59. package/src/modules/git/__tests__/PullNeededBanner.test.tsx +39 -22
  60. package/src/modules/git/__tests__/useAutoPullUpdates.test.tsx +7 -2
  61. package/src/modules/git/branch-delete-menu-item.tsx +24 -0
  62. package/src/modules/git/components/BranchSwitcher.tsx +29 -5
  63. package/src/modules/git/components/GitSyncFailedBanner.tsx +53 -15
  64. package/src/modules/git/components/HistoryVersionPreview.tsx +5 -3
  65. package/src/modules/git/components/PullNeededBanner.tsx +15 -49
  66. package/src/modules/git/hooks/useAutoPullUpdates.ts +9 -5
  67. package/src/modules/git/index.ts +15 -0
  68. package/src/modules/git/services/__tests__/error-messages.test.ts +67 -0
  69. package/src/modules/git/services/__tests__/pull-failure.test.ts +36 -0
  70. package/src/modules/git/services/error-messages.ts +58 -1
  71. package/src/modules/git/services/pull-failure.ts +68 -0
  72. package/src/modules/git/state/branch-delete-confirm.ts +46 -0
  73. package/src/modules/layout/__tests__/HeaderAlignment.test.tsx +1 -0
  74. package/src/modules/layout/__tests__/breakpoints.test.ts +7 -1
  75. package/src/modules/layout/breakpoints.ts +8 -0
  76. package/src/modules/library/__tests__/PluginExtras.test.tsx +9 -9
  77. package/src/modules/library/__tests__/PluginPage.test.tsx +8 -1
  78. package/src/modules/library/__tests__/SkillsTree.test.tsx +13 -4
  79. package/src/modules/library/components/LibraryPage.tsx +22 -0
  80. package/src/modules/library/components/PluginExtras.tsx +23 -6
  81. package/src/modules/library/components/PluginPage.tsx +6 -1
  82. package/src/modules/library/routes/LibraryRoutes.tsx +8 -7
  83. package/src/modules/library/services/plugins.api.ts +4 -1
  84. package/src/modules/library/state/plugins-revision.ts +28 -0
  85. package/src/modules/onboarding/__tests__/InviteButton.test.tsx +214 -0
  86. package/src/modules/onboarding/__tests__/agent-connection-api.test.ts +55 -0
  87. package/src/modules/onboarding/__tests__/creator-welcome.test.tsx +87 -82
  88. package/src/modules/onboarding/__tests__/first-page-prompt.test.ts +164 -0
  89. package/src/modules/onboarding/__tests__/get-started-column.test.tsx +1458 -0
  90. package/src/modules/onboarding/__tests__/invite-dialog.test.tsx +811 -0
  91. package/src/modules/onboarding/__tests__/invite-emails.test.ts +247 -0
  92. package/src/modules/onboarding/__tests__/onboarding.test.tsx +226 -193
  93. package/src/modules/onboarding/__tests__/starter-pack-card.test.tsx +136 -0
  94. package/src/modules/onboarding/components/CreatorWelcomePage.tsx +7 -11
  95. package/src/modules/onboarding/components/EmailChipsInput.tsx +138 -0
  96. package/src/modules/onboarding/components/GetStartedColumn.tsx +670 -0
  97. package/src/modules/onboarding/components/InviteButton.tsx +139 -0
  98. package/src/modules/onboarding/components/InviteDialog.tsx +741 -0
  99. package/src/modules/onboarding/components/RootLanding.tsx +8 -24
  100. package/src/modules/onboarding/components/StarterPackCard.tsx +98 -0
  101. package/src/modules/onboarding/components/WelcomePage.tsx +65 -154
  102. package/src/modules/onboarding/first-page-prompt.ts +123 -0
  103. package/src/modules/onboarding/invite-emails.ts +313 -0
  104. package/src/modules/onboarding/services/agent-connection.api.ts +53 -0
  105. package/src/modules/onboarding/services/starter-packs.api.ts +83 -0
  106. package/src/modules/onboarding/state/agent-connection.ts +167 -0
  107. package/src/modules/onboarding/state/invite-dialog.context.ts +35 -0
  108. package/src/modules/onboarding/state/invite-dialog.tsx +39 -0
  109. package/src/modules/onboarding/state/onboarding.ts +133 -59
  110. package/src/modules/onboarding/state/starter-packs.ts +169 -0
  111. package/src/modules/settings/settings-nav-items.tsx +8 -3
  112. package/src/modules/setup/__tests__/setup.first-run-storage.test.tsx +389 -0
  113. package/src/modules/setup/__tests__/setup.github.test.tsx +5 -5
  114. package/src/modules/setup/__tests__/setup.kept-draft.test.tsx +1 -1
  115. package/src/modules/setup/__tests__/setup.repository-change.test.tsx +1 -1
  116. package/src/modules/setup/__tests__/setup.repository.test.tsx +21 -21
  117. package/src/modules/setup/__tests__/setup.test.tsx +56 -15
  118. package/src/modules/setup/__tests__/useConnectionProbe.test.tsx +123 -0
  119. package/src/modules/setup/components/FirstRunStorage.tsx +560 -0
  120. package/src/modules/setup/components/SetupGate.tsx +46 -1
  121. package/src/modules/setup/components/SetupScreen.tsx +81 -84
  122. package/src/modules/setup/hooks/useConnectionProbe.ts +93 -0
  123. package/src/modules/setup/services/setup.api.ts +3 -3
  124. package/src/modules/setup/utils/suggested-branch.ts +27 -0
  125. package/src/modules/toolbar/commands/__tests__/actions.test.tsx +210 -0
  126. package/src/modules/toolbar/commands/actions.tsx +330 -0
  127. package/src/modules/toolbar/commands/command-menu.ts +44 -0
  128. package/src/modules/toolbar/commands/useCommandActions.ts +71 -0
  129. package/src/modules/toolbar/commands/useCommandShortcuts.ts +121 -0
  130. package/src/modules/toolbar/components/AppSwitcher.tsx +125 -22
  131. package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +1 -1
  132. package/src/modules/toolbar/components/ProfileMenu.tsx +9 -4
  133. package/src/modules/toolbar/components/SearchPalette.tsx +540 -0
  134. package/src/modules/toolbar/components/Toolbar.tsx +10 -0
  135. package/src/modules/toolbar/components/__tests__/AppSwitcher.test.tsx +230 -52
  136. package/src/modules/toolbar/components/__tests__/ProfileMenu.test.tsx +64 -0
  137. package/src/modules/toolbar/components/__tests__/SearchPalette.test.tsx +864 -0
  138. package/src/modules/toolbar/components/__tests__/Toolbar.test.tsx +57 -2
  139. package/src/modules/toolbar/search/__tests__/rank.test.ts +93 -0
  140. package/src/modules/toolbar/search/__tests__/sources.test.ts +131 -0
  141. package/src/modules/toolbar/search/rank.ts +111 -0
  142. package/src/modules/toolbar/search/sources.ts +169 -0
  143. package/src/modules/workflow/hooks/useFileLock.ts +10 -7
  144. package/src/modules/workflow/services/__tests__/lock.api.test.ts +41 -0
  145. package/src/modules/workflow/services/lock.api.ts +17 -2
  146. package/src/modules/workspace/__tests__/useWorkspaceState.test.ts +49 -1
  147. package/src/modules/workspace/components/EditorTabs.tsx +39 -15
  148. package/src/modules/workspace/components/FileExplorer.tsx +39 -6
  149. package/src/modules/workspace/components/FilePaneCard.tsx +6 -2
  150. package/src/modules/workspace/components/FileRoute.tsx +12 -7
  151. package/src/modules/workspace/components/FileViewer.tsx +271 -74
  152. package/src/modules/workspace/components/KbPageHeader.tsx +13 -6
  153. package/src/modules/workspace/components/__tests__/EditorTabs.test.tsx +88 -21
  154. package/src/modules/workspace/components/__tests__/FileExplorer.test.tsx +92 -4
  155. package/src/modules/workspace/components/__tests__/FileRoute.test.tsx +23 -3
  156. package/src/modules/workspace/components/__tests__/FileViewer.test.tsx +330 -6
  157. package/src/modules/workspace/components/__tests__/KbPageHeader.test.tsx +17 -2
  158. package/src/modules/workspace/components/renderers/DocxRenderer.tsx +11 -16
  159. package/src/modules/workspace/components/renderers/DownloadFileButton.tsx +6 -0
  160. package/src/modules/workspace/components/renderers/EmailRenderer.tsx +23 -21
  161. package/src/modules/workspace/components/renderers/ImageRenderer.tsx +13 -29
  162. package/src/modules/workspace/components/renderers/KbMarkdownView.tsx +9 -2
  163. package/src/modules/workspace/components/renderers/MarkdownRenderer.tsx +8 -0
  164. package/src/modules/workspace/components/renderers/PdfRenderer.tsx +14 -19
  165. package/src/modules/workspace/components/renderers/PptxRenderer.tsx +11 -17
  166. package/src/modules/workspace/components/renderers/ToolRenderer.tsx +35 -7
  167. package/src/modules/workspace/components/renderers/XlsxRenderer.tsx +11 -17
  168. package/src/modules/workspace/components/renderers/__tests__/EmailRenderer.links.test.tsx +73 -0
  169. package/src/modules/workspace/components/renderers/__tests__/ToolRenderer.scaffold.test.tsx +64 -0
  170. package/src/modules/workspace/components/renderers/__tests__/ToolRenderer.surface.test.tsx +82 -0
  171. package/src/modules/workspace/components/renderers/__tests__/bridgeHarness.ts +99 -0
  172. package/src/modules/workspace/components/renderers/__tests__/htmlSandbox.test.ts +129 -35
  173. package/src/modules/workspace/components/renderers/__tests__/htmlViewsGuide.test.ts +149 -0
  174. package/src/modules/workspace/components/renderers/__tests__/kbMarkdownLinkPolicy.test.tsx +100 -0
  175. package/src/modules/workspace/components/renderers/htmlSandbox.ts +76 -20
  176. package/src/modules/workspace/components/renderers/index.ts +26 -0
  177. package/src/modules/workspace/components/renderers/kbMarkdownPipeline.tsx +51 -1
  178. package/src/modules/workspace/components/renderers/rendererRawRead.ts +53 -0
  179. package/src/modules/workspace/components/renderers/rendererSurface.ts +109 -0
  180. package/src/modules/workspace/components/renderers/rendererWorkspace.ts +8 -2
  181. package/src/modules/workspace/hooks/__tests__/useCreatePage.test.ts +137 -0
  182. package/src/modules/workspace/hooks/__tests__/useKnowledgeWriteTarget.test.ts +302 -0
  183. package/src/modules/workspace/hooks/__tests__/useWorkspaceState.test.tsx +126 -21
  184. package/src/modules/workspace/hooks/useCreatePage.ts +206 -0
  185. package/src/modules/workspace/hooks/useKnowledgeWriteTarget.ts +238 -0
  186. package/src/modules/workspace/hooks/useWorkspaceImageResolver.ts +24 -7
  187. package/src/modules/workspace/hooks/useWorkspaceState.ts +42 -8
  188. package/src/modules/workspace/routing/__tests__/kb-routes.test.tsx +10 -0
  189. package/src/modules/workspace/routing/__tests__/md-links-parity.test.tsx +113 -0
  190. package/src/modules/workspace/routing/kb-routes.ts +66 -12
  191. package/src/modules/workspace/state/editable-page.ts +42 -0
  192. package/src/modules/workspace/state/workspace.context.ts +13 -4
  193. package/src/modules/workspace/utils/__tests__/display-file-name.test.ts +60 -0
  194. package/src/modules/workspace/utils/__tests__/fileTree.test.ts +75 -0
  195. package/src/modules/workspace/utils/__tests__/treeConfirm.test.ts +16 -0
  196. package/src/modules/workspace/utils/display-file-name.ts +102 -0
  197. package/src/modules/workspace/utils/fileTree.ts +49 -14
  198. package/src/modules/workspace/utils/treeConfirm.ts +15 -0
  199. package/src/shared/__tests__/no-builtin-confirm.test.ts +102 -0
  200. package/src/shared/components/ConfirmProvider.tsx +156 -0
  201. package/src/shared/components/Dialog.tsx +7 -0
  202. package/src/shared/components/__tests__/ConfirmProvider.test.tsx +198 -0
  203. package/src/shared/components/confirm-context.ts +94 -0
  204. package/src/shared/components/index.ts +3 -0
  205. package/src/modules/onboarding/components/WelcomeRoute.tsx +0 -57
  206. package/src/modules/onboarding/welcome-state.ts +0 -36
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bevel-software/platform-core-frontend",
3
- "version": "0.26.0",
3
+ "version": "0.28.0",
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",
@@ -45,7 +45,7 @@
45
45
  "tailwind-merge": "^3.5.0",
46
46
  "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz",
47
47
  "yaml": "^2.9.0",
48
- "@bevel-software/platform-shared": "0.26.0"
48
+ "@bevel-software/platform-shared": "0.28.0"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@testing-library/jest-dom": "^6.9.1",
@@ -52,8 +52,11 @@ import { ToolsExplorerPage } from '../modules/tools/ToolsExplorerPage';
52
52
  import { LibraryRoutes } from '../modules/library/routes/LibraryRoutes';
53
53
  import { RootLanding } from '../modules/onboarding/components/RootLanding';
54
54
  import { ConnectAgentPill } from '../modules/onboarding/components/ConnectAgentPill';
55
+ import { GetStartedColumn } from '../modules/onboarding/components/GetStartedColumn';
56
+ import { InviteDialogProvider } from '../modules/onboarding/state/invite-dialog';
55
57
  import { PullRequestsForMe } from '../modules/git/components/PullRequestsForMe';
56
58
  import { OpenChangeRequestDialog } from '../modules/pr/components/OpenChangeRequestDialog';
59
+ import { ChangeRequestLink } from '../modules/change-requests/components/ChangeRequestLink';
57
60
  import { useMediaQuery } from '../modules/layout/hooks/useMediaQuery';
58
61
  import { NARROW_QUERY } from '../modules/layout/breakpoints';
59
62
  import { setSidebarCollapsed } from '../modules/layout/state/sidebar';
@@ -67,12 +70,17 @@ import {
67
70
  useAppRegistry,
68
71
  type AppDef,
69
72
  type AppRegistry,
73
+ type RouteDef,
70
74
  type BannerDef,
71
75
  type CrCreationInput,
72
76
  type CrCreationPort,
73
77
  type PaneDef,
74
78
  } from './registry';
79
+ import { withCoreModuleContributions } from './core-contributions';
75
80
  import { isLibraryLocation } from '../modules/library/routes/library-paths';
81
+ import { EmbedView } from '../modules/embed/components/EmbedView';
82
+ import { EmbedLinkPage } from '../modules/embed/components/EmbedLinkPage';
83
+ import { ConfirmProvider } from '../shared/components';
76
84
 
77
85
  /**
78
86
  * The registry-driven application shell for the core modules (workspace, git,
@@ -193,6 +201,18 @@ const CORE_PANES: PaneDef[] = [
193
201
  { id: 'viewer', order: 20, node: <ViewerRoutes />, minSize: '30%' },
194
202
  ];
195
203
 
204
+ /**
205
+ * The two pages that are not part of the app: the embed a chat host frames,
206
+ * and the account-link page it sends an unlinked viewer to. Routes rather
207
+ * than apps — neither has a place in the switcher, neither sits inside the
208
+ * three-pane shell, and neither goes through the session gate (see the
209
+ * comment at the `<Routes>` block below).
210
+ */
211
+ const CORE_TOP_LEVEL_ROUTES: RouteDef[] = [
212
+ { path: '/embed', element: <EmbedView /> },
213
+ { path: '/embed/link', element: <EmbedLinkPage /> },
214
+ ];
215
+
196
216
  /**
197
217
  * The core apps behind the toolbar's app switcher. Each app is a full
198
218
  * surface below the always-mounted toolbar. "Skills & Tools" mounts
@@ -258,8 +278,21 @@ function CoreSurfaces() {
258
278
  // strip, the viewer's banner AND the Library's Skills tree all ask the same
259
279
  // question, and a tree rendered outside the provider would read the empty
260
280
  // default and never show a proposed file.
281
+ //
282
+ // The "Get set up" column sits beside whichever surface is on screen, here
283
+ // for the same reason: one checklist across both apps, mounted once, so it
284
+ // does not re-fetch or re-flash on a switch between them. The row wraps
285
+ // both branches identically, so it is the COLUMN that keeps its place in the
286
+ // tree and stays mounted across the switch. The surface beside it does not:
287
+ // `LibraryRoutes` and `KnowledgeSurface` are different components, so a
288
+ // switch unmounts one and mounts the other, as it always has.
261
289
  return (
262
- <OpenChangeRequestsProvider>{library ? <LibraryRoutes /> : <KnowledgeSurface />}</OpenChangeRequestsProvider>
290
+ <OpenChangeRequestsProvider>
291
+ <div className="flex h-full min-h-0">
292
+ <div className="min-w-0 flex-1">{library ? <LibraryRoutes /> : <KnowledgeSurface />}</div>
293
+ <GetStartedColumn />
294
+ </div>
295
+ </OpenChangeRequestsProvider>
263
296
  );
264
297
  }
265
298
 
@@ -349,6 +382,11 @@ export function AppChrome() {
349
382
  <AppClaimContext.Provider value={setClaimedApp}>
350
383
  <LayoutContext.Provider value={paneController ?? NO_PANES_LAYOUT}>
351
384
  <PaneControllerContext.Provider value={setPaneController}>
385
+ {/* The invite dialog's host: the toolbar's Invite button and the
386
+ "Get set up" column open the same one. Inside the registry's
387
+ providers (this is their child), so the dialog's slot can read
388
+ what a distribution provides there. */}
389
+ <InviteDialogProvider>
352
390
  {/* Flex-col wrapper so the (conditional) banner strip takes its own
353
391
  height and the toolbar + active surface flex into the rest. */}
354
392
  <div className="flex flex-col h-full">
@@ -362,6 +400,7 @@ export function AppChrome() {
362
400
  <ShellRoutes apps={apps} />
363
401
  </div>
364
402
  </div>
403
+ </InviteDialogProvider>
365
404
  </PaneControllerContext.Provider>
366
405
  </LayoutContext.Provider>
367
406
  </AppClaimContext.Provider>
@@ -430,29 +469,34 @@ export function ShellRoutes({ apps }: { apps: AppDef[] }) {
430
469
  <Route path="/connection-keys" element={<Navigate to="/audit-log" replace />} />
431
470
  <Route path="/tools" element={<ToolsExplorerPage />} />
432
471
  </Route>
433
- {/* `/` consults the onboarding: a brand-new account's FIRST visit lands
434
- on the welcome page, everyone else (and every later visit) goes to
435
- Knowledge as always.
472
+ {/* `/` lands on Knowledge — or on the deep link an SSO sign-in carried
473
+ through its round-trip (see `RootLanding`).
436
474
 
437
475
  `/auth/*` lands the same way, and that is not decoration. The SSO
438
476
  callback scrubs its own URL with a RAW `history.replaceState`
439
477
  (`microsoft-oauth.ts`), which BrowserRouter never observes — react
440
478
  -router only re-reads location on its own navigations and on
441
479
  popstate. So after a Microsoft sign-in the address bar says `/`
442
- while the router still matches `/auth/microsoft/callback`. Before
443
- this feature that was invisible, because `/` and `*` both redirected
444
- to Knowledge; the moment they differ, the first SSO sign-in — the
445
- exact case onboarding exists for — would fall through the catch-all
446
- and never be greeted. Routing the callback path here fixes it
447
- without moving the token-scrub out of the service that owns it.
480
+ while the router still matches `/auth/microsoft/callback`, and the
481
+ catch-all would drop the stashed deep link on the floor. Routing the
482
+ callback path here keeps it without moving the token-scrub out of
483
+ the service that owns it.
448
484
 
449
- The `*` catch-all stays a plain redirect: a mistyped URL is not a
450
- reason to be onboarded.
485
+ The `*` catch-all stays a plain redirect: a mistyped URL carries no
486
+ intention to honour.
451
487
 
452
488
  OUTSIDE the settings layout, like `/connect` above: these are landing
453
489
  and redirect targets, not settings destinations. */}
454
490
  <Route path="/" element={<RootLanding />} />
455
491
  <Route path="/auth/*" element={<RootLanding />} />
492
+ {/* The address every change-request link carries (the backend's
493
+ change-request-link helper: `open_change_request`, the read tools,
494
+ every summary's `url`). It opens the request itself, in the
495
+ change-request view, over a quiet page; closing it goes to Knowledge.
496
+ Before this route existed the catch-all below swallowed the link.
497
+ OUTSIDE the settings layout and the apps, like `/connect`: a landing
498
+ target, not a destination with a nav row. */}
499
+ <Route path="/change-requests/:number" element={<ChangeRequestLink />} />
456
500
  <Route path="*" element={<Navigate to={KB_ROUTE_PREFIX} replace />} />
457
501
  </Routes>
458
502
  );
@@ -569,12 +613,13 @@ function AppShell() {
569
613
  */
570
614
  export function CoreAppShell({ registry }: { registry: AppRegistry }) {
571
615
  // Core contributions merge ahead of registry-contributed ones: the core
572
- // apps (Knowledge + Skills & Tools) that the switcher and AppChrome read.
573
- // The review file-viewer panel is no longer registered here — see the note
574
- // on `chrome` above.
616
+ // apps (Knowledge + Skills & Tools) that the switcher and AppChrome read,
617
+ // and core modules' own rows (see `withCoreModuleContributions`). The
618
+ // review file-viewer panel is no longer registered here — see the note on
619
+ // `chrome` above.
575
620
  const mergedRegistry = useMemo<AppRegistry>(
576
621
  () => ({
577
- ...registry,
622
+ ...withCoreModuleContributions(registry),
578
623
  apps: [...CORE_APPS, ...registry.apps],
579
624
  }),
580
625
  [registry],
@@ -592,15 +637,32 @@ export function CoreAppShell({ registry }: { registry: AppRegistry }) {
592
637
  return (
593
638
  <AppRegistryContext.Provider value={mergedRegistry}>
594
639
  <BrowserRouter>
595
- {/* Sits above every route (including /embed) — backend downtime during
596
- a redeploy affects them all equally. */}
597
- <MaintenanceOverlay />
598
- <Routes>
599
- {registry.topLevelRoutes.map((r) => (
600
- <Route key={r.path} path={r.path} element={r.element} />
601
- ))}
602
- <Route path="*" element={<AppShell />} />
603
- </Routes>
640
+ {/* The app's own confirmation dialog, for every route: whatever asks
641
+ before acting asks through `useConfirm()`, never `window.confirm`,
642
+ which the browser can silence. Above the state hooks
643
+ (`useWorkspaceState` asks before closing an unsaved tab). */}
644
+ <ConfirmProvider>
645
+ {/* Sits above every route (including /embed) — backend downtime during
646
+ a redeploy affects them all equally. */}
647
+ <MaintenanceOverlay />
648
+ <Routes>
649
+ {/* The embed surface, OUTSIDE `AppShell` and its auth gate — like
650
+ the registry routes below, it owns its own auth story. `/embed`
651
+ authenticates by the embed token in its query and by nothing
652
+ else (there is no session inside a host's frame);
653
+ `/embed/link` is the one page that DOES act under a session,
654
+ which is why the server refuses to let any site frame it.
655
+ Core's first, so a deployment adds to the app rather than
656
+ having to re-register these. */}
657
+ {CORE_TOP_LEVEL_ROUTES.map((r) => (
658
+ <Route key={r.path} path={r.path} element={r.element} />
659
+ ))}
660
+ {registry.topLevelRoutes.map((r) => (
661
+ <Route key={r.path} path={r.path} element={r.element} />
662
+ ))}
663
+ <Route path="*" element={<AppShell />} />
664
+ </Routes>
665
+ </ConfirmProvider>
604
666
  </BrowserRouter>
605
667
  </AppRegistryContext.Provider>
606
668
  );
@@ -0,0 +1,49 @@
1
+ /**
2
+ * The product's name and its maker's: BRANDING, which is the app shell's
3
+ * to own. It lives beside the shell rather than among the shared components
4
+ * because those are domain-agnostic building blocks (a button, a dialog) and
5
+ * this is the one thing in the frontend that says which product this is.
6
+ */
7
+
8
+ import { useMakerUrl } from './maker-url';
9
+
10
+ /** The product's own name, before its maker's: the first half of {@link PRODUCT_NAME}. */
11
+ const PRODUCT = 'Hexis';
12
+
13
+ /** The maker's name: the second half of {@link PRODUCT_NAME}, and the linked part of {@link ProductName}. */
14
+ const MAKER = 'Bevel';
15
+
16
+ /**
17
+ * The product's name, as text: where a link cannot go, such as inside a
18
+ * button or another interactive control. A heading is not such a place — a
19
+ * link inside one is fine, so a title uses {@link ProductName}.
20
+ */
21
+ export const PRODUCT_NAME = `${PRODUCT} by ${MAKER}`;
22
+
23
+ /**
24
+ * The product's name wherever it is shown: "Hexis by Bevel", with the maker's
25
+ * name a link to its site.
26
+ *
27
+ * One component rather than the words at each call site, because the name
28
+ * used to differ by screen ("Bevel" in the toolbar and on the login page,
29
+ * "Hexis" elsewhere) and every copy is a place it can drift again. Both forms
30
+ * are built from the same two names, so the linked one cannot fall out of
31
+ * step with {@link PRODUCT_NAME}. A caller that sits inside a control, where
32
+ * a nested link is not allowed, passes `link={false}` or uses
33
+ * {@link PRODUCT_NAME}.
34
+ */
35
+ export function ProductName({ link = true, className }: { link?: boolean; className?: string }) {
36
+ const makerUrl = useMakerUrl();
37
+ return (
38
+ <span className={className}>
39
+ {PRODUCT} by{' '}
40
+ {link ? (
41
+ <a href={makerUrl} target="_blank" rel="noopener noreferrer" className="text-accent hover:underline">
42
+ {MAKER}
43
+ </a>
44
+ ) : (
45
+ MAKER
46
+ )}
47
+ </span>
48
+ );
49
+ }
@@ -0,0 +1,46 @@
1
+ import { afterEach, describe, expect, it } from 'vitest';
2
+ import { cleanup, render, screen } from '@testing-library/react';
3
+ import { ProductName } from '../ProductName';
4
+ import { MAKER_URL } from '../maker-url';
5
+ import { AppRegistryContext, makeRegistry } from '../registry';
6
+
7
+ afterEach(cleanup);
8
+
9
+ describe('ProductName', () => {
10
+ it("links the maker's name to the maker's site by default", () => {
11
+ render(<ProductName />);
12
+ expect(screen.getByRole('link', { name: 'Bevel' })).toHaveAttribute('href', MAKER_URL);
13
+ expect(MAKER_URL).toBe('https://bevel.software');
14
+ });
15
+
16
+ it('links it where the registry says, for a distribution with its own front door', () => {
17
+ render(
18
+ <AppRegistryContext.Provider value={makeRegistry({ makerLink: 'https://hexis.software' })}>
19
+ <ProductName />
20
+ </AppRegistryContext.Provider>,
21
+ );
22
+ const link = screen.getByRole('link', { name: 'Bevel' });
23
+ expect(link).toHaveAttribute('href', 'https://hexis.software');
24
+ expect(link).toHaveAttribute('target', '_blank');
25
+ expect(link.closest('span')).toHaveTextContent('Hexis by Bevel');
26
+ });
27
+
28
+ it("links the maker's site when the registry's place is empty, as when it is absent", () => {
29
+ render(
30
+ <AppRegistryContext.Provider value={makeRegistry({ makerLink: '' })}>
31
+ <ProductName />
32
+ </AppRegistryContext.Provider>,
33
+ );
34
+ expect(screen.getByRole('link', { name: 'Bevel' })).toHaveAttribute('href', MAKER_URL);
35
+ });
36
+
37
+ it('is plain text where a link cannot go, wherever the registry would send it', () => {
38
+ render(
39
+ <AppRegistryContext.Provider value={makeRegistry({ makerLink: 'https://hexis.software' })}>
40
+ <ProductName link={false} />
41
+ </AppRegistryContext.Provider>,
42
+ );
43
+ expect(screen.queryByRole('link')).toBeNull();
44
+ expect(screen.getByText('Hexis by Bevel')).toBeInTheDocument();
45
+ });
46
+ });
@@ -24,6 +24,17 @@ vi.mock('../../modules/secrets-vault/services/tool-secrets.api', () => ({
24
24
  deleteAdminVar: vi.fn(async () => {}),
25
25
  deleteUserVar: vi.fn(async () => {}),
26
26
  }));
27
+ // The change-request address opens the request by number; the fetch is
28
+ // stubbed so the route can render without a network, and the view is the
29
+ // stand-in below — the route table is what is under test.
30
+ vi.mock('../../modules/git/services/pr.api', () => ({
31
+ getPullRequest: vi.fn(async (num: number) => ({ number: num, title: `Request `, author: { login: 'bot' } })),
32
+ listPullRequestsForMe: vi.fn(async () => []),
33
+ listMyPullRequests: vi.fn(async () => []),
34
+ }));
35
+ vi.mock('../../modules/change-requests/components/ChangeRequestDialog', () => ({
36
+ ChangeRequestDialog: ({ cr }: { cr: { number: number } }) => <div data-testid="cr-dialog">{cr.number}</div>,
37
+ }));
27
38
 
28
39
  /** Exposes the router's current pathname so redirects can be asserted. */
29
40
  function LocationProbe() {
@@ -128,3 +139,14 @@ describe('ShellRoutes', () => {
128
139
  expect(screen.getByTestId('knowledge-surface')).toBeInTheDocument();
129
140
  });
130
141
  });
142
+
143
+ describe('ShellRoutes — the change-request address', () => {
144
+ // The link the backend builds for every change request. It used to fall
145
+ // into the catch-all and land on Knowledge with nothing open.
146
+ it('opens the request at /change-requests/<number> instead of redirecting', async () => {
147
+ renderAt('/change-requests/276');
148
+ expect(screen.getByTestId('pathname')).toHaveTextContent(/^\/change-requests\/276$/);
149
+ expect(await screen.findByTestId('cr-dialog')).toHaveTextContent('276');
150
+ expect(screen.queryByTestId('knowledge-surface')).not.toBeInTheDocument();
151
+ });
152
+ });
@@ -0,0 +1,16 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { withCoreModuleContributions } from '../core-contributions';
3
+ import { makeRegistry, type AdminMenuItem } from '../registry';
4
+
5
+ // Core modules offer their rows through their public surface and the shell
6
+ // merges them; the settings list never imports another module's rows.
7
+ describe('withCoreModuleContributions', () => {
8
+ it("merges git's profile-menu row ahead of the registry's", () => {
9
+ const extension: AdminMenuItem = { id: 'stub', label: 'Stub', path: '/stub' };
10
+ const merged = withCoreModuleContributions(makeRegistry({ adminMenuItems: [extension] }));
11
+ expect(merged.adminMenuItems.map((item) => item.id)).toEqual([
12
+ 'ask-before-branch-delete',
13
+ 'stub',
14
+ ]);
15
+ });
16
+ });
@@ -0,0 +1,17 @@
1
+ import { GIT_MENU_ITEMS } from '../modules/git';
2
+ import type { AppRegistry } from './registry';
3
+
4
+ /**
5
+ * Core modules' own contributions to the registry, merged AHEAD of
6
+ * registry-contributed ones so a downstream build adds to the app rather than
7
+ * reordering what core already put there. Each module offers them through its
8
+ * public surface (git's {@link GIT_MENU_ITEMS}); the settings list never
9
+ * imports another module's rows. The core apps are merged by `CoreAppShell`
10
+ * itself, since they are its own surfaces.
11
+ */
12
+ export function withCoreModuleContributions(registry: AppRegistry): AppRegistry {
13
+ return {
14
+ ...registry,
15
+ adminMenuItems: [...GIT_MENU_ITEMS, ...registry.adminMenuItems],
16
+ };
17
+ }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Where the maker's name in "Hexis by Bevel" leads. Its own module because
3
+ * two components link the name, `ProductName` and the toolbar's app menu,
4
+ * and a component's file exports components only (fast refresh).
5
+ */
6
+
7
+ import { useAppRegistry } from './registry';
8
+
9
+ /** Where the maker's name leads when the registry names no other place (`makerLink` absent or empty). */
10
+ export const MAKER_URL = 'https://bevel.software';
11
+
12
+ /**
13
+ * Where the maker's name leads in this deployment: the registry's
14
+ * `makerLink`, absent or empty {@link MAKER_URL}. One place for the rule, so
15
+ * the toolbar's menu, which links the name where its trigger cannot, leads
16
+ * where `ProductName` does.
17
+ */
18
+ export function useMakerUrl(): string {
19
+ const { makerLink } = useAppRegistry();
20
+ return makerLink || MAKER_URL;
21
+ }
22
+
23
+ /**
24
+ * What the app menu's entry for that place says: the registry's
25
+ * `makerLinkLabel`, absent or empty `fallback` (the product's name).
26
+ */
27
+ export function useMakerLinkLabel(fallback: string): string {
28
+ const { makerLinkLabel } = useAppRegistry();
29
+ return makerLinkLabel?.trim() || fallback;
30
+ }
@@ -17,8 +17,9 @@ import {
17
17
  type ReactElement,
18
18
  type ReactNode,
19
19
  } from 'react';
20
- import type { FileTreeEntry } from '@bevel-software/platform-shared';
20
+ import type { AuthUser, FileTreeEntry } from '@bevel-software/platform-shared';
21
21
  import type { FileRendererProps } from '../modules/workspace/components/renderers/types';
22
+ import type { CommandAction } from '../modules/toolbar/commands/actions';
22
23
 
23
24
  /** A route contributed to one of the shell's `<Routes>` blocks. */
24
25
  export interface RouteDef {
@@ -71,6 +72,8 @@ export interface AdminMenuItemHelpers {
71
72
  closeMenu(): void;
72
73
  /** react-router navigation. */
73
74
  navigate(to: string): void;
75
+ /** The signed-in person the menu belongs to. */
76
+ user: AuthUser;
74
77
  }
75
78
 
76
79
  /**
@@ -108,6 +111,12 @@ export interface AdminMenuItem {
108
111
  */
109
112
  path?: string;
110
113
  onSelect?(helpers: AdminMenuItemHelpers): void;
114
+ /**
115
+ * Whether the dropdown offers this row to `user` right now. Asked each time
116
+ * the panel renders, so a row can come and go with state the menu does not
117
+ * own (a preference in storage, say). Absent means always shown.
118
+ */
119
+ isShown?(user: AuthUser): boolean;
111
120
  dialog?(props: { open: boolean; onClose(): void }): ReactElement;
112
121
  }
113
122
 
@@ -449,6 +458,21 @@ export interface AppRegistry {
449
458
  * deployment's own identity provider. See {@link SignInOptionDef}.
450
459
  */
451
460
  signInOption?: SignInOptionDef;
461
+ /**
462
+ * What the first-run storage screen calls the repository the deployment
463
+ * keeps for itself: the card a new admin is steered towards.
464
+ *
465
+ * WHO keeps it is a property of the distribution, not of the screen. On a
466
+ * core deployment it is this server ("This server keeps it"); a hosted
467
+ * distribution keeps it on the admin's behalf and says so by name. Absent
468
+ * means core's words.
469
+ *
470
+ * The description travels WITH the title for the same reason the
471
+ * `welcomeExit` label travels with its path: a caller renaming the keeper
472
+ * without the sentence under it is how the card would come to contradict
473
+ * itself.
474
+ */
475
+ managedStorage?: { title: string; description: string };
452
476
  /**
453
477
  * How many unread items the gear menu's badge should show, if anything is
454
478
  * counting. CORE COUNTS NOTHING: the feedback inbox behind that badge is an
@@ -493,6 +517,59 @@ export interface AppRegistry {
493
517
  * the other is the likeliest way to produce it.
494
518
  */
495
519
  welcomeExit?: { path: string; label: string };
520
+ /**
521
+ * Where the maker's name in "Hexis by Bevel" leads (see `ProductName`):
522
+ * the login page, the first-run screen and the toolbar, where a wide
523
+ * toolbar links the name beside the apps and a compact one, whose name
524
+ * sits inside the menu's trigger, links it at the foot of the app menu.
525
+ * Absent or empty, it is the maker's own site. A distribution with a front
526
+ * door of its own points it there: the hosted cloud sends it to its
527
+ * Impressum, so the provider's details are one click from any workspace
528
+ * page on a wide toolbar and two on a compact one.
529
+ */
530
+ makerLink?: string;
531
+ /**
532
+ * What the app menu's own entry for `makerLink` says, where the name is
533
+ * not on screen as a link: the compact toolbar, and a wide one with more
534
+ * than three apps. Absent or empty, it says "Hexis by Bevel". The hosted
535
+ * cloud says "Impressum", so a page in the app names its Impressum as one
536
+ * a visitor recognises, not only behind the maker's name.
537
+ */
538
+ makerLinkLabel?: string;
539
+ /**
540
+ * Links under the sign-in card, on the login page only: the app behind it
541
+ * shows none. For a deployment whose provider must name itself to anyone
542
+ * who reaches it, such as the hosted cloud, which lists its Impressum and
543
+ * privacy policy here because German law wants them easy to recognise on
544
+ * every page of a commercial service. Absent or empty, there are none.
545
+ */
546
+ loginLinks?: { label: string; href: string }[];
547
+ /**
548
+ * A panel inside the invite dialog, between the role choice and the footer.
549
+ *
550
+ * Core invites by creating accounts and knows nothing about what a place in
551
+ * the deployment costs. A hosted deployment does: it renders its seat meter
552
+ * here (how many of the plan's seats these invites would fill — `inviting`
553
+ * is the number of valid addresses entered so far), and its "anyone at
554
+ * your domain can join" switch. Rendered inside a boundary, so a panel that
555
+ * throws costs its own place, never the invite form. Absent means core
556
+ * renders nothing there.
557
+ */
558
+ inviteExtras?: ComponentType<{ inviting: number }>;
559
+ /**
560
+ * Commands a distribution adds to the toolbar's command menu (Ctrl/⌘K),
561
+ * listed after core's own.
562
+ *
563
+ * Core's commands are the verbs every deployment has — New page, Invite
564
+ * people, the apps, the settings pages. A verb like "New ontology" belongs
565
+ * to the distribution that has ontologies, so core offers the place rather
566
+ * than the command, as it does for folder-menu entries. Each one is plain
567
+ * data plus `visible` and `run`, both handed the menu's context (router,
568
+ * admin verdict, page on screen) — see `CommandAction`. An id core already
569
+ * uses is dropped; a `visible` that throws costs only its own row. Absent
570
+ * means the menu offers core's commands and no others.
571
+ */
572
+ commandActions?: CommandAction[];
496
573
  }
497
574
 
498
575
  export const EMPTY_REGISTRY: AppRegistry = {
package/src/index.css CHANGED
@@ -11,6 +11,26 @@
11
11
  @import './shared/theme/index.css';
12
12
  @plugin "@tailwindcss/typography";
13
13
 
14
+ /* The hand over anything that can be clicked. Tailwind v4's preflight gives
15
+ buttons the browser's plain arrow, so a card, a tab or a text-styled link
16
+ built from <button> looked like text under the pointer. One rule here
17
+ rather than `cursor-pointer` at each call site, so a new control cannot
18
+ forget it. Disabled controls keep their own `cursor-not-allowed` — and
19
+ that includes a <button aria-disabled>, the disabled-by-choice spelling
20
+ that stays focusable (Menu.tsx), so both spellings are excluded alike. */
21
+ @layer base {
22
+ button:not(:disabled):not([aria-disabled='true']),
23
+ [role='button']:not([aria-disabled='true']),
24
+ summary,
25
+ select:not(:disabled),
26
+ input[type='checkbox']:not(:disabled),
27
+ input[type='radio']:not(:disabled),
28
+ label:has(> input[type='checkbox']:not(:disabled)),
29
+ label:has(> input[type='radio']:not(:disabled)) {
30
+ cursor: pointer;
31
+ }
32
+ }
33
+
14
34
  /* T21 is resolved: the brand purple is retired. Every call site now uses the
15
35
  design system's `accent` / `accent-hover`, so the app has ONE accent colour
16
36
  instead of a blue token and a purple one competing for the same job. The
@@ -23,7 +43,7 @@
23
43
  - `onboarding-pulse`: a soft accent ring that swells and fades — the CTA
24
44
  breathing. Box-shadow, not scale: the text must hold still while the
25
45
  control calls.
26
- - `onboarding-fade`: the welcome page's arrival, in two beats.
46
+ - `onboarding-fade`: a gentle arrival (the Get set up column's "You're set up").
27
47
 
28
48
  NAMED animations rather than `animate-[onboarding-fade_2.2s_…]` arbitrary
29
49
  values, and the difference is not tidiness. An arbitrary value encodes the
@@ -36,11 +56,9 @@
36
56
  which hot-reloads reliably — so tuning these numbers is now a CSS edit that
37
57
  takes effect, not a gamble on a cache. */
38
58
  @theme {
39
- /* The greeting, alone: the name lands and is allowed to be read. */
59
+ /* A short arrival: the Get set up column's "You're set up" lands and is
60
+ allowed to be read. */
40
61
  --animate-onboarding-greeting: onboarding-fade 2.2s cubic-bezier(0.16, 1, 0.3, 1) both;
41
- /* Everything under it, starting at the moment the greeting's opacity
42
- completes (55% of 2.2s) — the second beat, not a second event. */
43
- --animate-onboarding-body: onboarding-fade 1.5s cubic-bezier(0.16, 1, 0.3, 1) 1.1s both;
44
62
  /* The welcome page's Done, and the sidebar pill — the pill breathes slower,
45
63
  because it lives in the corner of your eye rather than under your cursor. */
46
64
  --animate-onboarding-pulse: onboarding-pulse 2.4s ease-out infinite;
package/src/index.ts CHANGED
@@ -20,5 +20,10 @@ import './html-extensions';
20
20
 
21
21
  export { loadServerConfig, renderConfigFailure } from './core/bootstrap';
22
22
  export { CoreAppShell, AuthGate } from './core/CoreAppShell';
23
+ // The embed, mounted OUTSIDE the app: what a deployment's `embed` entry calls
24
+ // when the MCP App view loads it into a chat host's sandbox (see
25
+ // `modules/embed/mount.tsx`).
26
+ export { mountEmbed, type MountEmbedOptions } from './modules/embed/mount';
27
+ export { readEmbedHandoff, EMBED_HANDOFF_GLOBAL, type EmbedHandoff } from './modules/embed/embed-config';
23
28
  export * from './core/registry';
24
29
  export * from './core/events';
@@ -0,0 +1,48 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { LatestRequest } from '../latest-request';
3
+
4
+ /** A request that answers when told to. */
5
+ function deferred<T>() {
6
+ let resolve!: (value: T) => void;
7
+ const promise = new Promise<T>((r) => (resolve = r));
8
+ return { promise, resolve };
9
+ }
10
+
11
+ describe('LatestRequest', () => {
12
+ it('applies and returns the answer of a request nothing overtook', async () => {
13
+ const applied: string[] = [];
14
+ const latest = new LatestRequest<string>();
15
+ expect(await latest.run(async () => 'a', (v) => applied.push(v))).toBe('a');
16
+ expect(applied).toEqual(['a']);
17
+ });
18
+
19
+ it('never applies an overtaken answer, and hands its caller the newest one, whatever order they answer in', async () => {
20
+ const applied: string[] = [];
21
+ const latest = new LatestRequest<string>();
22
+ const first = deferred<string>();
23
+ const second = deferred<string>();
24
+ const a = latest.run(() => first.promise, (v) => applied.push(v));
25
+ const b = latest.run(() => second.promise, (v) => applied.push(v));
26
+ // The older answers first: it is not applied, and its caller waits on.
27
+ first.resolve('old');
28
+ second.resolve('new');
29
+ expect(await a).toBe('new');
30
+ expect(await b).toBe('new');
31
+ expect(applied).toEqual(['new']);
32
+ });
33
+
34
+ it('waits through a request started while it was already waiting on a newer one', async () => {
35
+ const applied: string[] = [];
36
+ const latest = new LatestRequest<string>();
37
+ const [one, two, three] = [deferred<string>(), deferred<string>(), deferred<string>()];
38
+ const a = latest.run(() => one.promise, (v) => applied.push(v));
39
+ latest.run(() => two.promise, (v) => applied.push(v));
40
+ one.resolve('1');
41
+ await Promise.resolve();
42
+ latest.run(() => three.promise, (v) => applied.push(v));
43
+ two.resolve('2');
44
+ three.resolve('3');
45
+ expect(await a).toBe('3');
46
+ expect(applied).toEqual(['3']);
47
+ });
48
+ });