@bevel-software/platform-core-frontend 0.4.0 → 0.5.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 (326) hide show
  1. package/package.json +5 -3
  2. package/src/core/CoreAppShell.tsx +195 -56
  3. package/src/core/__tests__/AppChrome.test.tsx +125 -0
  4. package/src/core/__tests__/ShellRoutes.test.tsx +130 -95
  5. package/src/core/__tests__/bootstrap.test.ts +63 -0
  6. package/src/core/bootstrap.ts +73 -0
  7. package/src/core/events.ts +12 -0
  8. package/src/core/registry.ts +58 -9
  9. package/src/index.css +100 -11
  10. package/src/index.ts +24 -23
  11. package/src/lib/utils.ts +114 -138
  12. package/src/modules/access/__tests__/ManageAccessDialog.placement.test.tsx +281 -0
  13. package/src/modules/access/__tests__/ManageAccessDialog.test.tsx +166 -1
  14. package/src/modules/access/api.ts +49 -0
  15. package/src/modules/access/components/ManageAccessDialog.tsx +786 -481
  16. package/src/modules/access/hooks/useFileAccess.ts +1 -1
  17. package/src/modules/admin/__tests__/AdminRolesPage.suggest.test.tsx +86 -0
  18. package/src/modules/admin/__tests__/UserAccountsPage.test.tsx +172 -156
  19. package/src/modules/admin/__tests__/admin.unread.test.tsx +61 -0
  20. package/src/modules/admin/components/AdminRolesPage.tsx +44 -38
  21. package/src/modules/admin/components/RolesCorruptedBanner.tsx +11 -10
  22. package/src/modules/admin/components/UserAccountsPage.tsx +361 -353
  23. package/src/modules/admin/state/admin.context.tsx +15 -6
  24. package/src/modules/auth/components/AccountPage.tsx +11 -11
  25. package/src/modules/auth/components/LoginScreen.tsx +12 -12
  26. package/src/modules/auth/services/sso.ts +47 -1
  27. package/src/modules/change-requests/__tests__/ChangeRequestDialog.test.tsx +277 -0
  28. package/src/modules/change-requests/__tests__/author.test.ts +48 -0
  29. package/src/modules/change-requests/__tests__/conflict.test.ts +73 -0
  30. package/src/modules/change-requests/__tests__/diff.test.ts +134 -0
  31. package/src/modules/change-requests/__tests__/propose.test.ts +93 -0
  32. package/src/modules/change-requests/__tests__/useFileOnBranch.test.tsx +72 -0
  33. package/src/modules/change-requests/change-requests.css +22 -0
  34. package/src/modules/change-requests/components/ChangeBox.tsx +277 -0
  35. package/src/modules/change-requests/components/ChangeRequestDialog.tsx +713 -0
  36. package/src/modules/change-requests/components/ConflictHelp.tsx +47 -0
  37. package/src/modules/change-requests/components/CrFileTree.tsx +398 -0
  38. package/src/modules/change-requests/components/FileChangeBoxes.tsx +168 -0
  39. package/src/modules/change-requests/hooks/useApplyChangeRequest.ts +236 -0
  40. package/src/modules/change-requests/hooks/useCrFileDiffs.ts +79 -0
  41. package/src/modules/change-requests/hooks/useFileOnBranch.ts +80 -0
  42. package/src/modules/change-requests/services/change-requests.api.ts +45 -0
  43. package/src/modules/change-requests/services/propose.api.ts +162 -0
  44. package/src/modules/change-requests/utils/author.ts +47 -0
  45. package/src/modules/change-requests/utils/conflict.ts +38 -0
  46. package/src/modules/change-requests/utils/diff.ts +80 -0
  47. package/src/modules/git/__tests__/BranchSwitcher.test.tsx +27 -18
  48. package/src/modules/git/__tests__/FileHistoryPanel.test.tsx +36 -83
  49. package/src/modules/git/__tests__/PullNeededBanner.test.tsx +5 -5
  50. package/src/modules/git/__tests__/PullRequestsForMe.test.tsx +147 -0
  51. package/src/modules/git/__tests__/useAutoPullUpdates.test.tsx +2 -8
  52. package/src/modules/git/components/BranchSwitcher.tsx +68 -31
  53. package/src/modules/git/components/DiffView.tsx +4 -4
  54. package/src/modules/git/components/FileComparisonPanel.tsx +20 -20
  55. package/src/modules/git/components/FileHistoryPanel.tsx +71 -107
  56. package/src/modules/git/components/PullNeededBanner.tsx +6 -13
  57. package/src/modules/git/components/PullRequestsForMe.tsx +71 -36
  58. package/src/modules/git/components/UnifiedDiffView.tsx +4 -4
  59. package/src/modules/git/hooks/__tests__/useGitState.deleteBranch.test.tsx +2 -2
  60. package/src/modules/git/hooks/useGitState.ts +15 -14
  61. package/src/modules/git/services/__tests__/error-messages.test.ts +4 -4
  62. package/src/modules/git/services/error-messages.ts +7 -7
  63. package/src/modules/git/services/git.api.ts +17 -11
  64. package/src/modules/git/services/pr-prompts.ts +2 -2
  65. package/src/modules/git/state/git.context.ts +10 -1
  66. package/src/modules/layout/__tests__/SidebarFrameResponsive.test.tsx +224 -0
  67. package/src/modules/layout/__tests__/SidebarToggle.test.tsx +242 -0
  68. package/src/modules/layout/__tests__/breakpoints.test.ts +56 -0
  69. package/src/modules/layout/breakpoints.ts +6 -0
  70. package/src/modules/layout/components/AppLayout.tsx +17 -5
  71. package/src/modules/layout/components/DemoBanner.tsx +10 -1
  72. package/src/modules/layout/components/MaintenanceOverlay.tsx +104 -104
  73. package/src/modules/layout/components/MobileChatLayout.tsx +31 -26
  74. package/src/modules/layout/components/ResizableThreePaneLayout.tsx +59 -24
  75. package/src/modules/layout/components/SidebarFrame.tsx +317 -0
  76. package/src/modules/layout/components/SidebarToggle.tsx +86 -0
  77. package/src/modules/layout/components/SlideOverlay.tsx +1 -1
  78. package/src/modules/layout/components/__tests__/MobileChatLayout.test.tsx +40 -2
  79. package/src/modules/layout/components/__tests__/ResizableThreePaneLayout.test.tsx +19 -3
  80. package/src/modules/layout/state/sidebar.ts +200 -0
  81. package/src/modules/library/__tests__/AddToGroupDialog.test.tsx +313 -0
  82. package/src/modules/library/__tests__/ChangeRequestDock.test.tsx +84 -0
  83. package/src/modules/library/__tests__/GroupJoinRequests.test.tsx +178 -0
  84. package/src/modules/library/__tests__/GroupPage.test.tsx +479 -0
  85. package/src/modules/library/__tests__/GroupsIndexPage.test.tsx +283 -0
  86. package/src/modules/library/__tests__/GroupsSidebar.contextmenu.test.tsx +175 -0
  87. package/src/modules/library/__tests__/GroupsSidebar.locked.test.tsx +96 -0
  88. package/src/modules/library/__tests__/GroupsSidebar.test.tsx +142 -0
  89. package/src/modules/library/__tests__/GroupsSidebarMenu.test.tsx +142 -0
  90. package/src/modules/library/__tests__/LibraryCard.test.tsx +149 -0
  91. package/src/modules/library/__tests__/LibraryRoutes.test.tsx +378 -0
  92. package/src/modules/library/__tests__/LibrarySidebarMenu.test.tsx +347 -0
  93. package/src/modules/library/__tests__/LockedGroupView.test.tsx +203 -0
  94. package/src/modules/library/__tests__/NewGroupDialog.test.tsx +114 -0
  95. package/src/modules/library/__tests__/PersonalAddDialog.test.tsx +177 -0
  96. package/src/modules/library/__tests__/SkillPage.test.tsx +1063 -0
  97. package/src/modules/library/__tests__/ToolConnectionSection.test.tsx +259 -0
  98. package/src/modules/library/__tests__/ToolLogo.test.tsx +63 -0
  99. package/src/modules/library/__tests__/ToolPage.test.tsx +315 -0
  100. package/src/modules/library/__tests__/ToolSharePanel.test.tsx +36 -0
  101. package/src/modules/library/__tests__/ToolVarRow.test.tsx +260 -0
  102. package/src/modules/library/__tests__/WorkspaceItemRoute.test.tsx +197 -0
  103. package/src/modules/library/__tests__/auth-harness.tsx +37 -0
  104. package/src/modules/library/__tests__/oauth-fragment.test.ts +48 -0
  105. package/src/modules/library/__tests__/status.test.ts +210 -117
  106. package/src/modules/library/__tests__/useSkillDetail.test.tsx +102 -0
  107. package/src/modules/library/__tests__/useToolPage.test.tsx +146 -0
  108. package/src/modules/library/components/AccessRequestsBanner.tsx +101 -0
  109. package/src/modules/library/components/AddToGroupDialog.tsx +115 -0
  110. package/src/modules/library/components/ChangeRequestDock.tsx +71 -47
  111. package/src/modules/library/components/DeleteGroupDialog.tsx +87 -0
  112. package/src/modules/library/components/GroupIndexRow.tsx +63 -0
  113. package/src/modules/library/components/GroupJoinRequests.tsx +56 -0
  114. package/src/modules/library/components/GroupPage.tsx +373 -0
  115. package/src/modules/library/components/GroupsIndexPage.tsx +222 -0
  116. package/src/modules/library/components/GroupsSidebar.tsx +338 -0
  117. package/src/modules/library/components/GroupsSidebarMenu.tsx +160 -0
  118. package/src/modules/library/components/LibraryCard.tsx +153 -132
  119. package/src/modules/library/components/LibraryLayout.tsx +344 -0
  120. package/src/modules/library/components/LibraryPage.tsx +138 -254
  121. package/src/modules/library/components/LockGlyph.tsx +31 -0
  122. package/src/modules/library/components/LockedGroupView.tsx +159 -0
  123. package/src/modules/library/components/ManagedGroupRequests.tsx +70 -0
  124. package/src/modules/library/components/NewGroupDialog.tsx +112 -0
  125. package/src/modules/library/components/NewSkillPanel.tsx +151 -0
  126. package/src/modules/library/components/PageActions.tsx +156 -0
  127. package/src/modules/library/components/PendingSkillReview.tsx +63 -0
  128. package/src/modules/library/components/PersonalAddDialog.tsx +88 -0
  129. package/src/modules/library/components/PersonalGroupPage.tsx +125 -0
  130. package/src/modules/library/components/StatusDot.tsx +25 -0
  131. package/src/modules/library/components/ToolLogo.tsx +171 -0
  132. package/src/modules/library/components/group-page-parts.tsx +419 -0
  133. package/src/modules/library/components/skill-page/SkillFileEditor.tsx +134 -0
  134. package/src/modules/library/components/skill-page/SkillFilePane.tsx +117 -0
  135. package/src/modules/library/components/skill-page/SkillFileTabs.tsx +112 -0
  136. package/src/modules/library/components/skill-page/SkillPage.tsx +673 -0
  137. package/src/modules/library/components/skill-page/tab-ids.ts +33 -0
  138. package/src/modules/library/components/tool-page/ToolConnectionSection.tsx +175 -0
  139. package/src/modules/library/components/tool-page/ToolPage.tsx +228 -0
  140. package/src/modules/library/components/tool-page/ToolSharePanel.tsx +45 -0
  141. package/src/modules/library/components/tool-page/ToolVarRow.tsx +289 -0
  142. package/src/modules/library/hooks/useJoinRequests.ts +114 -0
  143. package/src/modules/library/hooks/useLibraryData.ts +134 -119
  144. package/src/modules/library/hooks/useSkillDetail.ts +119 -74
  145. package/src/modules/library/hooks/useToolPage.ts +145 -0
  146. package/src/modules/library/library.css +108 -320
  147. package/src/modules/library/routes/LibraryRoutes.tsx +134 -0
  148. package/src/modules/library/routes/WorkspaceItemRoute.tsx +74 -0
  149. package/src/modules/library/routes/library-paths.ts +191 -0
  150. package/src/modules/library/services/groups.api.ts +189 -0
  151. package/src/modules/library/services/library.api.ts +291 -164
  152. package/src/modules/library/services/tools.api.ts +60 -0
  153. package/src/modules/library/state/library-context.ts +22 -0
  154. package/src/modules/library/state/library-data.tsx +223 -0
  155. package/src/modules/library/state/toast.context.ts +32 -0
  156. package/src/modules/library/state/toast.tsx +84 -42
  157. package/src/modules/library/utils/clipboard.ts +33 -0
  158. package/src/modules/library/utils/group-summary.ts +68 -0
  159. package/src/modules/library/utils/names.ts +30 -0
  160. package/src/modules/library/utils/navigate-external.ts +15 -0
  161. package/src/modules/library/utils/oauth-fragment.ts +32 -0
  162. package/src/modules/library/utils/personal-group.ts +36 -0
  163. package/src/modules/library/utils/status.ts +199 -116
  164. package/src/modules/library/utils/toast-duration.ts +16 -0
  165. package/src/modules/onboarding/__tests__/onboarding.test.tsx +533 -0
  166. package/src/modules/onboarding/agent-clients.ts +48 -0
  167. package/src/modules/onboarding/components/ConnectAgentPill.tsx +133 -0
  168. package/src/modules/onboarding/components/RootLanding.tsx +54 -0
  169. package/src/modules/onboarding/components/WelcomePage.tsx +364 -0
  170. package/src/modules/onboarding/paths.ts +9 -0
  171. package/src/modules/onboarding/state/onboarding.ts +191 -0
  172. package/src/modules/pr/components/OpenChangeRequestDialog.tsx +10 -10
  173. package/src/modules/pr/services/pr-approvals.api.ts +19 -0
  174. package/src/modules/pr/services/pr-cancel.api.ts +11 -0
  175. package/src/modules/review/components/BinaryChangePlaceholder.tsx +3 -3
  176. package/src/modules/review/components/DiffViewer.tsx +4 -4
  177. package/src/modules/review/components/MarkdownDiffViewer.tsx +84 -26
  178. package/src/modules/review/components/ReviewFileRow.tsx +10 -10
  179. package/src/modules/review/components/ReviewPanel.tsx +49 -17
  180. package/src/modules/review/components/ReviewPanelSurface.tsx +1 -1
  181. package/src/modules/review/components/__tests__/MarkdownDiffViewer.test.tsx +122 -0
  182. package/src/modules/review/hooks/__tests__/useReviewState.test.ts +1 -1
  183. package/src/modules/secrets-vault/components/ConnectToolsPage.tsx +273 -171
  184. package/src/modules/secrets-vault/components/SecretsPage.tsx +313 -276
  185. package/src/modules/secrets-vault/components/ToolSecretsPanel.tsx +109 -92
  186. package/src/modules/secrets-vault/components/__tests__/SecretsPage.test.tsx +82 -51
  187. package/src/modules/secrets-vault/services/connect.api.ts +24 -3
  188. package/src/modules/settings/components/DeploymentPage.tsx +90 -0
  189. package/src/modules/settings/components/SettingsLayout.tsx +135 -0
  190. package/src/modules/settings/components/SettingsNav.tsx +114 -0
  191. package/src/modules/settings/components/__tests__/DeploymentPage.test.tsx +110 -0
  192. package/src/modules/settings/components/__tests__/SettingsLayout.test.tsx +249 -0
  193. package/src/modules/settings/settings-nav-items.tsx +166 -0
  194. package/src/modules/setup/__tests__/setup.test.tsx +540 -0
  195. package/src/modules/setup/components/SetupGate.tsx +67 -0
  196. package/src/modules/setup/components/SetupScreen.tsx +573 -0
  197. package/src/modules/setup/services/setup.api.ts +106 -0
  198. package/src/modules/setup/utils/git-host.ts +34 -0
  199. package/src/modules/toolbar/components/AppSwitcher.tsx +131 -108
  200. package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +548 -548
  201. package/src/modules/toolbar/components/ProfileMenu.tsx +294 -0
  202. package/src/modules/toolbar/components/Toolbar.tsx +56 -54
  203. package/src/modules/toolbar/components/__tests__/AppSwitcher.test.tsx +176 -122
  204. package/src/modules/toolbar/components/__tests__/Toolbar.test.tsx +252 -77
  205. package/src/modules/tools/ToolsExplorerPage.tsx +45 -40
  206. package/src/modules/workspace/__tests__/design-system-parity.test.ts +133 -0
  207. package/src/modules/workspace/__tests__/testFixtures.ts +2 -0
  208. package/src/modules/workspace/components/EditorTabs.tsx +82 -50
  209. package/src/modules/workspace/components/FileExplorer.tsx +1292 -1068
  210. package/src/modules/workspace/components/FilePaneCard.tsx +53 -0
  211. package/src/modules/workspace/components/FileRoute.tsx +89 -84
  212. package/src/modules/workspace/components/FileViewer.tsx +1312 -906
  213. package/src/modules/workspace/components/KbDocumentShell.tsx +138 -0
  214. package/src/modules/workspace/components/KbFileRail.tsx +128 -0
  215. package/src/modules/workspace/components/KbPageHeader.tsx +390 -0
  216. package/src/modules/workspace/components/__tests__/EditorTabs.test.tsx +87 -3
  217. package/src/modules/workspace/components/__tests__/FileExplorer.test.tsx +293 -39
  218. package/src/modules/workspace/components/__tests__/FileRoute.test.tsx +1 -16
  219. package/src/modules/workspace/components/__tests__/FileViewer.test.tsx +462 -44
  220. package/src/modules/workspace/components/__tests__/KbDocumentShell.test.tsx +84 -0
  221. package/src/modules/workspace/components/__tests__/KbFileRail.test.tsx +83 -0
  222. package/src/modules/workspace/components/__tests__/KbPageHeader.test.tsx +192 -0
  223. package/src/modules/workspace/components/renderers/CopyAnchorButton.tsx +64 -0
  224. package/src/modules/workspace/components/renderers/CsvRenderer.tsx +8 -8
  225. package/src/modules/workspace/components/renderers/DocxRenderer.tsx +18 -9
  226. package/src/modules/workspace/components/renderers/HtmlRenderer.tsx +14 -14
  227. package/src/modules/workspace/components/renderers/ImageRenderer.tsx +2 -2
  228. package/src/modules/workspace/components/renderers/KbMarkdownView.tsx +31 -165
  229. package/src/modules/workspace/components/renderers/MarkdownRenderer.tsx +18 -5
  230. package/src/modules/workspace/components/renderers/MermaidDiagram.tsx +27 -10
  231. package/src/modules/workspace/components/renderers/PdfRenderer.tsx +2 -2
  232. package/src/modules/workspace/components/renderers/TextRenderer.tsx +11 -5
  233. package/src/modules/workspace/components/renderers/ToolForm.tsx +24 -24
  234. package/src/modules/workspace/components/renderers/ToolRenderer.tsx +27 -27
  235. package/src/modules/workspace/components/renderers/XlsxRenderer.tsx +11 -11
  236. package/src/modules/workspace/components/renderers/__tests__/DocxRenderer.test.tsx +66 -0
  237. package/src/modules/workspace/components/renderers/__tests__/KbMarkdownView.test.tsx +17 -1
  238. package/src/modules/workspace/components/renderers/__tests__/MarkdownRenderer.test.tsx +1 -1
  239. package/src/modules/workspace/components/renderers/__tests__/MermaidDiagram.test.tsx +58 -0
  240. package/src/modules/workspace/components/renderers/__tests__/lazyRenderer.test.tsx +68 -0
  241. package/src/modules/workspace/components/renderers/__tests__/rendererLayout.test.ts +64 -0
  242. package/src/modules/workspace/components/renderers/__tests__/sanitizeDocxHtml.test.ts +0 -0
  243. package/src/modules/workspace/components/renderers/chunk-boundary.tsx +71 -0
  244. package/src/modules/workspace/components/renderers/index.ts +78 -2
  245. package/src/modules/workspace/components/renderers/kbMarkdownPipeline.tsx +241 -0
  246. package/src/modules/workspace/components/renderers/lazyRenderer.tsx +59 -0
  247. package/src/modules/workspace/components/renderers/sanitizeDocxHtml.ts +91 -0
  248. package/src/modules/workspace/hooks/__tests__/useLinksOut.test.ts +59 -0
  249. package/src/modules/workspace/hooks/__tests__/useOpenChangeRequests.test.tsx +237 -0
  250. package/src/modules/workspace/hooks/__tests__/useWorkspaceState.test.tsx +185 -0
  251. package/src/modules/workspace/hooks/useAutoGrowTextarea.ts +30 -0
  252. package/src/modules/workspace/hooks/useLastCommit.ts +66 -0
  253. package/src/modules/workspace/hooks/useLinksOut.ts +56 -0
  254. package/src/modules/workspace/hooks/useOpenChangeRequests.ts +20 -0
  255. package/src/modules/workspace/hooks/useWorkspaceState.ts +123 -14
  256. package/src/modules/workspace/routing/__tests__/kb-routes.test.tsx +1 -1
  257. package/src/modules/workspace/services/workspace.api.ts +9 -2
  258. package/src/modules/workspace/state/open-change-requests.context.ts +35 -0
  259. package/src/modules/workspace/state/open-change-requests.tsx +185 -0
  260. package/src/modules/workspace/state/workspace.context.ts +9 -0
  261. package/src/modules/workspace/utils/__tests__/diff.test.ts +87 -0
  262. package/src/modules/workspace/utils/diff.ts +130 -53
  263. package/src/modules/workspace/utils/fileTree.ts +182 -179
  264. package/src/modules/workspace/workspace.css +28 -0
  265. package/src/shared/components/Badge.tsx +62 -0
  266. package/src/shared/components/Banner.tsx +58 -0
  267. package/src/shared/components/Button.tsx +90 -0
  268. package/src/shared/components/Dialog.tsx +6 -6
  269. package/src/shared/components/Field.tsx +45 -0
  270. package/src/shared/components/IconButton.tsx +74 -0
  271. package/src/shared/components/ListRow.tsx +96 -0
  272. package/src/shared/components/Menu.tsx +88 -0
  273. package/src/shared/components/PageShell.tsx +54 -51
  274. package/src/shared/components/Surface.tsx +86 -0
  275. package/src/shared/components/__tests__/primitives.test.tsx +333 -0
  276. package/src/shared/components/index.ts +48 -0
  277. package/src/shared/components/useDismissableMenu.ts +71 -0
  278. package/src/shared/theme/__tests__/accent-contrast.test.ts +84 -0
  279. package/src/shared/theme/index.css +12 -0
  280. package/src/shared/theme/measure.ts +64 -0
  281. package/src/shared/theme/shadows.css +34 -0
  282. package/src/shared/theme/tokens.css +193 -0
  283. package/src/test-setup.ts +9 -0
  284. package/src/modules/access/components/AccessRestrictedBanner.tsx +0 -31
  285. package/src/modules/access/components/NodeOwnersBanner.tsx +0 -30
  286. package/src/modules/git/__tests__/ProtectedBranchBanner.test.tsx +0 -82
  287. package/src/modules/git/components/ProtectedBranchBanner.tsx +0 -42
  288. package/src/modules/library/__tests__/DetailDialog.test.tsx +0 -200
  289. package/src/modules/library/__tests__/diff.test.ts +0 -62
  290. package/src/modules/library/__tests__/loadout.test.tsx +0 -72
  291. package/src/modules/library/components/CompareView.tsx +0 -357
  292. package/src/modules/library/components/DetailDialog.tsx +0 -566
  293. package/src/modules/library/components/GearIcon.tsx +0 -12
  294. package/src/modules/library/components/LoadoutSidebar.tsx +0 -156
  295. package/src/modules/library/components/StatusGem.tsx +0 -21
  296. package/src/modules/library/components/SuggestChange.tsx +0 -171
  297. package/src/modules/library/components/particles.ts +0 -50
  298. package/src/modules/library/state/loadout.tsx +0 -129
  299. package/src/modules/library/utils/diff.ts +0 -102
  300. package/src/modules/pr/__tests__/PrApprovalBadge.test.tsx +0 -93
  301. package/src/modules/pr/__tests__/PrCancelButton.test.tsx +0 -158
  302. package/src/modules/pr/__tests__/PrCancelConfirmDialog.test.tsx +0 -44
  303. package/src/modules/pr/__tests__/PrMergeButton.test.tsx +0 -360
  304. package/src/modules/pr/__tests__/bucketize-comments.test.ts +0 -85
  305. package/src/modules/pr/__tests__/parsePatch.test.ts +0 -104
  306. package/src/modules/pr/__tests__/usePrViewerState.test.ts +0 -72
  307. package/src/modules/pr/components/PrApprovalBadge.tsx +0 -80
  308. package/src/modules/pr/components/PrCancelButton.tsx +0 -99
  309. package/src/modules/pr/components/PrCancelConfirmDialog.tsx +0 -119
  310. package/src/modules/pr/components/PrCommentComposer.tsx +0 -92
  311. package/src/modules/pr/components/PrCommentThread.tsx +0 -168
  312. package/src/modules/pr/components/PrCommentsPanel.tsx +0 -143
  313. package/src/modules/pr/components/PrDiffPane.tsx +0 -425
  314. package/src/modules/pr/components/PrFileRow.tsx +0 -164
  315. package/src/modules/pr/components/PrFilesList.tsx +0 -53
  316. package/src/modules/pr/components/PrHeader.tsx +0 -45
  317. package/src/modules/pr/components/PrHeaderOverflowMenu.tsx +0 -58
  318. package/src/modules/pr/components/PrMergeButton.tsx +0 -268
  319. package/src/modules/pr/components/PrMergeConfirmDialog.tsx +0 -112
  320. package/src/modules/pr/components/PrRefreshFromTargetButton.tsx +0 -110
  321. package/src/modules/pr/components/PrViewer.tsx +0 -364
  322. package/src/modules/pr/hooks/usePrViewerState.ts +0 -150
  323. package/src/modules/pr/state/pr-viewer.context.ts +0 -34
  324. package/src/modules/pr/utils/bucketize-comments.ts +0 -55
  325. package/src/modules/pr/utils/parsePatch.ts +0 -57
  326. package/src/modules/toolbar/components/AdminMenu.tsx +0 -271
@@ -0,0 +1,133 @@
1
+ import { useState } from 'react';
2
+ import { useInRouterContext, useLocation, useNavigate } from 'react-router-dom';
3
+ import { X } from 'lucide-react';
4
+ import { cn } from '../../../lib/utils';
5
+ import { useLibraryToast } from '../../library/state/toast.context';
6
+ import { useOnboarding } from '../state/onboarding';
7
+ import { WELCOME_PATH } from '../paths';
8
+
9
+ /**
10
+ * The connect-your-agent reminder — a CTA wearing a nav row's geometry, at
11
+ * the top of the Library sidebar (prototype `.navnudge`).
12
+ *
13
+ * It is the sidebar's ONLY filled accent, which is what makes it a clear
14
+ * call to action, and it stays — across sign-ins, across browsers, because
15
+ * `users.onboarding_done` is a server fact — until exactly two things: the ×
16
+ * or the welcome page's Done. Once either happens the sidebar has no blue in
17
+ * it at all.
18
+ *
19
+ * While you are ON the welcome page it wears the selected state and goes
20
+ * QUIET: held at the hover depth, ring and dot still. A CTA stops calling
21
+ * once you are standing where it points.
22
+ *
23
+ * Dismiss is its OWN button, never the row — clicking "connect" must not be
24
+ * able to mean "never show me this again". One server field backs both
25
+ * endings, so the × concludes the onboarding exactly as Done does; its label
26
+ * says so rather than promising a "later" that will never be offered, and it
27
+ * confirms out loud, because a control that removes itself owes you a word
28
+ * about what just happened.
29
+ */
30
+ export function ConnectAgentPill() {
31
+ // This is passed into `SidebarFrame`'s `header` slot — by `LibraryLayout`
32
+ // for Skills & Tools, by `CoreAppShell` for Knowledge — so the frame itself
33
+ // stays domain-agnostic and never names the onboarding.
34
+ //
35
+ // The guard stays anyway, defensively: `useNavigate`/`useLocation` THROW
36
+ // outside a Router, and a slot can be filled from anywhere, including a
37
+ // future consumer or a test that renders bare. It lives here, in a
38
+ // component whose only job is to decide, with the hooks one level down
39
+ // where a Router is guaranteed. No router, no reminder: the pill's whole
40
+ // purpose is to take you somewhere.
41
+ if (!useInRouterContext()) return null;
42
+ return <RoutedConnectAgentPill />;
43
+ }
44
+
45
+ function RoutedConnectAgentPill() {
46
+ const onboarding = useOnboarding();
47
+ const navigate = useNavigate();
48
+ const toast = useLibraryToast();
49
+ const { pathname } = useLocation();
50
+ const [announcement, setAnnouncement] = useState('');
51
+ const selected = pathname === WELCOME_PATH;
52
+
53
+ /**
54
+ * The × — the same one-way server write as the welcome page's Done, not a
55
+ * "remind me later" this app never implements. It ends the reminder
56
+ * everywhere the account signs in, so it is worth the acknowledgement below.
57
+ */
58
+ function dismiss() {
59
+ onboarding.markDone();
60
+ const said =
61
+ 'Reminder dismissed: the setup lives in your profile menu, under External agent access.';
62
+ // Said twice, on purpose, because the pill is about to unmount from under
63
+ // the pointer AND from under keyboard focus. The toast is the visible
64
+ // receipt but only exists inside the Library's provider; the live region
65
+ // below is this component's own, survives the pill's removal, and is what
66
+ // keeps the confirmation from going silent on Knowledge.
67
+ toast(said);
68
+ setAnnouncement(said);
69
+ }
70
+
71
+ // The live region is OUTSIDE the `showPill` guard so it is still mounted at
72
+ // the moment the pill disappears — a region that unmounts in the same commit
73
+ // as the thing it is announcing announces nothing.
74
+ if (!onboarding.showPill) {
75
+ return (
76
+ <span role="status" aria-live="polite" className="sr-only">
77
+ {announcement}
78
+ </span>
79
+ );
80
+ }
81
+
82
+ return (
83
+ <div
84
+ className={cn(
85
+ 'group/pill mb-1.5 flex flex-none items-center rounded-full transition-colors',
86
+ selected
87
+ ? 'bg-accent/15'
88
+ : 'bg-accent/8 hover:bg-accent/15 motion-safe:animate-onboarding-pulse-slow',
89
+ )}
90
+ >
91
+ <button
92
+ type="button"
93
+ // `page`, not `true`: this control navigates, so the value that means
94
+ // "this is the page you are on" is the one screen readers announce as
95
+ // such.
96
+ aria-current={selected ? 'page' : undefined}
97
+ title="Connect Claude, ChatGPT, Cursor or another agent"
98
+ onClick={() => navigate(WELCOME_PATH)}
99
+ className="flex min-w-0 flex-1 items-center gap-2 rounded-full py-1.5 pl-3 pr-1 text-left text-ui font-medium text-accent"
100
+ >
101
+ <span
102
+ aria-hidden
103
+ className={cn(
104
+ 'size-1.5 flex-none rounded-full bg-accent',
105
+ !selected && 'motion-safe:animate-onboarding-blink',
106
+ )}
107
+ />
108
+ <span className="truncate">Connect your agent</span>
109
+ </button>
110
+ <button
111
+ type="button"
112
+ aria-label="Dismiss: the setup stays in your profile menu, under External agent access"
113
+ title="Dismiss"
114
+ onClick={dismiss}
115
+ className={cn(
116
+ 'mr-1.5 flex size-[18px] flex-none items-center justify-center rounded-full text-ink-faint',
117
+ // `pointer-events-none` is the whole point of pairing it with
118
+ // opacity-0: an invisible-but-tappable 18px target that performs an
119
+ // IRREVERSIBLE server write is a trap on any device without hover.
120
+ // Touch users get it via the pill's own long-press/hover emulation
121
+ // — or never, which is the safe failure.
122
+ 'pointer-events-none opacity-0 transition-[opacity,background-color,color]',
123
+ 'hover:bg-accent/15 hover:text-ink',
124
+ 'focus-visible:pointer-events-auto focus-visible:opacity-100',
125
+ 'group-hover/pill:pointer-events-auto group-hover/pill:opacity-100',
126
+ 'group-focus-within/pill:pointer-events-auto group-focus-within/pill:opacity-100',
127
+ )}
128
+ >
129
+ <X size={11} aria-hidden />
130
+ </button>
131
+ </div>
132
+ );
133
+ }
@@ -0,0 +1,54 @@
1
+ import { useEffect, useState } from 'react';
2
+ import { Navigate } from 'react-router-dom';
3
+ import { KB_ROUTE_PREFIX } from '../../workspace/routing/kb-routes';
4
+ import { takePostLoginRedirect } from '../../auth/services/sso';
5
+ import { useOnboarding } from '../state/onboarding';
6
+ import { WELCOME_PATH } from '../paths';
7
+
8
+ /**
9
+ * Where `/` lands. For everyone, forever: Knowledge — except the ONE visit
10
+ * where an account is brand new (`users.onboarding_done` false, and never
11
+ * greeted in this browser), which lands on the welcome page instead.
12
+ *
13
+ * Deliberately only the root route: a deep link is an intention, and
14
+ * onboarding must never hijack one. Whoever skips the welcome is reminded by
15
+ * the sidebar pill, not by the router.
16
+ *
17
+ * A deep link that came through SSO arrives HERE rather than at itself — the
18
+ * OAuth round-trip returns to a fixed callback URL, which scrubs to `/`
19
+ * (see `consumeSsoCallback`) — so the link's intention survives as the stash
20
+ * `startSsoLogin` left behind. An existing account goes straight to it; a
21
+ * brand-new one is still greeted first, and the welcome page's Done returns
22
+ * to the link instead of the usual shelf (the `returnTo` state below).
23
+ *
24
+ * `useOnboarding` is provider-tolerant, so `ShellRoutes` stays renderable
25
+ * without the full stack (its own documented property); providerless or
26
+ * signed out this is exactly the old `<Navigate to={KB_ROUTE_PREFIX}>`.
27
+ *
28
+ * The redirect carries `greeting`, and it is the ONLY navigation that does:
29
+ * arriving here because you just signed in is a different event from opening
30
+ * the same page from the sidebar, and the page needs to tell them apart to
31
+ * know whether it is a ceremony or a page. See `WelcomePage`.
32
+ */
33
+ export function RootLanding() {
34
+ const { shouldWelcome } = useOnboarding();
35
+ const [stash, setStash] = useState<{ returnTo: string | null } | null>(null);
36
+
37
+ // Taken in an effect, not a state initializer: the take CLEARS the stash,
38
+ // and StrictMode double-invokes initializers — the second invocation would
39
+ // read the empty slot and win. The effect's second run reads null too, but
40
+ // only the run that found something writes.
41
+ useEffect(() => {
42
+ const returnTo = takePostLoginRedirect();
43
+ setStash((s) => s ?? { returnTo });
44
+ }, []);
45
+
46
+ // One settle-frame while the stash is read — navigating first and correcting
47
+ // after would put the wrong page in the history.
48
+ if (stash === null) return null;
49
+
50
+ if (shouldWelcome) {
51
+ return <Navigate to={WELCOME_PATH} state={{ greeting: true, returnTo: stash.returnTo }} replace />;
52
+ }
53
+ return <Navigate to={stash.returnTo ?? KB_ROUTE_PREFIX} replace />;
54
+ }
@@ -0,0 +1,364 @@
1
+ import { useEffect, useLayoutEffect, useRef, useState } from 'react';
2
+ import { useLocation, useNavigate } from 'react-router-dom';
3
+ import { Check, Copy, X } from 'lucide-react';
4
+ import { cn } from '../../../lib/utils';
5
+ import { Button, IconButton } from '../../../shared/components';
6
+ import { useAuth } from '../../auth/state/auth.context';
7
+ import { useLibraryToast } from '../../library/state/toast.context';
8
+ import { copyToClipboard, COPY_FAILED_TOAST } from '../../library/utils/clipboard';
9
+ import { pathForLibraryFilter } from '../../library/routes/library-paths';
10
+ import { displayFirstName } from '../../library/utils/personal-group';
11
+ import { setSidebarCollapsed } from '../../layout/state/sidebar';
12
+ import { AGENT_CLIENTS, mcpUrlFromOrigin, type AgentClient } from '../agent-clients';
13
+ import { useOnboarding } from '../state/onboarding';
14
+
15
+ /**
16
+ * The welcome page — the first thing a new account sees, once.
17
+ *
18
+ * Three beats and nothing else (prototype `renderWelcome`): your name (so the
19
+ * page is addressed, not broadcast), one sentence of what this place is, and
20
+ * the single action the account still needs. It arrives in two movements —
21
+ * the greeting, then everything else — and the client picker re-renders in
22
+ * place, so neither ever replays as blinking.
23
+ *
24
+ * Mounting marks `welcomed`: the auto-redirect here happens on the FIRST
25
+ * sign-in only. The page itself stays reachable forever — the sidebar pill
26
+ * and a typed URL both land here — but the app never drags anyone back.
27
+ *
28
+ * "Done" concludes; it does not copy. A button whose word and act disagree
29
+ * teaches people not to read buttons — the copy lives ON the snippet block,
30
+ * and "Go to your skills →" is the honest exit for someone who leaves
31
+ * without connecting (it ends the redirect, never the pill).
32
+ */
33
+ export function WelcomePage() {
34
+ const { user } = useAuth();
35
+ const onboarding = useOnboarding();
36
+ const toast = useLibraryToast();
37
+ const navigate = useNavigate();
38
+ const [clientId, setClientId] = useState<AgentClient['id']>('claude');
39
+ const [copied, setCopied] = useState<'idle' | 'ok' | 'fail'>('idle');
40
+
41
+ // Once, on arrival — this is what makes the welcome redirect one-time.
42
+ const { markWelcomed } = onboarding;
43
+ useEffect(() => {
44
+ markWelcomed();
45
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- identity changes per render (bound closure); the act is idempotent per account
46
+ }, []);
47
+
48
+ /**
49
+ * How you got here. The automatic redirect at first sign-in is the ONE
50
+ * navigation that sets it (see `RootLanding`); the sidebar pill and a typed
51
+ * URL do not. Everything ceremonial on this page hangs off this flag.
52
+ */
53
+ const routeState = useLocation().state as { greeting?: boolean; returnTo?: string | null } | null;
54
+ const greeting = routeState?.greeting === true;
55
+ /**
56
+ * Where the person was actually GOING when the sign-in interrupted them — a
57
+ * deep link that survived the SSO round-trip (see `RootLanding`). Present
58
+ * only on the greeting arrival, and it retargets both exits: a welcome that
59
+ * concluded by discarding the page someone was sent is a greeting that cost
60
+ * them the reason they came.
61
+ */
62
+ const returnTo = greeting ? (routeState?.returnTo ?? null) : null;
63
+
64
+ /**
65
+ * The entrance — and it belongs to the greeting alone.
66
+ *
67
+ * Being welcomed happens once. Opening the same page later from the pill is
68
+ * a visit, and a 2.6s arrival every time you check your MCP snippet is a
69
+ * page you learn to dread. So anyone who did not arrive by the sign-in
70
+ * redirect starts ENTERED: no hold, no fade, the page simply exists.
71
+ *
72
+ * When it DOES play, it waits for a frame the browser actually paints. A CSS
73
+ * animation runs on the document timeline, which advances in wall clock time
74
+ * whether or not frames are being produced. This page mounts at the end of a
75
+ * cold boot — the auth round trip, the router, the library shell — and if the
76
+ * main thread is still busy when React inserts this DOM, the whole 2.2s can
77
+ * elapse before the first paint. The animation does not look fast, it is
78
+ * simply over by the time anyone sees it, and the page "just appears". No
79
+ * timing value can be tuned out of that; the animation has to START on a
80
+ * live frame.
81
+ *
82
+ * Two frames, not one: the first proves the browser is rendering again, the
83
+ * second is the one the animation begins on. Until then the content is held
84
+ * invisible, so the first painted state is the animation's own first state
85
+ * rather than a flash of the finished page.
86
+ *
87
+ * Reduced motion also starts entered — the `motion-safe:` animations are
88
+ * inert for them anyway, so a hold would be a blank page and nothing else.
89
+ * `matchMedia` is optional-chained because jsdom has none.
90
+ */
91
+ const [entered, setEntered] = useState(
92
+ () => !greeting || (window.matchMedia?.('(prefers-reduced-motion: reduce)').matches ?? false),
93
+ );
94
+ useEffect(() => {
95
+ if (entered) return;
96
+ let inner = 0;
97
+ const outer = requestAnimationFrame(() => {
98
+ inner = requestAnimationFrame(() => setEntered(true));
99
+ });
100
+ return () => {
101
+ cancelAnimationFrame(outer);
102
+ cancelAnimationFrame(inner);
103
+ };
104
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- an arrival-time decision, settled at mount
105
+ }, []);
106
+ /**
107
+ * An INLINE STYLE, not a `motion-safe:opacity-0` utility — and the reason is
108
+ * scar tissue. Tailwind scans this package through a node_modules symlink
109
+ * (`apps/web/src/index.css`), and a class first written mid-session is not
110
+ * always compiled, so the hold silently did nothing and the page painted
111
+ * fully formed. An entrance animation must not be hostage to whether the
112
+ * stylesheet noticed a new class name.
113
+ */
114
+ const hold = entered ? undefined : ({ opacity: 0 } as const);
115
+ /**
116
+ * The animation classes go on ONLY for the greeting. `entered` alone is not
117
+ * enough: a pill visit starts entered, so carrying the class would replay
118
+ * the whole arrival on a page somebody deliberately navigated to.
119
+ */
120
+ const arriving = greeting && entered;
121
+
122
+ /**
123
+ * The nav gets out of the way for the greeting — and STAYS out.
124
+ *
125
+ * There is no restore, and that is the decision rather than an omission.
126
+ * Putting it back on the way out meant Done handed you a page you did not
127
+ * ask to have rearranged: you left a screen with no nav and arrived at one
128
+ * where the nav had opened itself. Whether the sidebar is showing is a thing
129
+ * you say with the toolbar toggle, and after the greeting it says whatever
130
+ * it said last — collapsed, unless you opened it yourself while you were
131
+ * here, in which case it stays open and this code never touches it again.
132
+ *
133
+ * Only for the greeting, so opening this page from the pill later never
134
+ * rearranges the window around a page you deliberately navigated to.
135
+ *
136
+ * A LAYOUT effect, and that is the whole difference between "the nav is not
137
+ * here" and "the nav flinched". `useEffect` runs after the browser paints,
138
+ * so the first frame showed a full sidebar and the second began folding it
139
+ * away — a flash of a thing you were never meant to see. Layout effects run
140
+ * before paint: React re-renders synchronously, and the sidebar's width is
141
+ * already zero in the only frame that is ever drawn. `instant` covers the
142
+ * rest: there is nothing to transition from, and nobody gestured at it.
143
+ *
144
+ * The layout and this page mount in the same commit (`LibraryRoutes` — the
145
+ * welcome route is a child of `LibraryLayout`, and neither is lazy), which
146
+ * is what makes "before paint" mean before the sidebar's first paint too.
147
+ */
148
+ useLayoutEffect(() => {
149
+ if (!greeting) return;
150
+ setSidebarCollapsed(true, true);
151
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- an arrival-time decision: how you got here cannot change while you are here
152
+ }, []);
153
+
154
+ const client = AGENT_CLIENTS.find((c) => c.id === clientId) ?? AGENT_CLIENTS[0]!;
155
+ const snippet = client.snip(mcpUrlFromOrigin(window.location.origin));
156
+ // Capitalized by the same function that spells the group heading — "Welcome,
157
+ // juan" over a sidebar reading "Juan's Group" is the app misspelling someone
158
+ // to their face on the one page addressed to them.
159
+ const firstName = displayFirstName(user?.name) || 'there';
160
+
161
+ const radios = useRef<(HTMLButtonElement | null)[]>([]);
162
+
163
+ /**
164
+ * Arrow keys move the choice, because `role="radiogroup"` promised they
165
+ * would. The role is not decoration — it tells a screen reader "these are
166
+ * exclusive, one is always on", and the same standard that defines it also
167
+ * defines how it is driven: arrows select, Tab leaves. Claiming the role
168
+ * while only answering clicks describes a control the keyboard cannot work.
169
+ *
170
+ * Selection FOLLOWS focus, which is the pattern's default for a group this
171
+ * cheap to change — picking a client re-renders one snippet, nothing is
172
+ * submitted, so there is no cost to arriving on an option and no reason to
173
+ * make people confirm. Wraps at both ends: three options in a row have no
174
+ * meaningful edge to stop at.
175
+ *
176
+ * Paired with the roving `tabIndex` below — one stop for the whole group,
177
+ * not one per option, so Tab moves past the picker rather than through it.
178
+ */
179
+ function onRadioKeyDown(event: React.KeyboardEvent, index: number) {
180
+ const step =
181
+ event.key === 'ArrowRight' || event.key === 'ArrowDown'
182
+ ? 1
183
+ : event.key === 'ArrowLeft' || event.key === 'ArrowUp'
184
+ ? -1
185
+ : 0;
186
+ if (step === 0) return;
187
+ event.preventDefault();
188
+ const next = (index + step + AGENT_CLIENTS.length) % AGENT_CLIENTS.length;
189
+ setClientId(AGENT_CLIENTS[next]!.id);
190
+ radios.current[next]?.focus();
191
+ }
192
+
193
+ // One timer, cleared before it is replaced: a second copy inside the 1.5s
194
+ // window would otherwise inherit the FIRST copy's expiry and blank the
195
+ // checkmark almost immediately.
196
+ const resetTimer = useRef<number | undefined>(undefined);
197
+ useEffect(() => () => window.clearTimeout(resetTimer.current), []);
198
+
199
+ /**
200
+ * Copy the snippet currently on screen, and say so — as a checkmark for
201
+ * anyone watching and as a live-region announcement for anyone not. A
202
+ * failure is reported, never swallowed: the toast names the alternative
203
+ * (select the text) instead of leaving a button that silently did nothing.
204
+ */
205
+ async function copySnippet() {
206
+ const ok = await copyToClipboard(snippet);
207
+ if (!ok) toast(COPY_FAILED_TOAST, 'danger');
208
+ window.clearTimeout(resetTimer.current);
209
+ // Back to idle FIRST, so a repeat copy is a real state change and the
210
+ // live region announces it again — setting 'ok' over 'ok' is a no-op that
211
+ // says nothing to a screen reader.
212
+ setCopied('idle');
213
+ window.setTimeout(() => setCopied(ok ? 'ok' : 'fail'), 0);
214
+ resetTimer.current = window.setTimeout(() => setCopied('idle'), 1500);
215
+ }
216
+
217
+ // Both exits land in the same place — the person's own group. Whether you
218
+ // connected an agent or walked past it, where you want to be next is your
219
+ // own shelf, not the whole company's catalog. Unless a deep link brought
220
+ // them here: then both exits keep its promise instead.
221
+ const yourGroup = pathForLibraryFilter({ kind: 'ungrouped' });
222
+ const exitTo = returnTo ?? yourGroup;
223
+
224
+ /**
225
+ * Conclude the onboarding and leave. The toast says where the setup went,
226
+ * because a page that disappears for good on one click owes you the way
227
+ * back — and the pill is about to vanish with it.
228
+ */
229
+ function done() {
230
+ onboarding.markDone();
231
+ toast('Done. Reopen the setup any time from your profile menu → External agent access.');
232
+ navigate(exitTo);
233
+ }
234
+
235
+ return (
236
+ /* Two beats, not one. The greeting arrives on its own and is allowed to be
237
+ read; the rest of the page follows once it has landed. A single fade over
238
+ everything made the name and the setup instructions one event, and the
239
+ name is the point of the page. Both timings live in `index.css` — see
240
+ the note there on why they are named rather than arbitrary values.
241
+
242
+ On the ELEMENTS rather than the page, because the page re-renders every
243
+ time the client picker changes: a CSS animation on a surviving element
244
+ does not restart, so the beats play once, on arrival, and switching
245
+ between Claude and Cursor never reads as blinking. `motion-safe:` means
246
+ `prefers-reduced-motion` gets both beats at once, immediately — `both`
247
+ fill is what keeps them visible when the animation never runs. */
248
+ <div className="mx-auto mt-[11vh] max-w-[440px]">
249
+ <h1
250
+ className={cn(
251
+ 'text-display font-bold',
252
+ arriving && 'motion-safe:animate-onboarding-greeting',
253
+ )}
254
+ style={hold}
255
+ >
256
+ Welcome, {firstName}
257
+ </h1>
258
+ <div className={cn(arriving && 'motion-safe:animate-onboarding-body')} style={hold}>
259
+ <p className="mt-3 text-lede text-ink-muted">
260
+ This is your company’s shared library of the skills, tools and knowledge your AI
261
+ agents work from. Connect your agent once and access the skills and tools you need in
262
+ one place.
263
+ </p>
264
+
265
+ <div className="mt-9 text-label uppercase text-ink-faint">Connect your agent</div>
266
+
267
+ {/* One snippet, chosen, instead of three printed at once: which client
268
+ you use is a decision made before this page existed, so it is a
269
+ control rather than something to scroll past.
270
+
271
+ A radiogroup, not three `aria-pressed` toggles: these are mutually
272
+ exclusive and one is always chosen, which is what `radio` means and
273
+ what `pressed` does not — three independent toggles tell a screen
274
+ reader that any combination, including none, is possible. */}
275
+ <div
276
+ role="radiogroup"
277
+ aria-label="Your agent"
278
+ className="mt-2.5 flex gap-0.5 rounded-lg bg-sunken p-0.5"
279
+ >
280
+ {AGENT_CLIENTS.map((c, i) => (
281
+ <button
282
+ key={c.id}
283
+ type="button"
284
+ role="radio"
285
+ aria-checked={c.id === client.id}
286
+ // Roving: only the chosen option is a tab stop, so the group
287
+ // costs ONE Tab rather than one per client.
288
+ tabIndex={c.id === client.id ? 0 : -1}
289
+ ref={(el) => {
290
+ radios.current[i] = el;
291
+ }}
292
+ onKeyDown={(e) => onRadioKeyDown(e, i)}
293
+ onClick={() => setClientId(c.id)}
294
+ className={cn(
295
+ 'flex-1 whitespace-nowrap rounded-md px-2 py-1.5 text-detail transition-colors',
296
+ c.id === client.id
297
+ ? 'bg-surface font-semibold text-ink shadow-card'
298
+ : 'text-ink-muted hover:text-ink',
299
+ )}
300
+ >
301
+ {c.label}
302
+ </button>
303
+ ))}
304
+ </div>
305
+
306
+ <p className="mt-2.5 text-meta leading-normal text-ink-faint">{client.hint}</p>
307
+
308
+ {/* The copy rides the block it copies. */}
309
+ <div className="relative mt-3.5">
310
+ <div
311
+ className={cn(
312
+ 'overflow-x-auto rounded-lg border border-line bg-sunken py-2.5 pl-3 pr-10',
313
+ 'font-mono text-detail text-ink',
314
+ snippet.includes('\n') ? 'whitespace-pre' : 'whitespace-nowrap',
315
+ )}
316
+ >
317
+ {snippet}
318
+ </div>
319
+ <IconButton
320
+ size={24}
321
+ aria-label="Copy"
322
+ title="Copy"
323
+ onClick={() => void copySnippet()}
324
+ className="absolute right-2 top-2"
325
+ >
326
+ {copied === 'ok' ? (
327
+ <Check size={13} className="text-ok" />
328
+ ) : copied === 'fail' ? (
329
+ <X size={13} className="text-danger" />
330
+ ) : (
331
+ <Copy size={13} />
332
+ )}
333
+ </IconButton>
334
+ {/* The icon's answer, said out loud for anyone not watching it. */}
335
+ <span role="status" aria-live="polite" className="sr-only">
336
+ {copied === 'ok' ? 'Copied' : copied === 'fail' ? 'Copy failed' : ''}
337
+ </span>
338
+ </div>
339
+
340
+ <div className="mt-5 flex items-center gap-4">
341
+ <Button
342
+ variant="primary"
343
+ onClick={done}
344
+ className="motion-safe:animate-onboarding-pulse"
345
+ >
346
+ Done
347
+ </Button>
348
+ {/* The same destination Done goes to — one value drives both exits,
349
+ so they cannot drift apart. Ordinarily that is your own shelf
350
+ ("your skills" over "your library": the library is the whole
351
+ company's); when a deep link brought you here, both exits keep
352
+ its promise instead, and the label says so. */}
353
+ <button
354
+ type="button"
355
+ onClick={() => navigate(exitTo)}
356
+ className="text-detail text-ink-faint transition-colors hover:text-ink"
357
+ >
358
+ {returnTo ? 'Continue to your link →' : 'Go to your skills →'}
359
+ </button>
360
+ </div>
361
+ </div>
362
+ </div>
363
+ );
364
+ }
@@ -0,0 +1,9 @@
1
+ import { LIBRARY_ROOT } from '../library/routes/library-paths';
2
+
3
+ /**
4
+ * The welcome page lives INSIDE the Library surface (it renders in
5
+ * `LibraryLayout`, so the sidebar — and the pill's selected state — are on
6
+ * screen with it). One constant, three consumers: the route, the pill, the
7
+ * root redirect.
8
+ */
9
+ export const WELCOME_PATH = `${LIBRARY_ROOT}/welcome`;