@bevel-software/platform-core-frontend 0.4.1 → 0.5.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 (327) hide show
  1. package/THIRD-PARTY-NOTICES.md +5366 -0
  2. package/package.json +7 -4
  3. package/src/core/CoreAppShell.tsx +195 -56
  4. package/src/core/__tests__/AppChrome.test.tsx +125 -0
  5. package/src/core/__tests__/ShellRoutes.test.tsx +37 -2
  6. package/src/core/__tests__/bootstrap.test.ts +63 -0
  7. package/src/core/bootstrap.ts +73 -0
  8. package/src/core/events.ts +12 -0
  9. package/src/core/registry.ts +58 -9
  10. package/src/index.css +100 -11
  11. package/src/index.ts +24 -23
  12. package/src/lib/utils.ts +93 -117
  13. package/src/modules/access/__tests__/ManageAccessDialog.placement.test.tsx +281 -0
  14. package/src/modules/access/__tests__/ManageAccessDialog.test.tsx +166 -1
  15. package/src/modules/access/api.ts +49 -0
  16. package/src/modules/access/components/ManageAccessDialog.tsx +786 -481
  17. package/src/modules/access/hooks/useFileAccess.ts +1 -1
  18. package/src/modules/admin/__tests__/AdminRolesPage.suggest.test.tsx +86 -0
  19. package/src/modules/admin/__tests__/UserAccountsPage.test.tsx +17 -1
  20. package/src/modules/admin/__tests__/admin.unread.test.tsx +61 -0
  21. package/src/modules/admin/components/AdminRolesPage.tsx +44 -38
  22. package/src/modules/admin/components/RolesCorruptedBanner.tsx +11 -10
  23. package/src/modules/admin/components/UserAccountsPage.tsx +36 -28
  24. package/src/modules/admin/state/admin.context.tsx +15 -6
  25. package/src/modules/auth/components/AccountPage.tsx +11 -11
  26. package/src/modules/auth/components/LoginScreen.tsx +12 -12
  27. package/src/modules/auth/services/sso.ts +47 -1
  28. package/src/modules/change-requests/__tests__/ChangeRequestDialog.test.tsx +277 -0
  29. package/src/modules/change-requests/__tests__/author.test.ts +48 -0
  30. package/src/modules/change-requests/__tests__/conflict.test.ts +73 -0
  31. package/src/modules/change-requests/__tests__/diff.test.ts +134 -0
  32. package/src/modules/change-requests/__tests__/propose.test.ts +93 -0
  33. package/src/modules/change-requests/__tests__/useFileOnBranch.test.tsx +72 -0
  34. package/src/modules/change-requests/change-requests.css +22 -0
  35. package/src/modules/change-requests/components/ChangeBox.tsx +277 -0
  36. package/src/modules/change-requests/components/ChangeRequestDialog.tsx +713 -0
  37. package/src/modules/change-requests/components/ConflictHelp.tsx +47 -0
  38. package/src/modules/change-requests/components/CrFileTree.tsx +398 -0
  39. package/src/modules/change-requests/components/FileChangeBoxes.tsx +168 -0
  40. package/src/modules/change-requests/hooks/useApplyChangeRequest.ts +236 -0
  41. package/src/modules/change-requests/hooks/useCrFileDiffs.ts +79 -0
  42. package/src/modules/change-requests/hooks/useFileOnBranch.ts +80 -0
  43. package/src/modules/change-requests/services/change-requests.api.ts +45 -0
  44. package/src/modules/change-requests/services/propose.api.ts +162 -0
  45. package/src/modules/change-requests/utils/author.ts +47 -0
  46. package/src/modules/change-requests/utils/conflict.ts +38 -0
  47. package/src/modules/change-requests/utils/diff.ts +80 -0
  48. package/src/modules/git/__tests__/BranchSwitcher.test.tsx +27 -18
  49. package/src/modules/git/__tests__/FileHistoryPanel.test.tsx +36 -83
  50. package/src/modules/git/__tests__/PullNeededBanner.test.tsx +5 -5
  51. package/src/modules/git/__tests__/PullRequestsForMe.test.tsx +147 -0
  52. package/src/modules/git/__tests__/useAutoPullUpdates.test.tsx +2 -8
  53. package/src/modules/git/components/BranchSwitcher.tsx +68 -31
  54. package/src/modules/git/components/DiffView.tsx +4 -4
  55. package/src/modules/git/components/FileComparisonPanel.tsx +20 -20
  56. package/src/modules/git/components/FileHistoryPanel.tsx +71 -107
  57. package/src/modules/git/components/PullNeededBanner.tsx +6 -13
  58. package/src/modules/git/components/PullRequestsForMe.tsx +71 -36
  59. package/src/modules/git/components/UnifiedDiffView.tsx +4 -4
  60. package/src/modules/git/hooks/__tests__/useGitState.deleteBranch.test.tsx +2 -2
  61. package/src/modules/git/hooks/useGitState.ts +15 -14
  62. package/src/modules/git/services/__tests__/error-messages.test.ts +4 -4
  63. package/src/modules/git/services/error-messages.ts +7 -7
  64. package/src/modules/git/services/git.api.ts +17 -11
  65. package/src/modules/git/services/pr-prompts.ts +2 -2
  66. package/src/modules/git/state/git.context.ts +10 -1
  67. package/src/modules/layout/__tests__/SidebarFrameResponsive.test.tsx +224 -0
  68. package/src/modules/layout/__tests__/SidebarToggle.test.tsx +242 -0
  69. package/src/modules/layout/__tests__/breakpoints.test.ts +56 -0
  70. package/src/modules/layout/breakpoints.ts +6 -0
  71. package/src/modules/layout/components/AppLayout.tsx +17 -5
  72. package/src/modules/layout/components/DemoBanner.tsx +10 -1
  73. package/src/modules/layout/components/MaintenanceOverlay.tsx +3 -3
  74. package/src/modules/layout/components/MobileChatLayout.tsx +31 -26
  75. package/src/modules/layout/components/ResizableThreePaneLayout.tsx +59 -24
  76. package/src/modules/layout/components/SidebarFrame.tsx +317 -0
  77. package/src/modules/layout/components/SidebarToggle.tsx +86 -0
  78. package/src/modules/layout/components/SlideOverlay.tsx +1 -1
  79. package/src/modules/layout/components/__tests__/MobileChatLayout.test.tsx +40 -2
  80. package/src/modules/layout/components/__tests__/ResizableThreePaneLayout.test.tsx +19 -3
  81. package/src/modules/layout/state/sidebar.ts +200 -0
  82. package/src/modules/library/__tests__/AddToGroupDialog.test.tsx +313 -0
  83. package/src/modules/library/__tests__/ChangeRequestDock.test.tsx +84 -0
  84. package/src/modules/library/__tests__/GroupJoinRequests.test.tsx +178 -0
  85. package/src/modules/library/__tests__/GroupPage.test.tsx +479 -0
  86. package/src/modules/library/__tests__/GroupsIndexPage.test.tsx +283 -0
  87. package/src/modules/library/__tests__/GroupsSidebar.contextmenu.test.tsx +175 -0
  88. package/src/modules/library/__tests__/GroupsSidebar.locked.test.tsx +96 -0
  89. package/src/modules/library/__tests__/GroupsSidebar.test.tsx +142 -0
  90. package/src/modules/library/__tests__/GroupsSidebarMenu.test.tsx +142 -0
  91. package/src/modules/library/__tests__/LibraryCard.test.tsx +149 -0
  92. package/src/modules/library/__tests__/LibraryRoutes.test.tsx +378 -0
  93. package/src/modules/library/__tests__/LibrarySidebarMenu.test.tsx +347 -0
  94. package/src/modules/library/__tests__/LockedGroupView.test.tsx +203 -0
  95. package/src/modules/library/__tests__/NewGroupDialog.test.tsx +114 -0
  96. package/src/modules/library/__tests__/PersonalAddDialog.test.tsx +177 -0
  97. package/src/modules/library/__tests__/SkillPage.test.tsx +1063 -0
  98. package/src/modules/library/__tests__/ToolConnectionSection.test.tsx +259 -0
  99. package/src/modules/library/__tests__/ToolLogo.test.tsx +63 -0
  100. package/src/modules/library/__tests__/ToolPage.test.tsx +315 -0
  101. package/src/modules/library/__tests__/ToolSharePanel.test.tsx +36 -0
  102. package/src/modules/library/__tests__/ToolVarRow.test.tsx +260 -0
  103. package/src/modules/library/__tests__/WorkspaceItemRoute.test.tsx +197 -0
  104. package/src/modules/library/__tests__/auth-harness.tsx +37 -0
  105. package/src/modules/library/__tests__/oauth-fragment.test.ts +48 -0
  106. package/src/modules/library/__tests__/status.test.ts +113 -20
  107. package/src/modules/library/__tests__/useSkillDetail.test.tsx +102 -0
  108. package/src/modules/library/__tests__/useToolPage.test.tsx +146 -0
  109. package/src/modules/library/components/AccessRequestsBanner.tsx +101 -0
  110. package/src/modules/library/components/AddToGroupDialog.tsx +115 -0
  111. package/src/modules/library/components/ChangeRequestDock.tsx +52 -28
  112. package/src/modules/library/components/DeleteGroupDialog.tsx +87 -0
  113. package/src/modules/library/components/GroupIndexRow.tsx +63 -0
  114. package/src/modules/library/components/GroupJoinRequests.tsx +56 -0
  115. package/src/modules/library/components/GroupPage.tsx +373 -0
  116. package/src/modules/library/components/GroupsIndexPage.tsx +222 -0
  117. package/src/modules/library/components/GroupsSidebar.tsx +338 -0
  118. package/src/modules/library/components/GroupsSidebarMenu.tsx +160 -0
  119. package/src/modules/library/components/LibraryCard.tsx +123 -102
  120. package/src/modules/library/components/LibraryLayout.tsx +344 -0
  121. package/src/modules/library/components/LibraryPage.tsx +111 -227
  122. package/src/modules/library/components/LockGlyph.tsx +31 -0
  123. package/src/modules/library/components/LockedGroupView.tsx +159 -0
  124. package/src/modules/library/components/ManagedGroupRequests.tsx +70 -0
  125. package/src/modules/library/components/NewGroupDialog.tsx +112 -0
  126. package/src/modules/library/components/NewSkillPanel.tsx +151 -0
  127. package/src/modules/library/components/PageActions.tsx +156 -0
  128. package/src/modules/library/components/PendingSkillReview.tsx +63 -0
  129. package/src/modules/library/components/PersonalAddDialog.tsx +88 -0
  130. package/src/modules/library/components/PersonalGroupPage.tsx +125 -0
  131. package/src/modules/library/components/StatusDot.tsx +25 -0
  132. package/src/modules/library/components/ToolLogo.tsx +171 -0
  133. package/src/modules/library/components/group-page-parts.tsx +419 -0
  134. package/src/modules/library/components/skill-page/SkillFileEditor.tsx +134 -0
  135. package/src/modules/library/components/skill-page/SkillFilePane.tsx +117 -0
  136. package/src/modules/library/components/skill-page/SkillFileTabs.tsx +112 -0
  137. package/src/modules/library/components/skill-page/SkillPage.tsx +673 -0
  138. package/src/modules/library/components/skill-page/tab-ids.ts +33 -0
  139. package/src/modules/library/components/tool-page/ToolConnectionSection.tsx +175 -0
  140. package/src/modules/library/components/tool-page/ToolPage.tsx +228 -0
  141. package/src/modules/library/components/tool-page/ToolSharePanel.tsx +45 -0
  142. package/src/modules/library/components/tool-page/ToolVarRow.tsx +289 -0
  143. package/src/modules/library/hooks/useJoinRequests.ts +114 -0
  144. package/src/modules/library/hooks/useLibraryData.ts +134 -119
  145. package/src/modules/library/hooks/useSkillDetail.ts +119 -74
  146. package/src/modules/library/hooks/useToolPage.ts +145 -0
  147. package/src/modules/library/library.css +33 -245
  148. package/src/modules/library/routes/LibraryRoutes.tsx +134 -0
  149. package/src/modules/library/routes/WorkspaceItemRoute.tsx +74 -0
  150. package/src/modules/library/routes/library-paths.ts +191 -0
  151. package/src/modules/library/services/groups.api.ts +189 -0
  152. package/src/modules/library/services/library.api.ts +291 -164
  153. package/src/modules/library/services/tools.api.ts +60 -0
  154. package/src/modules/library/state/library-context.ts +22 -0
  155. package/src/modules/library/state/library-data.tsx +223 -0
  156. package/src/modules/library/state/toast.context.ts +32 -0
  157. package/src/modules/library/state/toast.tsx +84 -42
  158. package/src/modules/library/utils/clipboard.ts +33 -0
  159. package/src/modules/library/utils/group-summary.ts +68 -0
  160. package/src/modules/library/utils/names.ts +30 -0
  161. package/src/modules/library/utils/navigate-external.ts +15 -0
  162. package/src/modules/library/utils/oauth-fragment.ts +32 -0
  163. package/src/modules/library/utils/personal-group.ts +36 -0
  164. package/src/modules/library/utils/status.ts +108 -25
  165. package/src/modules/library/utils/toast-duration.ts +16 -0
  166. package/src/modules/onboarding/__tests__/onboarding.test.tsx +533 -0
  167. package/src/modules/onboarding/agent-clients.ts +48 -0
  168. package/src/modules/onboarding/components/ConnectAgentPill.tsx +133 -0
  169. package/src/modules/onboarding/components/RootLanding.tsx +54 -0
  170. package/src/modules/onboarding/components/WelcomePage.tsx +364 -0
  171. package/src/modules/onboarding/paths.ts +9 -0
  172. package/src/modules/onboarding/state/onboarding.ts +191 -0
  173. package/src/modules/pr/components/OpenChangeRequestDialog.tsx +10 -10
  174. package/src/modules/pr/services/pr-approvals.api.ts +19 -0
  175. package/src/modules/pr/services/pr-cancel.api.ts +11 -0
  176. package/src/modules/review/components/BinaryChangePlaceholder.tsx +3 -3
  177. package/src/modules/review/components/DiffViewer.tsx +4 -4
  178. package/src/modules/review/components/MarkdownDiffViewer.tsx +84 -26
  179. package/src/modules/review/components/ReviewFileRow.tsx +10 -10
  180. package/src/modules/review/components/ReviewPanel.tsx +49 -17
  181. package/src/modules/review/components/ReviewPanelSurface.tsx +1 -1
  182. package/src/modules/review/components/__tests__/MarkdownDiffViewer.test.tsx +122 -0
  183. package/src/modules/review/hooks/__tests__/useReviewState.test.ts +1 -1
  184. package/src/modules/secrets-vault/components/ConnectToolsPage.tsx +273 -171
  185. package/src/modules/secrets-vault/components/SecretsPage.tsx +147 -110
  186. package/src/modules/secrets-vault/components/ToolSecretsPanel.tsx +109 -92
  187. package/src/modules/secrets-vault/components/__tests__/SecretsPage.test.tsx +35 -4
  188. package/src/modules/secrets-vault/services/connect.api.ts +24 -3
  189. package/src/modules/settings/components/DeploymentPage.tsx +90 -0
  190. package/src/modules/settings/components/SettingsLayout.tsx +135 -0
  191. package/src/modules/settings/components/SettingsNav.tsx +114 -0
  192. package/src/modules/settings/components/__tests__/DeploymentPage.test.tsx +110 -0
  193. package/src/modules/settings/components/__tests__/SettingsLayout.test.tsx +249 -0
  194. package/src/modules/settings/settings-nav-items.tsx +166 -0
  195. package/src/modules/setup/__tests__/setup.test.tsx +540 -0
  196. package/src/modules/setup/components/SetupGate.tsx +67 -0
  197. package/src/modules/setup/components/SetupScreen.tsx +573 -0
  198. package/src/modules/setup/services/setup.api.ts +106 -0
  199. package/src/modules/setup/utils/git-host.ts +34 -0
  200. package/src/modules/toolbar/components/AppSwitcher.tsx +38 -15
  201. package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +50 -50
  202. package/src/modules/toolbar/components/ProfileMenu.tsx +294 -0
  203. package/src/modules/toolbar/components/Toolbar.tsx +56 -54
  204. package/src/modules/toolbar/components/__tests__/AppSwitcher.test.tsx +176 -122
  205. package/src/modules/toolbar/components/__tests__/Toolbar.test.tsx +252 -77
  206. package/src/modules/tools/ToolsExplorerPage.tsx +45 -40
  207. package/src/modules/workspace/__tests__/design-system-parity.test.ts +133 -0
  208. package/src/modules/workspace/__tests__/testFixtures.ts +2 -0
  209. package/src/modules/workspace/components/EditorTabs.tsx +82 -50
  210. package/src/modules/workspace/components/FileExplorer.tsx +413 -189
  211. package/src/modules/workspace/components/FilePaneCard.tsx +53 -0
  212. package/src/modules/workspace/components/FileRoute.tsx +89 -84
  213. package/src/modules/workspace/components/FileViewer.tsx +700 -294
  214. package/src/modules/workspace/components/KbDocumentShell.tsx +138 -0
  215. package/src/modules/workspace/components/KbFileRail.tsx +128 -0
  216. package/src/modules/workspace/components/KbPageHeader.tsx +390 -0
  217. package/src/modules/workspace/components/__tests__/EditorTabs.test.tsx +87 -3
  218. package/src/modules/workspace/components/__tests__/FileExplorer.test.tsx +293 -39
  219. package/src/modules/workspace/components/__tests__/FileRoute.test.tsx +1 -16
  220. package/src/modules/workspace/components/__tests__/FileViewer.test.tsx +462 -44
  221. package/src/modules/workspace/components/__tests__/KbDocumentShell.test.tsx +84 -0
  222. package/src/modules/workspace/components/__tests__/KbFileRail.test.tsx +83 -0
  223. package/src/modules/workspace/components/__tests__/KbPageHeader.test.tsx +192 -0
  224. package/src/modules/workspace/components/renderers/CopyAnchorButton.tsx +64 -0
  225. package/src/modules/workspace/components/renderers/CsvRenderer.tsx +8 -8
  226. package/src/modules/workspace/components/renderers/DocxRenderer.tsx +18 -9
  227. package/src/modules/workspace/components/renderers/HtmlRenderer.tsx +14 -14
  228. package/src/modules/workspace/components/renderers/ImageRenderer.tsx +2 -2
  229. package/src/modules/workspace/components/renderers/KbMarkdownView.tsx +31 -165
  230. package/src/modules/workspace/components/renderers/MarkdownRenderer.tsx +18 -5
  231. package/src/modules/workspace/components/renderers/MermaidDiagram.tsx +27 -10
  232. package/src/modules/workspace/components/renderers/PdfRenderer.tsx +2 -2
  233. package/src/modules/workspace/components/renderers/TextRenderer.tsx +11 -5
  234. package/src/modules/workspace/components/renderers/ToolForm.tsx +24 -24
  235. package/src/modules/workspace/components/renderers/ToolRenderer.tsx +27 -27
  236. package/src/modules/workspace/components/renderers/XlsxRenderer.tsx +11 -11
  237. package/src/modules/workspace/components/renderers/__tests__/DocxRenderer.test.tsx +66 -0
  238. package/src/modules/workspace/components/renderers/__tests__/KbMarkdownView.test.tsx +17 -1
  239. package/src/modules/workspace/components/renderers/__tests__/MarkdownRenderer.test.tsx +1 -1
  240. package/src/modules/workspace/components/renderers/__tests__/MermaidDiagram.test.tsx +58 -0
  241. package/src/modules/workspace/components/renderers/__tests__/lazyRenderer.test.tsx +68 -0
  242. package/src/modules/workspace/components/renderers/__tests__/rendererLayout.test.ts +64 -0
  243. package/src/modules/workspace/components/renderers/__tests__/sanitizeDocxHtml.test.ts +0 -0
  244. package/src/modules/workspace/components/renderers/chunk-boundary.tsx +71 -0
  245. package/src/modules/workspace/components/renderers/index.ts +78 -2
  246. package/src/modules/workspace/components/renderers/kbMarkdownPipeline.tsx +241 -0
  247. package/src/modules/workspace/components/renderers/lazyRenderer.tsx +59 -0
  248. package/src/modules/workspace/components/renderers/sanitizeDocxHtml.ts +91 -0
  249. package/src/modules/workspace/hooks/__tests__/useLinksOut.test.ts +59 -0
  250. package/src/modules/workspace/hooks/__tests__/useOpenChangeRequests.test.tsx +237 -0
  251. package/src/modules/workspace/hooks/__tests__/useWorkspaceState.test.tsx +185 -0
  252. package/src/modules/workspace/hooks/useAutoGrowTextarea.ts +30 -0
  253. package/src/modules/workspace/hooks/useLastCommit.ts +66 -0
  254. package/src/modules/workspace/hooks/useLinksOut.ts +56 -0
  255. package/src/modules/workspace/hooks/useOpenChangeRequests.ts +20 -0
  256. package/src/modules/workspace/hooks/useWorkspaceState.ts +123 -14
  257. package/src/modules/workspace/routing/__tests__/kb-routes.test.tsx +1 -1
  258. package/src/modules/workspace/services/workspace.api.ts +9 -2
  259. package/src/modules/workspace/state/open-change-requests.context.ts +35 -0
  260. package/src/modules/workspace/state/open-change-requests.tsx +185 -0
  261. package/src/modules/workspace/state/workspace.context.ts +9 -0
  262. package/src/modules/workspace/utils/__tests__/diff.test.ts +87 -0
  263. package/src/modules/workspace/utils/diff.ts +130 -53
  264. package/src/modules/workspace/utils/fileTree.ts +7 -4
  265. package/src/modules/workspace/workspace.css +28 -0
  266. package/src/shared/components/Badge.tsx +62 -0
  267. package/src/shared/components/Banner.tsx +58 -0
  268. package/src/shared/components/Button.tsx +90 -0
  269. package/src/shared/components/Dialog.tsx +6 -6
  270. package/src/shared/components/Field.tsx +45 -0
  271. package/src/shared/components/IconButton.tsx +74 -0
  272. package/src/shared/components/ListRow.tsx +96 -0
  273. package/src/shared/components/Menu.tsx +88 -0
  274. package/src/shared/components/PageShell.tsx +8 -5
  275. package/src/shared/components/Surface.tsx +86 -0
  276. package/src/shared/components/__tests__/primitives.test.tsx +333 -0
  277. package/src/shared/components/index.ts +48 -0
  278. package/src/shared/components/useDismissableMenu.ts +71 -0
  279. package/src/shared/theme/__tests__/accent-contrast.test.ts +84 -0
  280. package/src/shared/theme/index.css +12 -0
  281. package/src/shared/theme/measure.ts +64 -0
  282. package/src/shared/theme/shadows.css +34 -0
  283. package/src/shared/theme/tokens.css +193 -0
  284. package/src/test-setup.ts +9 -0
  285. package/src/modules/access/components/AccessRestrictedBanner.tsx +0 -31
  286. package/src/modules/access/components/NodeOwnersBanner.tsx +0 -30
  287. package/src/modules/git/__tests__/ProtectedBranchBanner.test.tsx +0 -82
  288. package/src/modules/git/components/ProtectedBranchBanner.tsx +0 -42
  289. package/src/modules/library/__tests__/DetailDialog.test.tsx +0 -200
  290. package/src/modules/library/__tests__/diff.test.ts +0 -62
  291. package/src/modules/library/__tests__/loadout.test.tsx +0 -72
  292. package/src/modules/library/components/CompareView.tsx +0 -357
  293. package/src/modules/library/components/DetailDialog.tsx +0 -566
  294. package/src/modules/library/components/GearIcon.tsx +0 -12
  295. package/src/modules/library/components/LoadoutSidebar.tsx +0 -156
  296. package/src/modules/library/components/StatusGem.tsx +0 -21
  297. package/src/modules/library/components/SuggestChange.tsx +0 -171
  298. package/src/modules/library/components/particles.ts +0 -50
  299. package/src/modules/library/state/loadout.tsx +0 -129
  300. package/src/modules/library/utils/diff.ts +0 -102
  301. package/src/modules/pr/__tests__/PrApprovalBadge.test.tsx +0 -93
  302. package/src/modules/pr/__tests__/PrCancelButton.test.tsx +0 -158
  303. package/src/modules/pr/__tests__/PrCancelConfirmDialog.test.tsx +0 -44
  304. package/src/modules/pr/__tests__/PrMergeButton.test.tsx +0 -360
  305. package/src/modules/pr/__tests__/bucketize-comments.test.ts +0 -85
  306. package/src/modules/pr/__tests__/parsePatch.test.ts +0 -104
  307. package/src/modules/pr/__tests__/usePrViewerState.test.ts +0 -72
  308. package/src/modules/pr/components/PrApprovalBadge.tsx +0 -80
  309. package/src/modules/pr/components/PrCancelButton.tsx +0 -99
  310. package/src/modules/pr/components/PrCancelConfirmDialog.tsx +0 -119
  311. package/src/modules/pr/components/PrCommentComposer.tsx +0 -92
  312. package/src/modules/pr/components/PrCommentThread.tsx +0 -168
  313. package/src/modules/pr/components/PrCommentsPanel.tsx +0 -143
  314. package/src/modules/pr/components/PrDiffPane.tsx +0 -425
  315. package/src/modules/pr/components/PrFileRow.tsx +0 -164
  316. package/src/modules/pr/components/PrFilesList.tsx +0 -53
  317. package/src/modules/pr/components/PrHeader.tsx +0 -45
  318. package/src/modules/pr/components/PrHeaderOverflowMenu.tsx +0 -58
  319. package/src/modules/pr/components/PrMergeButton.tsx +0 -268
  320. package/src/modules/pr/components/PrMergeConfirmDialog.tsx +0 -112
  321. package/src/modules/pr/components/PrRefreshFromTargetButton.tsx +0 -110
  322. package/src/modules/pr/components/PrViewer.tsx +0 -364
  323. package/src/modules/pr/hooks/usePrViewerState.ts +0 -150
  324. package/src/modules/pr/state/pr-viewer.context.ts +0 -34
  325. package/src/modules/pr/utils/bucketize-comments.ts +0 -55
  326. package/src/modules/pr/utils/parsePatch.ts +0 -57
  327. package/src/modules/toolbar/components/AdminMenu.tsx +0 -271
package/package.json CHANGED
@@ -1,18 +1,21 @@
1
1
  {
2
2
  "name": "@bevel-software/platform-core-frontend",
3
- "version": "0.4.1",
3
+ "version": "0.5.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",
7
7
  "types": "./src/index.ts",
8
8
  "exports": {
9
9
  ".": "./src/index.ts",
10
+ "./ui": "./src/shared/components/index.ts",
10
11
  "./index.css": "./src/index.css",
12
+ "./theme.css": "./src/shared/theme/index.css",
11
13
  "./src/*": "./src/*",
12
14
  "./package.json": "./package.json"
13
15
  },
14
16
  "files": [
15
- "src"
17
+ "src",
18
+ "THIRD-PARTY-NOTICES.md"
16
19
  ],
17
20
  "peerDependencies": {
18
21
  "react": "^19.0.0",
@@ -38,7 +41,7 @@
38
41
  "tailwind-merge": "^3.5.0",
39
42
  "xlsx": "^0.18.5",
40
43
  "yaml": "^2.9.0",
41
- "@bevel-software/platform-shared": "0.4.1"
44
+ "@bevel-software/platform-shared": "0.5.1"
42
45
  },
43
46
  "devDependencies": {
44
47
  "@testing-library/jest-dom": "^6.9.1",
@@ -57,7 +60,7 @@
57
60
  "license": "Apache-2.0",
58
61
  "repository": {
59
62
  "type": "git",
60
- "url": "git+https://github.com/Bevel-Software/skill-and-tool-management.git",
63
+ "url": "git+https://github.com/Bevel-Software/Hexis.git",
61
64
  "directory": "packages/core-frontend"
62
65
  },
63
66
  "publishConfig": {
@@ -11,20 +11,20 @@ import { BrowserRouter, Navigate, Routes, Route, useLocation } from 'react-route
11
11
  import { AuthContext } from '../modules/auth/state/auth.context';
12
12
  import { useAuthState } from '../modules/auth/hooks/useAuthState';
13
13
  import { LoginScreen } from '../modules/auth/components/LoginScreen';
14
+ import { SetupGate } from '../modules/setup/components/SetupGate';
14
15
  import { WorkspaceContext } from '../modules/workspace/state/workspace.context';
15
16
  import { useWorkspaceState } from '../modules/workspace/hooks/useWorkspaceState';
16
17
  import { GitContext } from '../modules/git/state/git.context';
17
18
  import { AutoUpdateContext } from '../modules/git/state/auto-update.context';
18
19
  import { useGitState } from '../modules/git/hooks/useGitState';
19
20
  import { useAutoPullUpdates } from '../modules/git/hooks/useAutoPullUpdates';
20
- import { PrViewerContext } from '../modules/pr/state/pr-viewer.context';
21
- import { usePrViewerState } from '../modules/pr/hooks/usePrViewerState';
22
21
  import { EventBusProvider } from '../modules/workflow/state/EventBusProvider';
23
22
  import { EventBusFocusBinder } from '../modules/workflow/state/EventBusFocusBinder';
24
23
  import { Toolbar } from '../modules/toolbar/components/Toolbar';
25
24
  import { DemoBanner } from '../modules/layout/components/DemoBanner';
26
25
  import { FileExplorer } from '../modules/workspace/components/FileExplorer';
27
26
  import { FileViewer } from '../modules/workspace/components/FileViewer';
27
+ import { OpenChangeRequestsProvider } from '../modules/workspace/state/open-change-requests';
28
28
  import { FileRoute } from '../modules/workspace/components/FileRoute';
29
29
  import { KB_ROUTE_PREFIX } from '../modules/workspace/routing/kb-routes';
30
30
  import { AppLayout } from '../modules/layout/components/AppLayout';
@@ -36,20 +36,26 @@ import {
36
36
  import { MaintenanceOverlay } from '../modules/layout/components/MaintenanceOverlay';
37
37
  import { AdminProvider } from '../modules/admin/state/admin.context';
38
38
  import { RolesCorruptedBanner } from '../modules/admin/components/RolesCorruptedBanner';
39
- import { ReviewProvider } from '../modules/review/state/ReviewProvider';
40
- import { ReviewPanelSurface } from '../modules/review/components/ReviewPanelSurface';
41
39
  import { ConnectToolsPage } from '../modules/secrets-vault/components/ConnectToolsPage';
40
+ import { SettingsLayout } from '../modules/settings/components/SettingsLayout';
41
+ import { DeploymentPage } from '../modules/settings/components/DeploymentPage';
42
42
  import { SecretsPage } from '../modules/secrets-vault/components/SecretsPage';
43
43
  import { AccountPage } from '../modules/auth/components/AccountPage';
44
44
  import { ExternalAgentAccessPage } from '../modules/toolbar/components/ExternalAgentAccessPage';
45
45
  import { AdminRolesPage } from '../modules/admin/components/AdminRolesPage';
46
46
  import { UserAccountsPage } from '../modules/admin/components/UserAccountsPage';
47
47
  import { ToolsExplorerPage } from '../modules/tools/ToolsExplorerPage';
48
- import { LibraryPage } from '../modules/library/components/LibraryPage';
48
+ import { LibraryRoutes } from '../modules/library/routes/LibraryRoutes';
49
+ import { RootLanding } from '../modules/onboarding/components/RootLanding';
50
+ import { ConnectAgentPill } from '../modules/onboarding/components/ConnectAgentPill';
49
51
  import { OpenChangeRequestDialog } from '../modules/pr/components/OpenChangeRequestDialog';
52
+ import { useMediaQuery } from '../modules/layout/hooks/useMediaQuery';
53
+ import { NARROW_QUERY } from '../modules/layout/breakpoints';
54
+ import { setSidebarCollapsed } from '../modules/layout/state/sidebar';
50
55
  import {
51
56
  activeAppId,
52
57
  ActiveAppIdContext,
58
+ AppClaimContext,
53
59
  AppRegistryContext,
54
60
  CrCreationPortContext,
55
61
  SuggestedPromptSeedContext,
@@ -61,15 +67,15 @@ import {
61
67
  type CrCreationPort,
62
68
  type PaneDef,
63
69
  } from './registry';
70
+ import { isLibraryLocation } from '../modules/library/routes/library-paths';
64
71
 
65
72
  /**
66
73
  * The registry-driven application shell for the core modules (workspace, git,
67
74
  * pr, access, auth, workflow/SSE, layout, secrets-vault, tools, toolbar,
68
- * library, review — the UI of the core diff backend — and the admin roles
69
- * page). Everything else — chat, connectors, routines, watchlist, voice,
70
- * embed, onboarding, admin LLM/feedback pages — is contributed through the
71
- * {@link AppRegistry} passed in (see `src/enterprise-registry.tsx` for the
72
- * current enterprise composition).
75
+ * library, and the admin roles page). Everything else — chat, connectors,
76
+ * routines, watchlist, voice, embed, onboarding, admin LLM/feedback pages —
77
+ * is contributed through the {@link AppRegistry} passed in (see
78
+ * `src/enterprise-registry.tsx` for the current enterprise composition).
73
79
  */
74
80
 
75
81
  /**
@@ -96,12 +102,19 @@ function AuthenticatedApp() {
96
102
  );
97
103
  }
98
104
 
105
+ /**
106
+ * The signed-in app: builds the workspace, git, auto-pull and PR-viewer state
107
+ * and provides all of it to everything below.
108
+ *
109
+ * Split out from `AuthenticatedApp` so this half runs INSIDE the event-bus
110
+ * provider — these hooks subscribe to bus events, which a sibling of the
111
+ * provider could not reach.
112
+ */
99
113
  function AuthenticatedAppInner() {
100
114
  const registry = useAppRegistry();
101
115
  const workspaceState = useWorkspaceState();
102
116
  const gitState = useGitState(workspaceState.workspaceId);
103
117
  const autoUpdateState = useAutoPullUpdates(gitState, workspaceState);
104
- const prViewerState = usePrViewerState();
105
118
 
106
119
  // Refresh git status whenever the user accepts/rejects pending content, since that
107
120
  // is the moment new bytes hit the working tree.
@@ -124,14 +137,18 @@ function AuthenticatedAppInner() {
124
137
  // Registry-provided wrappers (chat, onboarding-import, agent ports, …)
125
138
  // apply INSIDE the core providers below — so they can read workspace/git
126
139
  // state — but OUTSIDE the layout, so every pane (including registered ones)
127
- // sees them. `providers[0]` ends up outermost. ReviewProvider is CORE (the
128
- // UI of the core diff/pending-changes backend) and sits innermost — the
129
- // same slot it occupied when it was registry-provided.
140
+ // sees them. `providers[0]` ends up outermost.
141
+ //
142
+ // The review-agent-changes surface (ReviewProvider + ReviewPanelSurface,
143
+ // over the diff backend's backup ledger) is deliberately NOT mounted: its
144
+ // ledger cannot yet tell an agent's direct edit apart from a proposal the
145
+ // agent made through a change request, so the panel double-reported
146
+ // suggestions and its verbs collided with the CR review flow. The module
147
+ // stays in the tree for when that distinction exists — a registry can also
148
+ // re-mount it via `providers` + `fileViewerPanels`.
130
149
  const chrome = registry.providers.reduceRight<ReactNode>(
131
150
  (children, wrap) => wrap(children),
132
- <ReviewProvider>
133
- <AppChrome />
134
- </ReviewProvider>,
151
+ <AppChrome />,
135
152
  );
136
153
 
137
154
  return (
@@ -139,11 +156,9 @@ function AuthenticatedAppInner() {
139
156
  <EventBusFocusBinder />
140
157
  <GitContext.Provider value={gitState}>
141
158
  <AutoUpdateContext.Provider value={autoUpdateState}>
142
- <PrViewerContext.Provider value={prViewerState}>
143
- <AdminProvider>
144
- <CrCreationHost>{chrome}</CrCreationHost>
145
- </AdminProvider>
146
- </PrViewerContext.Provider>
159
+ <AdminProvider>
160
+ <CrCreationHost>{chrome}</CrCreationHost>
161
+ </AdminProvider>
147
162
  </AutoUpdateContext.Provider>
148
163
  </GitContext.Provider>
149
164
  </WorkspaceContext.Provider>
@@ -163,23 +178,19 @@ const CORE_BANNERS: BannerDef[] = [
163
178
  // hard-coded three-pane layout exactly. These are the KNOWLEDGE app's panes —
164
179
  // other apps render their own full surface (see CORE_APPS).
165
180
  const CORE_PANES: PaneDef[] = [
166
- {
167
- id: 'explorer',
168
- order: 10,
169
- node: <FileExplorer />,
170
- defaultSize: '17%',
171
- minSize: '10%',
172
- maxSize: '35%',
173
- collapsible: true,
174
- },
181
+ // The file tree is the SIDEBAR, not a panel — the same frame, at the same
182
+ // width, that Skills & Tools puts its group list in. It left the resizable
183
+ // group when the two navs were unified; `SidebarFrame` owns its width and
184
+ // the shared store owns whether it is showing.
185
+ { id: 'explorer', order: 10, node: <FileExplorer />, sidebar: true, collapsible: true },
175
186
  { id: 'viewer', order: 20, node: <ViewerRoutes />, minSize: '30%' },
176
187
  ];
177
188
 
178
189
  /**
179
190
  * The core apps behind the toolbar's app switcher. Each app is a full
180
- * surface below the always-mounted toolbar. "Skills & Tools" renders the
181
- * Library full-bleed for now and will move to the dedicated view when it
182
- * lands. Knowledge's path IS `KB_ROUTE_PREFIX` ('/workspace') — the KB file
191
+ * surface below the always-mounted toolbar. "Skills & Tools" mounts
192
+ * `LibraryRoutes`, which owns its own nested route table (gallery, groups,
193
+ * items) below this path. Knowledge's path IS `KB_ROUTE_PREFIX` ('/workspace') — the KB file
183
194
  * links `kbFileUrl()` produces are absolute `/workspace/<branch>/<path>`
184
195
  * URLs, so they land inside the Knowledge surface by construction.
185
196
  */
@@ -190,7 +201,7 @@ const CORE_APPS: AppDef[] = [
190
201
  path: KB_ROUTE_PREFIX,
191
202
  description: 'Browse and edit your knowledge base',
192
203
  order: 10,
193
- element: <KnowledgeSurface />,
204
+ element: <CoreSurfaces />,
194
205
  },
195
206
  {
196
207
  id: 'skills-tools',
@@ -198,10 +209,45 @@ const CORE_APPS: AppDef[] = [
198
209
  path: '/skills-and-tools',
199
210
  description: 'What your assistant can do, and what it connects to',
200
211
  order: 20,
201
- element: <LibraryPage />,
212
+ element: <CoreSurfaces />,
202
213
  },
203
214
  ];
204
215
 
216
+ /**
217
+ * BOTH core apps' route element — one component type at one route position,
218
+ * deliberately: React reconciles same-type elements across route matches, so
219
+ * crossing between `/skills-and-tools` and a canonical `/workspace` item URL
220
+ * keeps this component (and the library surface inside it) MOUNTED. A
221
+ * different element per app remounted the whole library on every skill click:
222
+ * the catalog refetched, the page flickered, and the sidebar was a second
223
+ * instance of itself.
224
+ *
225
+ * Which surface renders is decided by URL SHAPE (`isLibraryLocation`): the KB
226
+ * repo's two roots ARE the two apps — `KnowledgeBase/` paths get the pane
227
+ * workspace, default-branch `Groups/` paths get the library. The catalog is
228
+ * never consulted for the surface, so a just-created skill routes correctly
229
+ * before any reload. Router state `rawFile` steps past the shape rule to the
230
+ * raw file view (the tool page's "Edit the tool file"); it is state, not URL,
231
+ * so a shared link can never land there by accident.
232
+ *
233
+ * While the library renders under a `/workspace` URL it CLAIMS the Skills &
234
+ * Tools app (see {@link AppClaimContext}), so the switcher and the toolbar's
235
+ * sidebar toggle follow the surface on screen, not the URL prefix.
236
+ */
237
+ function CoreSurfaces() {
238
+ const location = useLocation();
239
+ const claim = useContext(AppClaimContext);
240
+ const rawRequested = (location.state as { rawFile?: boolean } | null)?.rawFile === true;
241
+ const library = !rawRequested && isLibraryLocation(location.pathname);
242
+ const claimsSkills = library && location.pathname.startsWith(KB_ROUTE_PREFIX);
243
+ useEffect(() => {
244
+ if (!claimsSkills) return;
245
+ claim('skills-tools');
246
+ return () => claim(null);
247
+ }, [claimsSkills, claim]);
248
+ return library ? <LibraryRoutes /> : <KnowledgeSurface />;
249
+ }
250
+
205
251
  /**
206
252
  * Setter through which the Knowledge surface's pane layout reports its
207
253
  * controller to AppChrome (whose LayoutContext provider wraps the toolbar).
@@ -221,12 +267,39 @@ function KnowledgeSurface() {
221
267
  ),
222
268
  [registry],
223
269
  );
224
- return <AppLayout panes={panes} onController={setController} />;
270
+ // Mounted here, once, because three separate subtrees ask the same question:
271
+ // the tree (per row), the tab strip (per tab) and the viewer's banner. A
272
+ // plain hook per consumer would give every tree row its own request.
273
+ return (
274
+ <OpenChangeRequestsProvider>
275
+ {/* The connect-your-agent reminder rides Knowledge's sidebar too, and
276
+ the shell is where that is decided: `layout` is the app's generic
277
+ consistency layer and must not name a domain component, so the pill
278
+ is passed IN from the composition root. The Library passes the same
279
+ one from `LibraryLayout` — one pill, both surfaces, so a person who
280
+ skipped the welcome page and stayed in Knowledge still sees it. */}
281
+ <AppLayout
282
+ panes={panes}
283
+ onController={setController}
284
+ sidebarHeader={<ConnectAgentPill />}
285
+ />
286
+ </OpenChangeRequestsProvider>
287
+ );
225
288
  }
226
289
 
227
- function AppChrome() {
290
+ /**
291
+ * Everything that frames the active app: the banner strip, the toolbar, and
292
+ * the surface the registry routes into.
293
+ *
294
+ * Exported for its tests rather than for composition — `ShellRoutes` is the
295
+ * only caller. It sits above the app surfaces because the toolbar does, and
296
+ * the toolbar has to outlive a route change to keep the nav toggle in one
297
+ * place across Knowledge and Skills & Tools.
298
+ */
299
+ export function AppChrome() {
228
300
  const registry = useAppRegistry();
229
301
  const location = useLocation();
302
+ const narrow = useMediaQuery(NARROW_QUERY);
230
303
  const banners = useMemo(
231
304
  () =>
232
305
  [...CORE_BANNERS, ...registry.banners].sort(
@@ -239,7 +312,16 @@ function AppChrome() {
239
312
  () => [...registry.apps].sort((a, b) => (a.order ?? 100) - (b.order ?? 100)),
240
313
  [registry],
241
314
  );
242
- const activeId = activeAppId(apps, location.pathname);
315
+ // A claimed app (a library item page at its canonical /workspace URL) wins
316
+ // over the prefix rule — the switcher highlights the surface on screen.
317
+ const [claimedApp, setClaimedApp] = useState<string | null>(null);
318
+ const activeId = claimedApp ?? activeAppId(apps, location.pathname);
319
+
320
+ // A narrow sidebar can be opened from the toolbar, but it must not cover
321
+ // the destination after the user chooses a group or file inside it.
322
+ useEffect(() => {
323
+ if (narrow) setSidebarCollapsed(true);
324
+ }, [location.pathname, narrow]);
243
325
 
244
326
  // Pane controller bridge: the toolbar sits OUTSIDE the active app's surface,
245
327
  // so the Knowledge pane layout reports its controller up here and the shell
@@ -250,11 +332,12 @@ function AppChrome() {
250
332
 
251
333
  return (
252
334
  <ActiveAppIdContext.Provider value={activeId}>
335
+ <AppClaimContext.Provider value={setClaimedApp}>
253
336
  <LayoutContext.Provider value={paneController ?? NO_PANES_LAYOUT}>
254
337
  <PaneControllerContext.Provider value={setPaneController}>
255
338
  {/* Flex-col wrapper so the (conditional) banner strip takes its own
256
339
  height and the toolbar + active surface flex into the rest. */}
257
- <div className="flex flex-col h-screen">
340
+ <div className="flex flex-col h-full">
258
341
  {banners.map((banner) => (
259
342
  <Fragment key={banner.id}>{banner.node}</Fragment>
260
343
  ))}
@@ -267,6 +350,7 @@ function AppChrome() {
267
350
  </div>
268
351
  </PaneControllerContext.Provider>
269
352
  </LayoutContext.Provider>
353
+ </AppClaimContext.Provider>
270
354
  </ActiveAppIdContext.Provider>
271
355
  );
272
356
  }
@@ -282,6 +366,16 @@ function AppChrome() {
282
366
  * no checkmark and the pane toggles hide via NO_PANES_LAYOUT). `/connect`
283
367
  * and `/secrets` are OAuth return targets: external redirects land on
284
368
  * these exact URLs, so they must stay routes with these exact paths.
369
+ *
370
+ * They now share a persistent nav via a PATHLESS `SettingsLayout` route,
371
+ * so moving between them no longer means re-opening the profile menu. They
372
+ * remain outside the app model — a settings page still claims no app, so
373
+ * the switcher shows no checkmark and the pane toggles stay hidden.
374
+ *
375
+ * Admin gating stays COMPONENT-level: both admin routes are deliberately
376
+ * reachable, so a non-admin who follows a link gets the explanatory
377
+ * "Admins only" page rather than a silent redirect to somewhere they did
378
+ * not ask for. The nav merely declines to advertise the rows.
285
379
  * - Redirects: `/` → `/workspace`, and a final catch-all for anything
286
380
  * unknown (including the retired `/library` path).
287
381
  *
@@ -298,14 +392,47 @@ export function ShellRoutes({ apps }: { apps: AppDef[] }) {
298
392
  element={app.element}
299
393
  />
300
394
  ))}
395
+ {/* OUTSIDE the settings layout, deliberately. `/connect` is a flow page,
396
+ not a settings destination: it has no row in the profile menu, it is
397
+ an OAuth landing target, and in its agent-connect mode somebody else
398
+ is blocked waiting on a Finish button. Do not "complete the set". */}
301
399
  <Route path="/connect" element={<ConnectToolsPage />} />
302
- <Route path="/secrets" element={<SecretsPage />} />
303
- <Route path="/account" element={<AccountPage />} />
304
- <Route path="/external-agent-access" element={<ExternalAgentAccessPage />} />
305
- <Route path="/roles-and-members" element={<AdminRolesPage />} />
306
- <Route path="/user-accounts" element={<UserAccountsPage />} />
307
- <Route path="/tools" element={<ToolsExplorerPage />} />
308
- <Route path="/" element={<Navigate to={KB_ROUTE_PREFIX} replace />} />
400
+ {/* A PATHLESS layout route: the child paths below stay byte-identical,
401
+ which is what keeps `/secrets` the exact URL external OAuth redirects
402
+ land on. Its only job is to keep the settings nav mounted across
403
+ them. */}
404
+ <Route element={<SettingsLayout />}>
405
+ <Route path="/secrets" element={<SecretsPage />} />
406
+ <Route path="/account" element={<AccountPage />} />
407
+ <Route path="/external-agent-access" element={<ExternalAgentAccessPage />} />
408
+ <Route path="/roles-and-members" element={<AdminRolesPage />} />
409
+ <Route path="/deployment" element={<DeploymentPage />} />
410
+ <Route path="/user-accounts" element={<UserAccountsPage />} />
411
+ <Route path="/tools" element={<ToolsExplorerPage />} />
412
+ </Route>
413
+ {/* `/` consults the onboarding: a brand-new account's FIRST visit lands
414
+ on the welcome page, everyone else (and every later visit) goes to
415
+ Knowledge as always.
416
+
417
+ `/auth/*` lands the same way, and that is not decoration. The SSO
418
+ callback scrubs its own URL with a RAW `history.replaceState`
419
+ (`microsoft-oauth.ts`), which BrowserRouter never observes — react
420
+ -router only re-reads location on its own navigations and on
421
+ popstate. So after a Microsoft sign-in the address bar says `/`
422
+ while the router still matches `/auth/microsoft/callback`. Before
423
+ this feature that was invisible, because `/` and `*` both redirected
424
+ to Knowledge; the moment they differ, the first SSO sign-in — the
425
+ exact case onboarding exists for — would fall through the catch-all
426
+ and never be greeted. Routing the callback path here fixes it
427
+ without moving the token-scrub out of the service that owns it.
428
+
429
+ The `*` catch-all stays a plain redirect: a mistyped URL is not a
430
+ reason to be onboarded.
431
+
432
+ OUTSIDE the settings layout, like `/connect` above: these are landing
433
+ and redirect targets, not settings destinations. */}
434
+ <Route path="/" element={<RootLanding />} />
435
+ <Route path="/auth/*" element={<RootLanding />} />
309
436
  <Route path="*" element={<Navigate to={KB_ROUTE_PREFIX} replace />} />
310
437
  </Routes>
311
438
  );
@@ -384,7 +511,7 @@ export function AuthGate({ children }: { children: ReactNode }) {
384
511
  return (
385
512
  <AuthContext.Provider value={auth}>
386
513
  {auth.isLoading ? (
387
- <div className="flex items-center justify-center h-full bg-white text-slate-600 text-sm">
514
+ <div className="flex items-center justify-center h-full bg-white text-ink-muted text-sm">
388
515
  Loading…
389
516
  </div>
390
517
  ) : auth.user ? (
@@ -396,27 +523,39 @@ export function AuthGate({ children }: { children: ReactNode }) {
396
523
  );
397
524
  }
398
525
 
526
+ /**
527
+ * The auth boundary. Nothing below it mounts until there is a session, so no
528
+ * downstream provider has to carry a "signed out" case.
529
+ */
399
530
  function AppShell() {
400
531
  return (
401
532
  <AuthGate>
402
- <AuthenticatedApp />
533
+ {/* Inside the auth gate, outside everything else: setup asks for a
534
+ repository URL and an access token, so it is not public — and the
535
+ surfaces behind it all read from a workspace that cannot exist until
536
+ it is finished. */}
537
+ <SetupGate>
538
+ <AuthenticatedApp />
539
+ </SetupGate>
403
540
  </AuthGate>
404
541
  );
405
542
  }
406
543
 
544
+ /**
545
+ * The package's entry point: hand it a registry and it is the whole app.
546
+ *
547
+ * Core contributions merge AHEAD of registry-contributed ones, so a downstream
548
+ * build adds to the app rather than reordering what core already put there.
549
+ */
407
550
  export function CoreAppShell({ registry }: { registry: AppRegistry }) {
408
- // Core contributions merge ahead of registry-contributed ones: the review
409
- // file-viewer panel (core — it renders the pending-changes session served
410
- // by the core diff backend at /api/workspace/:id/review*) and the core
551
+ // Core contributions merge ahead of registry-contributed ones: the core
411
552
  // apps (Knowledge + Skills & Tools) that the switcher and AppChrome read.
553
+ // The review file-viewer panel is no longer registered here — see the note
554
+ // on `chrome` above.
412
555
  const mergedRegistry = useMemo<AppRegistry>(
413
556
  () => ({
414
557
  ...registry,
415
558
  apps: [...CORE_APPS, ...registry.apps],
416
- fileViewerPanels: [
417
- { id: 'review', Component: ReviewPanelSurface },
418
- ...registry.fileViewerPanels.filter((p) => p.id !== 'review'),
419
- ],
420
559
  }),
421
560
  [registry],
422
561
  );
@@ -0,0 +1,125 @@
1
+ import { fireEvent, render, screen } from '@testing-library/react';
2
+ import { beforeEach, describe, expect, it, vi } from 'vitest';
3
+ import { MemoryRouter, useNavigate } from 'react-router-dom';
4
+ import { AppChrome } from '../CoreAppShell';
5
+ import { AppRegistryContext, makeRegistry, type AppDef } from '../registry';
6
+ import {
7
+ setSidebarCollapsed,
8
+ setSidebarNarrow,
9
+ toggleSidebar,
10
+ useSidebar,
11
+ } from '../../modules/layout/state/sidebar';
12
+
13
+ vi.mock('../../modules/toolbar/components/Toolbar', () => ({
14
+ Toolbar: () => null,
15
+ }));
16
+ vi.mock('../../modules/layout/components/DemoBanner', () => ({
17
+ DemoBanner: () => null,
18
+ }));
19
+ vi.mock('../../modules/admin/components/RolesCorruptedBanner', () => ({
20
+ RolesCorruptedBanner: () => null,
21
+ }));
22
+
23
+ /**
24
+ * A stand-in app surface carrying the two gestures these tests need — the
25
+ * toolbar's nav toggle and a navigation — plus the sidebar's collapsed state
26
+ * as an assertable `<output>`. Registered under two routes so "navigate"
27
+ * genuinely changes the path rather than re-rendering the same one.
28
+ */
29
+ function RouteHarness({ destination }: { destination: string }) {
30
+ const navigate = useNavigate();
31
+ const { collapsed } = useSidebar();
32
+ return (
33
+ <>
34
+ <output aria-label="sidebar state">{collapsed ? 'collapsed' : 'expanded'}</output>
35
+ <button type="button" onClick={toggleSidebar}>
36
+ Toggle sidebar
37
+ </button>
38
+ <button type="button" onClick={() => navigate(destination)}>
39
+ Navigate
40
+ </button>
41
+ </>
42
+ );
43
+ }
44
+
45
+ const apps: AppDef[] = [
46
+ {
47
+ id: 'first',
48
+ label: 'First',
49
+ path: '/first',
50
+ element: <RouteHarness destination="/second" />,
51
+ },
52
+ {
53
+ id: 'second',
54
+ label: 'Second',
55
+ path: '/second',
56
+ element: <RouteHarness destination="/first" />,
57
+ },
58
+ ];
59
+
60
+ /**
61
+ * Cross the narrow breakpoint. happy-dom answers `matchMedia` out of
62
+ * `innerWidth`, so moving the viewport is how a test reaches the drawer
63
+ * layout — there is no CSS engine here to do it for us.
64
+ */
65
+ function setViewportWidth(width: number): void {
66
+ const testWindow = window as typeof window & {
67
+ happyDOM: { setInnerWidth(value: number): void };
68
+ };
69
+ testWindow.happyDOM.setInnerWidth(width);
70
+ }
71
+
72
+ /**
73
+ * Mount the chrome at a given viewport width. The width is set BEFORE render
74
+ * so the first render already sees the breakpoint, matching a real page load
75
+ * on a phone rather than a desktop mount that later resizes.
76
+ */
77
+ function renderChrome(width: number) {
78
+ setViewportWidth(width);
79
+ return render(
80
+ <MemoryRouter initialEntries={['/first']}>
81
+ <AppRegistryContext.Provider value={makeRegistry({ apps })}>
82
+ <AppChrome />
83
+ </AppRegistryContext.Provider>
84
+ </MemoryRouter>,
85
+ );
86
+ }
87
+
88
+ beforeEach(() => {
89
+ setViewportWidth(1400);
90
+ // Module state: clear the breakpoint the previous test settled on so this
91
+ // mount reads as a fresh crossing rather than a no-op.
92
+ setSidebarNarrow(false);
93
+ setSidebarCollapsed(false);
94
+ });
95
+
96
+ describe('AppChrome: narrow navigation', () => {
97
+ it('closes a manually opened sidebar after a narrow-screen navigation', () => {
98
+ renderChrome(375);
99
+ expect(screen.getByRole('status', { name: 'sidebar state' })).toHaveTextContent(
100
+ 'collapsed',
101
+ );
102
+
103
+ fireEvent.click(screen.getByRole('button', { name: 'Toggle sidebar' }));
104
+ expect(screen.getByRole('status', { name: 'sidebar state' })).toHaveTextContent(
105
+ 'expanded',
106
+ );
107
+
108
+ fireEvent.click(screen.getByRole('button', { name: 'Navigate' }));
109
+ expect(screen.getByRole('status', { name: 'sidebar state' })).toHaveTextContent(
110
+ 'collapsed',
111
+ );
112
+ });
113
+
114
+ it('does not change sidebar state after a wide-screen navigation', () => {
115
+ renderChrome(1400);
116
+ expect(screen.getByRole('status', { name: 'sidebar state' })).toHaveTextContent(
117
+ 'expanded',
118
+ );
119
+
120
+ fireEvent.click(screen.getByRole('button', { name: 'Navigate' }));
121
+ expect(screen.getByRole('status', { name: 'sidebar state' })).toHaveTextContent(
122
+ 'expanded',
123
+ );
124
+ });
125
+ });
@@ -1,12 +1,15 @@
1
1
  import { describe, it, expect, vi } from 'vitest';
2
- import { render, screen } from '@testing-library/react';
2
+ import { render, screen, within } from '@testing-library/react';
3
3
  import { MemoryRouter, useLocation } from 'react-router-dom';
4
4
  import { ShellRoutes } from '../CoreAppShell';
5
5
  import type { AppDef } from '../registry';
6
6
 
7
7
  // The /secrets standalone page fetches on mount — stub its data layer so the
8
8
  // route can render without a network. (The other standalone pages are not
9
- // visited by these tests.)
9
+ // visited by these tests. Any future test that visits /account, /tools,
10
+ // /user-accounts or /roles-and-members needs that page's data layer mocked
11
+ // here too — they all now share the SettingsLayout route, but each still
12
+ // fetches its own.)
10
13
  vi.mock('../../modules/secrets-vault/services/secrets.api', () => ({
11
14
  listSecrets: vi.fn(async () => []),
12
15
  createOAuthSecret: vi.fn(async () => {}),
@@ -86,10 +89,42 @@ describe('ShellRoutes', () => {
86
89
  expect(screen.getByTestId('skills-surface')).toBeInTheDocument();
87
90
  });
88
91
 
92
+ it('keeps a tool deep link inside the Skills & Tools surface', () => {
93
+ // The app owns everything under `/skills-and-tools/*`, so its nested
94
+ // routes (the tool page, the group pages) must not fall into the shell's
95
+ // catch-all on a cold load or a refresh.
96
+ renderAt('/skills-and-tools/tools/heyreach');
97
+ expect(screen.getByTestId('pathname')).toHaveTextContent(
98
+ /^\/skills-and-tools\/tools\/heyreach$/,
99
+ );
100
+ expect(screen.getByTestId('skills-surface')).toBeInTheDocument();
101
+ });
102
+
89
103
  it('renders the standalone Secrets page at /secrets without redirecting', async () => {
90
104
  renderAt('/secrets');
91
105
  expect(screen.getByTestId('pathname')).toHaveTextContent(/^\/secrets$/);
92
106
  expect(await screen.findByRole('heading', { name: 'Secrets' })).toBeInTheDocument();
93
107
  expect(screen.queryByTestId('knowledge-surface')).not.toBeInTheDocument();
94
108
  });
109
+
110
+ // The pathless SettingsLayout wraps the settings routes only. Both cases
111
+ // below deliberately need NO providers: the layout reads AdminContext
112
+ // directly rather than through useAdmin(), which would throw here.
113
+ it('keeps the settings nav on screen at /secrets', async () => {
114
+ renderAt('/secrets');
115
+ const nav = await screen.findByRole('navigation', { name: 'Settings' });
116
+ expect(within(nav).getByRole('link', { name: 'Secrets' })).toHaveAttribute(
117
+ 'aria-current',
118
+ 'page',
119
+ );
120
+ });
121
+
122
+ // Guards the one-sidebar invariant where it is actually enforced — the route
123
+ // table. Settings and the app surfaces are exclusive siblings, so they can
124
+ // never both mount a frame carrying the same DOM id.
125
+ it('does not wrap an app surface in the settings layout', () => {
126
+ renderAt('/workspace/main');
127
+ expect(screen.queryByRole('navigation', { name: 'Settings' })).toBeNull();
128
+ expect(screen.getByTestId('knowledge-surface')).toBeInTheDocument();
129
+ });
95
130
  });