@bevel-software/platform-core-frontend 0.15.1 → 0.20.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 (347) hide show
  1. package/THIRD-PARTY-NOTICES.md +2 -2
  2. package/package.json +3 -3
  3. package/src/core/CoreAppShell.tsx +20 -9
  4. package/src/core/__tests__/AppChrome.test.tsx +0 -3
  5. package/src/core/__tests__/events.test.ts +43 -0
  6. package/src/core/bootstrap.ts +11 -3
  7. package/src/core/events.ts +85 -3
  8. package/src/core/registry.ts +1 -1
  9. package/src/lib/__tests__/email.test.ts +44 -0
  10. package/src/lib/email.ts +37 -1
  11. package/src/modules/access/__tests__/ManageAccessDialog.add-row-picking.test.tsx +141 -0
  12. package/src/modules/access/__tests__/ManageAccessDialog.chip-truncation.test.tsx +204 -0
  13. package/src/modules/access/__tests__/ManageAccessDialog.download-read.test.tsx +234 -0
  14. package/src/modules/access/__tests__/ManageAccessDialog.edited-row-visible.test.tsx +160 -0
  15. package/src/modules/access/__tests__/ManageAccessDialog.placement.test.tsx +2 -2
  16. package/src/modules/access/__tests__/ManageAccessDialog.proposal.test.tsx +166 -0
  17. package/src/modules/access/__tests__/ManageAccessDialog.restrict.test.tsx +510 -0
  18. package/src/modules/access/__tests__/ManageAccessDialog.row-menu-axes.test.tsx +299 -0
  19. package/src/modules/access/__tests__/ManageAccessDialog.row-menu-width.test.tsx +226 -0
  20. package/src/modules/access/__tests__/ManageAccessDialog.test.tsx +721 -126
  21. package/src/modules/access/__tests__/ManageAccessDialog.unknown-email.test.tsx +314 -0
  22. package/src/modules/access/__tests__/manage-access-affordance.test.ts +14 -0
  23. package/src/modules/access/__tests__/tailwindDeclarations.ts +210 -0
  24. package/src/modules/access/api.ts +140 -6
  25. package/src/modules/access/components/ManageAccessDialog.tsx +1299 -561
  26. package/src/modules/access/manage-access-affordance.ts +17 -0
  27. package/src/modules/admin/__tests__/AddMemberInput.test.tsx +297 -0
  28. package/src/modules/admin/__tests__/AdminRolesPage.capabilities.test.tsx +2 -2
  29. package/src/modules/admin/__tests__/AdminRolesPage.fixed-admin.test.tsx +189 -0
  30. package/src/modules/admin/__tests__/AdminRolesPage.suggest.test.tsx +1 -1
  31. package/src/modules/admin/__tests__/DirectoryGroupsPage.suggest.test.tsx +182 -0
  32. package/src/modules/admin/__tests__/DirectoryGroupsPage.test.tsx +165 -14
  33. package/src/modules/admin/__tests__/UserAccountsPage.test.tsx +401 -4
  34. package/src/modules/admin/__tests__/group-members-path.test.ts +27 -0
  35. package/src/modules/admin/components/AddMemberInput.tsx +268 -0
  36. package/src/modules/admin/components/AdminRolesPage.tsx +97 -132
  37. package/src/modules/admin/components/DirectoryGroupsPage.tsx +91 -39
  38. package/src/modules/admin/components/UserAccountsPage.tsx +271 -37
  39. package/src/modules/admin/components/group-members-path.ts +32 -0
  40. package/src/modules/admin/services/roles.api.ts +12 -1
  41. package/src/modules/audit/__tests__/AuditLogPage.test.tsx +312 -0
  42. package/src/modules/audit/components/AuditEventsPanel.tsx +319 -0
  43. package/src/modules/audit/components/AuditLogPage.tsx +373 -0
  44. package/src/modules/audit/components/principal-grouping.ts +49 -0
  45. package/src/modules/audit/services/audit.api.ts +98 -0
  46. package/src/modules/auth/__tests__/AccountPage.test.tsx +50 -2
  47. package/src/modules/auth/components/AccountPage.tsx +73 -54
  48. package/src/modules/auth/components/LoginScreen.tsx +1 -0
  49. package/src/modules/auth/services/account.api.ts +78 -4
  50. package/src/modules/change-requests/__tests__/ChangeRequestDialog.access-rules.test.tsx +144 -0
  51. package/src/modules/change-requests/__tests__/ChangeRequestDialog.binary.test.tsx +422 -0
  52. package/src/modules/change-requests/__tests__/ChangeRequestDialog.brings-itself-up-to-date.test.tsx +431 -0
  53. package/src/modules/change-requests/__tests__/ChangeRequestDialog.fork-point.test.tsx +193 -0
  54. package/src/modules/change-requests/__tests__/ChangeRequestDialog.initial-file.test.tsx +142 -0
  55. package/src/modules/change-requests/__tests__/ChangeRequestDialog.moved.test.tsx +202 -0
  56. package/src/modules/change-requests/__tests__/ChangeRequestDialog.test.tsx +205 -13
  57. package/src/modules/change-requests/__tests__/ChangeRequestDialog.unreadable.test.tsx +271 -0
  58. package/src/modules/change-requests/__tests__/FileChangeBoxes.test.tsx +208 -0
  59. package/src/modules/change-requests/__tests__/apply-outcome-for-every-viewer.test.tsx +286 -0
  60. package/src/modules/change-requests/__tests__/propose.concurrent.test.ts +273 -0
  61. package/src/modules/change-requests/__tests__/readFailure.test.ts +122 -0
  62. package/src/modules/change-requests/__tests__/useCrFileDiffs.test.tsx +238 -0
  63. package/src/modules/change-requests/__tests__/useFileOnBranch.test.tsx +56 -1
  64. package/src/modules/change-requests/__tests__/useForkPointFile.test.tsx +79 -0
  65. package/src/modules/change-requests/components/BranchFilePreview.tsx +357 -0
  66. package/src/modules/change-requests/components/ChangeBox.tsx +31 -2
  67. package/src/modules/change-requests/components/ChangeRequestDialog.tsx +862 -72
  68. package/src/modules/change-requests/components/CrFileTree.tsx +74 -58
  69. package/src/modules/change-requests/components/FileChangeBoxes.tsx +19 -15
  70. package/src/modules/change-requests/hooks/useApplyChangeRequest.ts +41 -7
  71. package/src/modules/change-requests/hooks/useCrFileDiffs.ts +181 -23
  72. package/src/modules/change-requests/hooks/useFileOnBranch.ts +70 -7
  73. package/src/modules/change-requests/hooks/useForkPointFile.ts +77 -0
  74. package/src/modules/change-requests/services/change-requests.api.ts +57 -1
  75. package/src/modules/change-requests/services/denied-file.api.ts +53 -0
  76. package/src/modules/change-requests/services/propose.api.ts +97 -8
  77. package/src/modules/change-requests/utils/approval.ts +15 -0
  78. package/src/modules/change-requests/utils/author.ts +32 -0
  79. package/src/modules/change-requests/utils/readFailure.ts +110 -0
  80. package/src/modules/git/__tests__/FileHistoryPanel.test.tsx +20 -0
  81. package/src/modules/git/components/FileHistoryPanel.tsx +5 -0
  82. package/src/modules/git/components/PullRequestsForMe.tsx +51 -24
  83. package/src/modules/git/services/__tests__/error-messages.test.ts +29 -0
  84. package/src/modules/git/services/error-messages.ts +12 -0
  85. package/src/modules/git/services/pr-prompts.ts +5 -5
  86. package/src/modules/layout/__tests__/HeaderAlignment.test.tsx +401 -0
  87. package/src/modules/layout/__tests__/SidebarFooterGrid.test.tsx +286 -0
  88. package/src/modules/layout/__tests__/SidebarFrameResponsive.test.tsx +61 -0
  89. package/src/modules/layout/components/AppLayout.tsx +2 -0
  90. package/src/modules/layout/components/MobileChatLayout.tsx +4 -1
  91. package/src/modules/layout/components/ResizableThreePaneLayout.tsx +4 -1
  92. package/src/modules/layout/components/SidebarFrame.tsx +108 -3
  93. package/src/modules/library/__tests__/AddToPluginDialog.test.tsx +171 -5
  94. package/src/modules/library/__tests__/DeleteToolDialog.test.tsx +356 -0
  95. package/src/modules/library/__tests__/IntegrationsSetupReminder.test.tsx +60 -0
  96. package/src/modules/library/__tests__/LibraryCard.test.tsx +91 -10
  97. package/src/modules/library/__tests__/LibraryRoutes.test.tsx +242 -107
  98. package/src/modules/library/__tests__/LibrarySidebarMenu.test.tsx +103 -98
  99. package/src/modules/library/__tests__/LinkSkillPanel.test.tsx +20 -5
  100. package/src/modules/library/__tests__/LockedPluginView.test.tsx +97 -7
  101. package/src/modules/library/__tests__/NewPluginDialog.test.tsx +13 -4
  102. package/src/modules/library/__tests__/PersonalAddDialog.test.tsx +79 -3
  103. package/src/modules/library/__tests__/PersonalPluginPage.test.tsx +201 -0
  104. package/src/modules/library/__tests__/PluginExtras.test.tsx +100 -9
  105. package/src/modules/library/__tests__/PluginJoinRequests.test.tsx +60 -1
  106. package/src/modules/library/__tests__/PluginPage.test.tsx +258 -6
  107. package/src/modules/library/__tests__/PluginsSidebar.contextmenu.test.tsx +16 -56
  108. package/src/modules/library/__tests__/PluginsSidebar.test.tsx +155 -152
  109. package/src/modules/library/__tests__/PluginsSidebarMenu.test.tsx +16 -0
  110. package/src/modules/library/__tests__/SharedViaPlugins.test.tsx +106 -0
  111. package/src/modules/library/__tests__/SkillPage.test.tsx +386 -80
  112. package/src/modules/library/__tests__/SkillsTree.test.tsx +293 -4
  113. package/src/modules/library/__tests__/ToolConnectionSection.test.tsx +582 -71
  114. package/src/modules/library/__tests__/ToolPage.test.tsx +87 -4
  115. package/src/modules/library/__tests__/WorkspaceItemRoute.test.tsx +173 -26
  116. package/src/modules/library/__tests__/auth-harness.tsx +9 -9
  117. package/src/modules/library/__tests__/card-row-menu.test.tsx +320 -0
  118. package/src/modules/library/__tests__/library-data.mapping.test.tsx +98 -0
  119. package/src/modules/library/__tests__/library-data.stale.test.tsx +121 -28
  120. package/src/modules/library/__tests__/library-data.test.ts +7 -0
  121. package/src/modules/library/__tests__/library-paths.test.ts +47 -4
  122. package/src/modules/library/__tests__/link-membership.test.ts +13 -4
  123. package/src/modules/library/__tests__/name-with-badges.test.tsx +273 -0
  124. package/src/modules/library/__tests__/newSkillMarkdown.test.ts +30 -0
  125. package/src/modules/library/__tests__/owner-pill.test.tsx +357 -0
  126. package/src/modules/library/__tests__/pending-tools.test.tsx +400 -0
  127. package/src/modules/library/__tests__/plugin-entries.test.ts +122 -0
  128. package/src/modules/library/__tests__/plugin-summary.test.ts +36 -1
  129. package/src/modules/library/__tests__/status.test.ts +82 -2
  130. package/src/modules/library/__tests__/tools.api.test.ts +44 -1
  131. package/src/modules/library/components/AccessRequestsBanner.tsx +85 -47
  132. package/src/modules/library/components/AddDialogTabs.tsx +103 -0
  133. package/src/modules/library/components/AddToPluginDialog.tsx +74 -18
  134. package/src/modules/library/components/IntegrationsSetupReminder.tsx +59 -0
  135. package/src/modules/library/components/ItemActionsMenu.tsx +288 -0
  136. package/src/modules/library/components/LibraryCard.tsx +146 -45
  137. package/src/modules/library/components/LibraryLayout.tsx +119 -256
  138. package/src/modules/library/components/LibraryPage.tsx +172 -39
  139. package/src/modules/library/components/LinkSkillPanel.tsx +1 -3
  140. package/src/modules/library/components/LockedPluginView.tsx +62 -34
  141. package/src/modules/library/components/NameWithBadges.tsx +164 -0
  142. package/src/modules/library/components/NewPluginDialog.tsx +16 -2
  143. package/src/modules/library/components/PageActions.tsx +11 -9
  144. package/src/modules/library/components/{PendingSkillReview.tsx → PendingItemReview.tsx} +14 -7
  145. package/src/modules/library/components/PersonalAddDialog.tsx +68 -18
  146. package/src/modules/library/components/PersonalPluginPage.tsx +121 -22
  147. package/src/modules/library/components/PluginExtras.tsx +140 -17
  148. package/src/modules/library/components/PluginIndexRow.tsx +47 -12
  149. package/src/modules/library/components/PluginPage.tsx +157 -41
  150. package/src/modules/library/components/PluginRows.tsx +286 -0
  151. package/src/modules/library/components/PluginsSidebar.tsx +239 -263
  152. package/src/modules/library/components/PluginsSidebarMenu.tsx +26 -1
  153. package/src/modules/library/components/ShareButton.tsx +17 -0
  154. package/src/modules/library/components/SkillsTree.tsx +141 -28
  155. package/src/modules/library/components/TeamRoute.tsx +15 -0
  156. package/src/modules/library/components/__tests__/upload-notices-once-per-page.test.tsx +144 -0
  157. package/src/modules/library/components/plugin-page-parts.tsx +103 -17
  158. package/src/modules/library/components/skill-page/SharedViaPlugins.tsx +6 -12
  159. package/src/modules/library/components/skill-page/SkillFilePane.tsx +5 -0
  160. package/src/modules/library/components/skill-page/SkillPage.tsx +274 -122
  161. package/src/modules/library/components/tool-page/DeleteToolDialog.tsx +218 -0
  162. package/src/modules/library/components/tool-page/ToolConnectionSection.tsx +79 -178
  163. package/src/modules/library/components/tool-page/ToolPage.tsx +106 -16
  164. package/src/modules/library/components/tool-page/ToolVarRow.tsx +42 -41
  165. package/src/modules/library/hooks/__tests__/useLibraryData.test.ts +98 -0
  166. package/src/modules/library/hooks/useLibraryData.ts +92 -19
  167. package/src/modules/library/routes/LibraryRoutes.tsx +14 -11
  168. package/src/modules/library/routes/WorkspaceItemRoute.tsx +77 -27
  169. package/src/modules/library/routes/library-paths.ts +26 -28
  170. package/src/modules/library/services/library.api.ts +38 -20
  171. package/src/modules/library/services/plugins.api.ts +69 -8
  172. package/src/modules/library/services/teams.api.ts +15 -0
  173. package/src/modules/library/services/tools.api.ts +78 -0
  174. package/src/modules/library/state/library-data.tsx +170 -32
  175. package/src/modules/library/utils/personal-plugin.ts +13 -15
  176. package/src/modules/library/utils/plugin-entries.ts +134 -0
  177. package/src/modules/library/utils/plugin-summary.ts +75 -9
  178. package/src/modules/library/utils/status.ts +135 -33
  179. package/src/modules/onboarding/__tests__/creator-welcome.test.tsx +8 -1
  180. package/src/modules/onboarding/__tests__/onboarding.test.tsx +853 -760
  181. package/src/modules/onboarding/agent-clients.ts +55 -23
  182. package/src/modules/onboarding/components/ConnectAgentPill.tsx +5 -1
  183. package/src/modules/onboarding/components/WelcomePage.tsx +98 -62
  184. package/src/modules/pr/services/pr-merge.api.ts +2 -1
  185. package/src/modules/review/components/MarkdownDiffViewer.tsx +53 -8
  186. package/src/modules/review/components/ReviewPanel.tsx +15 -17
  187. package/src/modules/review/components/__tests__/MarkdownDiffViewer.test.tsx +64 -0
  188. package/src/modules/review/components/__tests__/ReviewPanel.test.tsx +25 -1
  189. package/src/modules/secrets-vault/components/ConnectToolsPage.tsx +454 -117
  190. package/src/modules/secrets-vault/components/SecretsPage.tsx +48 -7
  191. package/src/modules/secrets-vault/components/ToolSecretsPanel.tsx +84 -5
  192. package/src/modules/secrets-vault/components/__tests__/ConnectToolsPage.test.tsx +425 -0
  193. package/src/modules/secrets-vault/components/__tests__/SecretsPage.test.tsx +417 -82
  194. package/src/modules/secrets-vault/components/__tests__/ToolSecretsPanel.test.tsx +105 -0
  195. package/src/modules/secrets-vault/components/__tests__/connect-lists-what-the-banner-counted.test.tsx +407 -0
  196. package/src/modules/secrets-vault/probe/SavedKeyProbeResult.tsx +98 -0
  197. package/src/modules/secrets-vault/probe/__tests__/probe-verdict.test.ts +160 -0
  198. package/src/modules/secrets-vault/probe/probe-verdict.ts +108 -0
  199. package/src/modules/secrets-vault/probe/useSavedKeyProbe.ts +228 -0
  200. package/src/modules/secrets-vault/services/connect.api.ts +36 -5
  201. package/src/modules/secrets-vault/utils/connect-status.ts +98 -0
  202. package/src/modules/settings/components/ClaudeConnectionCard.tsx +9 -24
  203. package/src/modules/settings/components/ClaudeConnectionFields.tsx +23 -0
  204. package/src/modules/settings/components/DeploymentPage.tsx +10 -30
  205. package/src/modules/settings/components/MarketplaceSection.tsx +152 -0
  206. package/src/modules/settings/components/__tests__/DeploymentPage.test.tsx +67 -4
  207. package/src/modules/settings/components/__tests__/MarketplaceSection.test.tsx +325 -0
  208. package/src/modules/settings/components/__tests__/SettingsLayout.test.tsx +7 -6
  209. package/src/modules/settings/services/github-facade.api.ts +23 -0
  210. package/src/modules/settings/settings-nav-items.tsx +13 -3
  211. package/src/modules/setup/__tests__/setup.oidc.test.tsx +172 -0
  212. package/src/modules/setup/__tests__/setup.probe-refusal.test.tsx +123 -0
  213. package/src/modules/setup/__tests__/setup.test.tsx +497 -4
  214. package/src/modules/setup/__tests__/useSetupStatus.test.tsx +130 -0
  215. package/src/modules/setup/components/SetupGate.tsx +16 -16
  216. package/src/modules/setup/components/SetupScreen.tsx +532 -43
  217. package/src/modules/setup/hooks/useSetupStatus.ts +93 -0
  218. package/src/modules/setup/services/setup.api.ts +141 -4
  219. package/src/modules/setup/utils/__tests__/root-folders.test.ts +72 -0
  220. package/src/modules/setup/utils/root-folders.ts +46 -0
  221. package/src/modules/toolbar/assets/claude-setup/01-add-manually.webp +0 -0
  222. package/src/modules/toolbar/assets/claude-setup/02-add-configuration.webp +0 -0
  223. package/src/modules/toolbar/assets/claude-setup/03-connect-account.webp +0 -0
  224. package/src/modules/toolbar/assets/claude-setup/04-pick-instance.webp +0 -0
  225. package/src/modules/toolbar/assets/claude-setup/05-plugins-add.webp +0 -0
  226. package/src/modules/toolbar/assets/claude-setup/06-add-marketplace.webp +0 -0
  227. package/src/modules/toolbar/assets/claude-setup/07-paste-url-sync.webp +0 -0
  228. package/src/modules/toolbar/assets/claude-setup/08-install-plugins.webp +0 -0
  229. package/src/modules/toolbar/assets/claude-setup/09-select-repository.webp +0 -0
  230. package/src/modules/toolbar/assets/claude-setup/10-connector-not-added.webp +0 -0
  231. package/src/modules/toolbar/assets/claude-setup/11-add-custom-connector.webp +0 -0
  232. package/src/modules/toolbar/assets/claude-setup/README.md +68 -0
  233. package/src/modules/toolbar/components/AgentInstructionsCard.tsx +296 -0
  234. package/src/modules/toolbar/components/ClaudeMarketplaceCarousel.tsx +107 -0
  235. package/src/modules/toolbar/components/ClaudeRegistrationSteps.tsx +127 -0
  236. package/src/modules/toolbar/components/CoworkSetupSteps.tsx +100 -0
  237. package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +177 -118
  238. package/src/modules/toolbar/components/ScreenshotStep.tsx +77 -0
  239. package/src/modules/toolbar/components/SetupCarousel.tsx +177 -0
  240. package/src/modules/toolbar/components/__tests__/AgentInstructionsCard.test.tsx +370 -0
  241. package/src/modules/toolbar/components/__tests__/ExternalAgentAccessPage.test.tsx +542 -42
  242. package/src/modules/toolbar/components/__tests__/Toolbar.test.tsx +2 -2
  243. package/src/modules/toolbar/components/__tests__/claude-setup-shots.test.ts +104 -0
  244. package/src/modules/toolbar/components/claude-connector-slide.tsx +38 -0
  245. package/src/modules/toolbar/components/claude-setup-shots.ts +167 -0
  246. package/src/modules/toolbar/components/deployment-address.ts +29 -0
  247. package/src/modules/toolbar/components/setup-step-parts.tsx +35 -0
  248. package/src/modules/toolbar/services/__tests__/agent-instructions.api.test.ts +89 -0
  249. package/src/modules/toolbar/services/agent-instructions.api.ts +167 -0
  250. package/src/modules/toolbar/services/external-api-keys.api.ts +8 -0
  251. package/src/modules/workflow/state/ChangeRequestStaleBinder.tsx +43 -0
  252. package/src/modules/workflow/state/EventBusProvider.tsx +122 -11
  253. package/src/modules/workflow/state/__tests__/EventBusProvider.storage.test.tsx +87 -0
  254. package/src/modules/workflow/state/__tests__/EventBusProvider.watch.test.tsx +223 -0
  255. package/src/modules/workflow/state/event-bus.context.ts +10 -0
  256. package/src/modules/workspace/__tests__/testFixtures.ts +5 -3
  257. package/src/modules/workspace/components/FileExplorer.tsx +1295 -191
  258. package/src/modules/workspace/components/FileRoute.tsx +353 -36
  259. package/src/modules/workspace/components/FileViewer.tsx +172 -46
  260. package/src/modules/workspace/components/KbDocumentShell.tsx +50 -6
  261. package/src/modules/workspace/components/KbPageHeader.tsx +120 -55
  262. package/src/modules/workspace/components/TreeActionConfirm.tsx +350 -0
  263. package/src/modules/workspace/components/__tests__/FileExplorer.test.tsx +2533 -129
  264. package/src/modules/workspace/components/__tests__/FileRoute.test.tsx +731 -18
  265. package/src/modules/workspace/components/__tests__/FileViewer.test.tsx +381 -12
  266. package/src/modules/workspace/components/__tests__/KbDocumentShell.test.tsx +39 -0
  267. package/src/modules/workspace/components/__tests__/KbPageHeader.test.tsx +33 -20
  268. package/src/modules/workspace/components/renderers/DocxRenderer.tsx +4 -5
  269. package/src/modules/workspace/components/renderers/DownloadFileButton.tsx +13 -4
  270. package/src/modules/workspace/components/renderers/EmailRenderer.tsx +4 -3
  271. package/src/modules/workspace/components/renderers/HtmlRenderer.tsx +8 -14
  272. package/src/modules/workspace/components/renderers/ImageRenderer.tsx +75 -16
  273. package/src/modules/workspace/components/renderers/KbImage.tsx +180 -0
  274. package/src/modules/workspace/components/renderers/KbMarkdownView.tsx +22 -6
  275. package/src/modules/workspace/components/renderers/MarkdownRenderer.tsx +48 -22
  276. package/src/modules/workspace/components/renderers/PdfRenderer.tsx +4 -5
  277. package/src/modules/workspace/components/renderers/PptxRenderer.tsx +4 -3
  278. package/src/modules/workspace/components/renderers/XlsxRenderer.tsx +4 -3
  279. package/src/modules/workspace/components/renderers/__tests__/DocxRenderer.test.tsx +12 -0
  280. package/src/modules/workspace/components/renderers/__tests__/DownloadFileButton.test.tsx +57 -9
  281. package/src/modules/workspace/components/renderers/__tests__/EmailRenderer.test.tsx +13 -1
  282. package/src/modules/workspace/components/renderers/__tests__/ImageRenderer.test.tsx +163 -0
  283. package/src/modules/workspace/components/renderers/__tests__/KbMarkdownView.test.tsx +237 -0
  284. package/src/modules/workspace/components/renderers/__tests__/MarkdownRenderer.test.tsx +108 -14
  285. package/src/modules/workspace/components/renderers/__tests__/PptxRenderer.test.tsx +14 -1
  286. package/src/modules/workspace/components/renderers/__tests__/XlsxRenderer.test.tsx +16 -1
  287. package/src/modules/workspace/components/renderers/__tests__/rendererSelection.test.tsx +66 -1
  288. package/src/modules/workspace/components/renderers/index.ts +53 -2
  289. package/src/modules/workspace/components/renderers/kbMarkdownPipeline.tsx +25 -4
  290. package/src/modules/workspace/components/renderers/rendererWorkspace.ts +40 -0
  291. package/src/modules/workspace/hooks/__tests__/useImageRevision.test.tsx +174 -0
  292. package/src/modules/workspace/hooks/__tests__/useOpenChangeRequests.test.tsx +179 -1
  293. package/src/modules/workspace/hooks/__tests__/useWorkspaceImageResolver.test.tsx +122 -0
  294. package/src/modules/workspace/hooks/__tests__/useWorkspaceState.test.tsx +892 -7
  295. package/src/modules/workspace/hooks/useImageRevision.ts +101 -0
  296. package/src/modules/workspace/hooks/useMergedWorkspaceTree.ts +22 -3
  297. package/src/modules/workspace/hooks/useWorkspaceImageResolver.ts +55 -0
  298. package/src/modules/workspace/hooks/useWorkspaceState.ts +424 -66
  299. package/src/modules/workspace/routing/__tests__/kb-routes.test.tsx +279 -3
  300. package/src/modules/workspace/routing/kb-routes.ts +206 -29
  301. package/src/modules/workspace/services/__tests__/workspace.api.test.ts +134 -1
  302. package/src/modules/workspace/services/workspace.api.ts +57 -4
  303. package/src/modules/workspace/state/__tests__/applied-request-clears-pending.test.tsx +343 -0
  304. package/src/modules/workspace/state/__tests__/upload-lands-where-it-was-dropped.test.tsx +158 -0
  305. package/src/modules/workspace/state/open-change-requests.tsx +100 -12
  306. package/src/modules/workspace/state/workspace.context.ts +125 -19
  307. package/src/modules/workspace/utils/__tests__/file-trace.test.ts +73 -0
  308. package/src/modules/workspace/utils/__tests__/fileTree.test.ts +220 -6
  309. package/src/modules/workspace/utils/__tests__/pasteLink.test.ts +76 -0
  310. package/src/modules/workspace/utils/__tests__/treeConfirm.test.ts +364 -0
  311. package/src/modules/workspace/utils/__tests__/uploadError.test.ts +35 -0
  312. package/src/modules/workspace/utils/file-trace.ts +50 -0
  313. package/src/modules/workspace/utils/fileTree.ts +112 -36
  314. package/src/modules/workspace/utils/frontmatter.ts +8 -4
  315. package/src/modules/workspace/utils/pasteLink.ts +90 -0
  316. package/src/modules/workspace/utils/treeConfirm.ts +338 -0
  317. package/src/modules/workspace/utils/uploadError.ts +29 -0
  318. package/src/shared/__tests__/marketplace-url.test.ts +6 -1
  319. package/src/shared/components/Button.tsx +16 -2
  320. package/src/shared/components/Dialog.tsx +27 -11
  321. package/src/shared/components/Menu.tsx +13 -1
  322. package/src/shared/components/PageShell.tsx +13 -8
  323. package/src/shared/components/__tests__/primitives.test.tsx +116 -2
  324. package/src/shared/components/__tests__/useFocusHandoff.test.tsx +192 -0
  325. package/src/shared/components/index.ts +2 -0
  326. package/src/shared/components/useDismissableMenu.ts +32 -10
  327. package/src/shared/components/useFocusHandoff.ts +51 -0
  328. package/src/shared/components/useLatestRef.ts +28 -0
  329. package/src/shared/markdown/Markdown.tsx +12 -3
  330. package/src/shared/markdown/__tests__/escapeSpacesInLinkDestinations.test.ts +39 -0
  331. package/src/shared/markdown/hrefs.ts +50 -0
  332. package/src/shared/marketplace-url.ts +33 -5
  333. package/src/shared/mcp/ChatGptInstallLink.tsx +3 -3
  334. package/src/shared/mcp/ConnectionInstructions.tsx +38 -27
  335. package/src/shared/mcp/__tests__/connect-snippets.test.ts +3 -3
  336. package/src/shared/mcp/connect-snippets.ts +14 -9
  337. package/src/shared/mcp/index.ts +1 -1
  338. package/src/shared/theme/__tests__/header-band.test.ts +197 -0
  339. package/src/shared/theme/header.ts +75 -0
  340. package/src/shared/theme/measure.ts +7 -4
  341. package/src/shared/theme/tokens.css +25 -0
  342. package/src/modules/library/__tests__/PluginsIndexPage.test.tsx +0 -363
  343. package/src/modules/library/__tests__/PluginsSidebar.locked.test.tsx +0 -97
  344. package/src/modules/library/components/PluginsIndexPage.tsx +0 -270
  345. package/src/modules/update-check/__tests__/UpdateBanner.test.tsx +0 -126
  346. package/src/modules/update-check/components/UpdateBanner.tsx +0 -92
  347. package/src/modules/update-check/services/update-check.api.ts +0 -24
@@ -1,11 +1,11 @@
1
1
  import { useMemo, useCallback, useContext, useEffect, useRef, useState } from 'react';
2
- import { Check, XCircle, Lock, AlertTriangle, ArrowLeft, FileText } from 'lucide-react';
2
+ import { Check, XCircle, Lock, AlertTriangle, ArrowLeft, FileText, History } from 'lucide-react';
3
3
  import type { FileTreeEntry, PullRequestSummary } from '@bevel-software/platform-shared';
4
4
  import { useWorkspace } from '../state/workspace.context';
5
5
  import { EditorTabs } from './EditorTabs';
6
6
  import { KbPageHeader } from './KbPageHeader';
7
7
  import { useOpenChangeRequests } from '../hooks/useOpenChangeRequests';
8
- import { Banner, Button, Surface } from '../../../shared/components';
8
+ import { Banner, Button, IconButton, Surface, useFocusHandoff } from '../../../shared/components';
9
9
  import { ManageAccessDialog } from '../../access/components/ManageAccessDialog';
10
10
  import { useGit } from '../../git/state/git.context';
11
11
  import { LayoutContext } from '../../layout/state/layout.context';
@@ -33,6 +33,7 @@ import {
33
33
  readFileOnBranch,
34
34
  } from '../../change-requests/services/change-requests.api';
35
35
  import { FileChangeBoxes } from '../../change-requests/components/FileChangeBoxes';
36
+ import { othersPendingBesides } from '../../change-requests/utils/author';
36
37
  import { ChangeRequestDialog } from '../../change-requests/components/ChangeRequestDialog';
37
38
  import { formatEligible } from '../../access/hooks/useFileAccess';
38
39
  import { PR_STALE_EVENT } from '../../../core/events';
@@ -206,7 +207,6 @@ export function FileViewer() {
206
207
  fromBranch: string;
207
208
  toBranch: string;
208
209
  } | null>(null);
209
- const historyAvailable = git.availability === 'ready';
210
210
  const hasUnsavedWork = isManualDirty || manualSaveState === 'saving';
211
211
 
212
212
  const hasPending = pendingFileContent !== null;
@@ -348,6 +348,69 @@ export function FileViewer() {
348
348
  // disables it so a double-click can't fire two acquires.
349
349
  const [isEnteringEdit, setIsEnteringEdit] = useState(false);
350
350
 
351
+ /**
352
+ * The log, and the clock that opens it, are withdrawn while a draft is
353
+ * open. Opening the log unmounts the editor; coming back re-mounts it from
354
+ * its seed, while `proposeBufferRef` still holds the newer keystrokes — so
355
+ * "Back to the document" would show the old text, and Send proposal would
356
+ * submit the new text nobody could see. The skill page applies the same
357
+ * rule (`!editing`) for the same reason. The `isEntering*` beats are in for
358
+ * the "Loading…" moment between the click and the editor, so the clock
359
+ * cannot open the log over an editor that is about to mount.
360
+ */
361
+ const historyAvailable =
362
+ git.availability === 'ready' &&
363
+ !editMode &&
364
+ !isEnteringEdit &&
365
+ !proposeMode &&
366
+ !isEnteringPropose;
367
+ // Losing the log CLOSES the view, rather than parking `activeTab` on it.
368
+ // `availability` is re-derived from a polled status call, so one failed
369
+ // poll flips it off and the next good one flips it back. Left on
370
+ // 'history', the tab would keep the column full-bleed with no panel in it
371
+ // (a bare document, no pane card, no way back but the next poll), and then
372
+ // put the log back over the file the moment git recovered, minutes after
373
+ // the reader had gone back to reading. Same rule the skill page applies to
374
+ // its own open flag.
375
+ //
376
+ // The LOG only. A comparison is asked for by the chat's "View full
377
+ // comparison" link, not by a clock this flag withdraws, and the panel
378
+ // reports git's state itself. Resetting it here too cancelled a click that
379
+ // landed before the first status poll answered (`availability` starts
380
+ // 'loading'), with nothing on screen to say so.
381
+ if (activeTab === 'history' && !historyAvailable) setActiveTab('content');
382
+ /**
383
+ * Opening the log from the pane bar's clock unmounts the pane bar, and with
384
+ * it the clock a keyboard user just activated; closing it hands the column
385
+ * back to prose, which hides the header's clock again (`historyInPane`).
386
+ * Either way focus would fall to `document`, so the clocks hand focus to
387
+ * each other across the swap (`useFocusHandoff`), and only for a swap the
388
+ * USER made. A full-bleed file has no pane bar: its header clock stays put
389
+ * and takes the focus instead. Every way out of the log or the comparison
390
+ * goes through `backToDocument`, so none can forget the handoff.
391
+ *
392
+ * BOTH clocks are withdrawn by `historyAvailable`, and a comparison
393
+ * outlives it — the panel is opened by the chat's link, not by a clock, so
394
+ * it stays up through a failed status poll. Leaving that view with git
395
+ * silent (or a draft open) would name two controls that are not on screen
396
+ * and drop focus on `document`, the one outcome this machinery exists to
397
+ * prevent. So the document's own title is named last: it is rendered in
398
+ * every one of those states, and landing on it announces the document the
399
+ * user just came back to.
400
+ */
401
+ const paneClockRef = useRef<HTMLButtonElement>(null);
402
+ const headerClockRef = useRef<HTMLButtonElement>(null);
403
+ const titleRef = useRef<HTMLHeadingElement>(null);
404
+ const handoff = useFocusHandoff(activeTab);
405
+ const openHistory = () => {
406
+ handoff('history', headerClockRef);
407
+ setActiveTab('history');
408
+ };
409
+ const backToDocument = () => {
410
+ handoff('content', paneClockRef, headerClockRef, titleRef);
411
+ setActiveTab('content');
412
+ };
413
+
351
414
  // Mirror the lock state into edit mode, but only on a transition from
352
415
  // "we held the lock" to "we don't" — that's the idle-release /
353
416
  // heartbeat-failure case where we want the UI to flip back to View
@@ -802,8 +865,8 @@ export function FileViewer() {
802
865
  // in the empty branch below because that branch is a `return` and this is a
803
866
  // hook — and it costs nothing while a file IS open, which is the common case.
804
867
  const suggestions = useMemo(
805
- () => suggestedPages(fileTree, SUGGESTION_LIMIT),
806
- [fileTree],
868
+ () => suggestedPages(fileTree, kbDirName, SUGGESTION_LIMIT),
869
+ [fileTree, kbDirName],
807
870
  );
808
871
  // Opening a suggestion is NAVIGATION, the same as clicking the file in the
809
872
  // explorer or a tab: the URL is the canonical record of what is open, and a
@@ -922,8 +985,13 @@ export function FileViewer() {
922
985
  kbDirName && openFilePath.startsWith(`${kbDirName}/`)
923
986
  ? openFilePath.slice(kbDirName.length + 1)
924
987
  : null;
988
+ // Named owners only once THIS file's lookup has answered. The hook keeps the
989
+ // previous file's grants while the next request is in flight, and "Waiting on
990
+ // Docs" over the incoming file's box is a false statement about who decides
991
+ // it — the same staleness `othersPending` guards against below. The anonymous
992
+ // wording is always true, so it is what the window gets.
925
993
  const ownersLabel =
926
- access.owners.roles.length > 0 || access.owners.users.length > 0
994
+ !access.loading && (access.owners.roles.length > 0 || access.owners.users.length > 0)
927
995
  ? formatEligible(access.owners)
928
996
  : 'the owners';
929
997
 
@@ -999,7 +1067,7 @@ export function FileViewer() {
999
1067
  // rule). While a mode is OPEN it shows the way out instead. The header's
1000
1068
  // own cluster is suppressed for prose files (`writeActionInPane`).
1001
1069
  const lockedBy = fileLock.externalLock?.holderName ?? null;
1002
- const paneActions = isReviewingPending || viewOnly ? null : proposeMode ? (
1070
+ const writeAction = isReviewingPending || viewOnly ? null : proposeMode ? (
1003
1071
  <>
1004
1072
  <Button variant="quiet" size="tiny" onClick={handleDiscardProposal} disabled={proposalBusy}>
1005
1073
  Discard
@@ -1054,6 +1122,30 @@ export function FileViewer() {
1054
1122
  {isEnteringEdit ? 'Loading…' : 'Edit'}
1055
1123
  </Button>
1056
1124
  );
1125
+ // "Who changed this, when" — the clock-arrow beside Edit, where Google Docs
1126
+ // keeps it. It sits in the bar for the same reason Edit does: history is a
1127
+ // thing you do to THE FILE, and the bar is where the file's actions live.
1128
+ // It used to be the lone item behind a ⋯ in the page header — two clicks
1129
+ // and a menu for a question people ask often. Not gated on `viewOnly` or a
1130
+ // pending review: reading the log changes nothing. Full-bleed renderers
1131
+ // have no bar, so the header carries it for them (`historyInPane`).
1132
+ const historyAction = historyAvailable ? (
1133
+ <IconButton
1134
+ ref={paneClockRef}
1135
+ aria-label="Version history"
1136
+ title="Version history"
1137
+ onClick={openHistory}
1138
+ >
1139
+ <History size={14} />
1140
+ </IconButton>
1141
+ ) : null;
1142
+ const paneActions =
1143
+ historyAction || writeAction ? (
1144
+ <>
1145
+ {historyAction}
1146
+ {writeAction}
1147
+ </>
1148
+ ) : null;
1057
1149
 
1058
1150
  return (
1059
1151
  <div className="h-full w-full flex flex-col bg-white min-w-0 relative">
@@ -1064,48 +1156,67 @@ export function FileViewer() {
1064
1156
  the Propose changes affordance already says what they CAN do, and the
1065
1157
  detailed who-may-edit copy still appears where it answers a question
1066
1158
  (the disabled-save tooltip). */}
1067
- {/* ONE column holds the tabs, the title and the text at the same width,
1159
+ {/* ONE column holds the title, the tabs and the text at the same width,
1068
1160
  so they share an edge and the page reads as a single centred block
1069
- (proto:700-705). `editorContainerRef` goes to `scrollRef` because the
1070
- shell is now the element that scrolls — the capture-phase listener
1071
- bound to it is the file lock's only activity signal for a reader. */}
1161
+ (proto:700-705). The prototype puts the tab strip above the title;
1162
+ this does not, because the title bar has to open the column to hold
1163
+ its line with the sidebar's header row — see `KbDocumentShell.header`.
1164
+ `editorContainerRef` goes to `scrollRef` because the shell is the
1165
+ element that scrolls — the capture-phase listener bound to it is the
1166
+ file lock's only activity signal for a reader. */}
1072
1167
  <KbDocumentShell
1073
- roomy={explorerHidden}
1168
+ roomy={explorerHidden}
1074
1169
  variant={shellVariant}
1075
1170
  scrollRef={editorContainerRef}
1171
+ // The document names itself, and its actions sit beside its name.
1172
+ // Everything the deleted 40px strip carried is here — the three chips
1173
+ // as Badges, Edit with the same handlers and the same lock semantics,
1174
+ // the copy-link that used to be an icon in the corner — plus Share and
1175
+ // the overflow the prototype puts on the page.
1176
+ //
1177
+ // It goes in the SLOT, not in the children, because the slot is what
1178
+ // makes it the column's first row — see `KbDocumentShell.header`. It
1179
+ // was the first child once, under `<EditorTabs />`, and a 36px tab
1180
+ // strip plus its 18px gap pushed the file page's title bar 54px below
1181
+ // the sidebar header row it lines up with.
1182
+ header={
1183
+ <KbPageHeader
1184
+ path={openFilePath}
1185
+ canWrite={access.canWrite}
1186
+ editMode={editMode}
1187
+ entering={isEnteringEdit}
1188
+ proposeMode={proposeMode}
1189
+ proposalBusy={proposalBusy}
1190
+ onPropose={handleEnterPropose}
1191
+ onSendProposal={() => void handleSendProposal()}
1192
+ onDiscardProposal={handleDiscardProposal}
1193
+ // `viewOnly` rides the same flag: it tells the header "the write
1194
+ // action is not yours to render" — and the pane bar renders none.
1195
+ writeActionInPane={shellVariant === 'prose' || viewOnly}
1196
+ // Prose gets a pane card, and the card's bar carries Version history
1197
+ // beside Edit. Not `viewOnly`: a view-only full-bleed file has no bar.
1198
+ historyInPane={shellVariant === 'prose'}
1199
+ historyButtonRef={headerClockRef}
1200
+ titleRef={titleRef}
1201
+ lockedBy={fileLock.externalLock?.holderName ?? null}
1202
+ historyAvailable={historyAvailable}
1203
+ isDirty={isManualDirty}
1204
+ waitingOnAgentUpdate={waitingOnAgentUpdate}
1205
+ isReviewingPending={isReviewingPending}
1206
+ activeTab={activeTab}
1207
+ onEdit={handleEnterEditMode}
1208
+ onDone={handleExitEditMode}
1209
+ // While the log is open the column is full-bleed, so the header
1210
+ // carries the clock (pressed). A second click on a pressed clock is a
1211
+ // request to put the document back, not to open the log again.
1212
+ onOpenHistory={activeTab === 'history' ? backToDocument : openHistory}
1213
+ onShare={handleShare}
1214
+ onCopyPage={canCopyPage ? handleCopyPage : undefined}
1215
+ onCopyLink={handleCopyLink}
1216
+ />
1217
+ }
1076
1218
  >
1077
1219
  <EditorTabs />
1078
- {/* The document names itself, and its actions sit beside its name.
1079
- Everything the deleted 40px strip carried is here — the three chips
1080
- as Badges, Edit with the same handlers and the same lock semantics,
1081
- the copy-link that used to be an icon in the corner — plus Share and
1082
- the overflow the prototype puts on the page. */}
1083
- <KbPageHeader
1084
- path={openFilePath}
1085
- canWrite={access.canWrite}
1086
- editMode={editMode}
1087
- entering={isEnteringEdit}
1088
- proposeMode={proposeMode}
1089
- proposalBusy={proposalBusy}
1090
- onPropose={handleEnterPropose}
1091
- onSendProposal={() => void handleSendProposal()}
1092
- onDiscardProposal={handleDiscardProposal}
1093
- // `viewOnly` rides the same flag: it tells the header "the write
1094
- // action is not yours to render" — and the pane bar renders none.
1095
- writeActionInPane={shellVariant === 'prose' || viewOnly}
1096
- lockedBy={fileLock.externalLock?.holderName ?? null}
1097
- historyAvailable={historyAvailable}
1098
- isDirty={isManualDirty}
1099
- waitingOnAgentUpdate={waitingOnAgentUpdate}
1100
- isReviewingPending={isReviewingPending}
1101
- activeTab={activeTab}
1102
- onEdit={handleEnterEditMode}
1103
- onDone={handleExitEditMode}
1104
- onOpenHistory={() => setActiveTab('history')}
1105
- onShare={handleShare}
1106
- onCopyPage={canCopyPage ? handleCopyPage : undefined}
1107
- onCopyLink={handleCopyLink}
1108
- />
1109
1220
 
1110
1221
  {/* Content stopped being a tab: the document IS the page, and history
1111
1222
  and comparison are two things you can go and look at. Each renders in
@@ -1113,12 +1224,12 @@ export function FileViewer() {
1113
1224
  route home would be reopening the file. */}
1114
1225
  {activeTab === 'history' && historyAvailable ? (
1115
1226
  <>
1116
- <BackToDocument onBack={() => setActiveTab('content')} label="Version history" />
1227
+ <BackToDocument onBack={backToDocument} label="Version history" />
1117
1228
  <FileHistoryPanel filePath={openFilePath} />
1118
1229
  </>
1119
- ) : activeTab === 'compare' && historyAvailable ? (
1230
+ ) : activeTab === 'compare' ? (
1120
1231
  <>
1121
- <BackToDocument onBack={() => setActiveTab('content')} label="Compare versions" />
1232
+ <BackToDocument onBack={backToDocument} label="Compare versions" />
1122
1233
  <FileComparisonPanel
1123
1234
  filePath={openFilePath}
1124
1235
  initialFrom={comparisonOverride?.fromBranch ?? null}
@@ -1327,6 +1438,21 @@ export function FileViewer() {
1327
1438
  requests={requestsOnThisFile}
1328
1439
  canDecide={access.canWrite === true}
1329
1440
  ownersLabel={ownersLabel}
1441
+ // Counted over `eligible` (the write: grants, which are what
1442
+ // approval rights and the merge gate resolve against), NOT
1443
+ // `owners` — a file can have writers and no owner: at all.
1444
+ // Only when those grants were actually loaded: a draft, a
1445
+ // non-KB path or a failed lookup default-allows with an
1446
+ // EMPTY list, which would claim the viewer is the only one.
1447
+ // Nor mid-lookup: the hook keeps the PREVIOUS file's grants
1448
+ // while the next file's lookup is in flight.
1449
+ othersPending={
1450
+ !access.error &&
1451
+ !access.loading &&
1452
+ (access.eligible.roles.length > 0 || access.eligible.users.length > 0)
1453
+ ? othersPendingBesides(access.eligible, auth.user?.email)
1454
+ : undefined
1455
+ }
1330
1456
  onApplied={() => {
1331
1457
  reloadTabFromDisk(openFilePath).catch(() => {});
1332
1458
  }}
@@ -5,6 +5,7 @@ import {
5
5
  DOCUMENT_COLUMN_WIDE,
6
6
  documentGutters,
7
7
  } from '../../../shared/theme/measure';
8
+ import { HEADER_COLUMN_TOP } from '../../../shared/theme/header';
8
9
 
9
10
  /**
10
11
  * The Knowledge surface's document column — the prototype's `.wrap.kb`.
@@ -18,6 +19,7 @@ import {
18
19
  * The tab strip mounts INSIDE it, not above it. That is the prototype's own
19
20
  * rule (proto:700-705): one column holds tabs, title and text at the same
20
21
  * width, so they share an edge and the page reads as a single centred block.
22
+ * It mounts inside it BELOW the title bar, though — see `header`.
21
23
  */
22
24
  export interface KbDocumentShellProps {
23
25
  /** Widens the column and opens the second track for the rail. */
@@ -65,6 +67,24 @@ export interface KbDocumentShellProps {
65
67
  * as "complementary" — so the rail names itself and hands the id over.
66
68
  */
67
69
  railLabelledBy?: string;
70
+ /**
71
+ * The page's title bar — and the FIRST row of this column, in every
72
+ * variant, on `HEADER_COLUMN_TOP`.
73
+ *
74
+ * A SLOT rather than the caller's first child, for the same reason
75
+ * `SidebarFrame` owns the row on the other side of the seam: the band's top
76
+ * edge is the seam, so "the title bar opens the column" is a rule the frame
77
+ * has to hold, not a JSX order a caller has to remember. It was a JSX order
78
+ * once, and `FileViewer` put `<EditorTabs />` above it — a 36px tab strip
79
+ * plus its 18px gap, so the file page's title bar rendered 54px below the
80
+ * sidebar header row it was supposed to line up with, at every width,
81
+ * whatever the two heights agreed on. Staging caught that; nothing in the
82
+ * suite did, because no test rendered the header in its real page.
83
+ *
84
+ * Passing nothing is a page with no title bar (the change-request and
85
+ * review surfaces): the column simply opens on its children.
86
+ */
87
+ header?: ReactNode;
68
88
  children: ReactNode;
69
89
  }
70
90
 
@@ -74,6 +94,7 @@ export function KbDocumentShell({
74
94
  roomy = false,
75
95
  scrollRef,
76
96
  railLabelledBy,
97
+ header,
77
98
  children,
78
99
  }: KbDocumentShellProps) {
79
100
  return (
@@ -97,7 +118,20 @@ export function KbDocumentShell({
97
118
  // widening a measure there is none of, and scrolls on its own so a
98
119
  // long link list cannot stretch the iframe.
99
120
  <div className="flex h-full min-h-0 w-full">
100
- <div className="flex h-full min-h-0 min-w-0 flex-1 flex-col">{children}</div>
121
+ {/* `HEADER_COLUMN_TOP` here too. Full-bleed gives up the measure and
122
+ the gutters, but NOT the seam: this column used to open straight
123
+ onto its renderer, so a PDF's title bar sat 12px HIGHER than the
124
+ sidebar's header row — the prose column's bug in the opposite
125
+ direction. The offset rides the column the band is already in
126
+ rather than a wrapper of its own, so the chain of definite
127
+ heights above is untouched; border-box means the renderer below
128
+ simply gets 12px less of it. */}
129
+ <div
130
+ className={cn('flex h-full min-h-0 min-w-0 flex-1 flex-col', HEADER_COLUMN_TOP)}
131
+ >
132
+ {header}
133
+ {children}
134
+ </div>
101
135
  {rail && (
102
136
  <aside
103
137
  aria-labelledby={railLabelledBy}
@@ -117,21 +151,31 @@ export function KbDocumentShell({
117
151
  className={cn(
118
152
  DOCUMENT_COLUMN_WIDE,
119
153
  documentGutters(roomy),
120
- 'grid grid-cols-1 items-start gap-11 pt-3',
154
+ 'grid grid-cols-1 items-start gap-11',
155
+ HEADER_COLUMN_TOP,
121
156
  'max-[900px]:gap-[26px] min-[901px]:grid-cols-[minmax(0,620px)_296px]',
122
157
  )}
123
158
  >
124
- <article className="min-w-0">{children}</article>
159
+ <article className="min-w-0">
160
+ {header}
161
+ {children}
162
+ </article>
125
163
  <aside aria-labelledby={railLabelledBy} className="min-w-0">
126
164
  {rail}
127
165
  </aside>
128
166
  </div>
129
167
  ) : (
130
- // `pt-3` is 12px — Knowledge's own top padding, NOT the app-wide 34px.
168
+ // `HEADER_COLUMN_TOP` is 12px — the offset every column that opens
169
+ // on a header band shares, Knowledge's own value promoted to a token.
131
170
  // The top bar already separates the column from the window, so the
132
171
  // page's own padding only has to keep the tabs off the bar
133
- // (`.wrap.kb`, proto:695-699). Do not "fix" this to 34px.
134
- <div className={cn(DOCUMENT_COLUMN, documentGutters(roomy), 'pt-3')}>{children}</div>
172
+ // (`.wrap.kb`, proto:695-699). The Library opened on 34px until
173
+ // this ticket, and 34 against 12 is what put the two surfaces' title
174
+ // bars on different lines. Do not "fix" this back to 34px.
175
+ <div className={cn(DOCUMENT_COLUMN, documentGutters(roomy), HEADER_COLUMN_TOP)}>
176
+ {header}
177
+ {children}
178
+ </div>
135
179
  )}
136
180
  </div>
137
181
  );