@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
@@ -57,8 +57,21 @@ export function withConnectionKey(key: string): string {
57
57
 
58
58
  /** The marketplace's registered name — what `plugin@<name>` refers to in Claude Code. */
59
59
  export const MARKETPLACE_NAME = 'hexis';
60
- /** The one-install bundle plugin every compiled marketplace carries. */
60
+ /**
61
+ * The one-install plugin every compiled marketplace carries: every skill the
62
+ * person may read plus the knowledge base's MCP endpoint, as content — the
63
+ * same plugin on Claude Code, Cowork and claude.ai.
64
+ */
61
65
  export const BUNDLE_PLUGIN = 'hexis-all';
66
+ /**
67
+ * The plugin Codex installs to reach the knowledge base. Codex's catalogue
68
+ * leaves the bundle out (it would repeat every other entry), so `hexis-all`
69
+ * is not found there; the Codex-served plugin carrying the Hexis MCP server
70
+ * is the skills plugin — the backend's `SKILLS_PLUGIN_NAME`.
71
+ */
72
+ export const CODEX_PLUGIN = 'skills-and-knowledge';
73
+ /** The MCP server's name inside the compiled plugins — what `codex mcp login` takes. */
74
+ export const MCP_SERVER_NAME = 'hexis';
62
75
 
63
76
  /**
64
77
  * The KIND stored on a connection key minted when a person connects an
@@ -71,19 +84,34 @@ export const BUNDLE_PLUGIN = 'hexis-all';
71
84
  export const GITHUB_LINK_KIND = 'github-link';
72
85
 
73
86
  /**
74
- * The three one-liners the settings page shows, with the key in the URL —
75
- * Claude Code's background refresh disables credential helpers, so the key
76
- * has nowhere else to live. `key` may be a placeholder.
87
+ * The commands the settings page shows, with the key in the URL — Claude
88
+ * Code's background refresh disables credential helpers, so the key has
89
+ * nowhere else to live. `key` may be a placeholder.
90
+ *
91
+ * Codex's is a four-line block, in the forms checked against Codex CLI
92
+ * 0.154.0: adding a marketplace installs nothing, so the plugin is added by
93
+ * name (`plugin add`, there is no `plugin install`); the plugin's server
94
+ * entry carries no credentials, so `mcp login` signs in through the browser;
95
+ * the last line asks Codex to call a Hexis tool, so the person sees it answer.
77
96
  */
78
97
  export function marketplaceCommands(key: string): { claude: string; codex: string; skills: string } {
79
98
  const url = withConnectionKey(key);
80
99
  return {
81
100
  claude: `claude plugin marketplace add ${url} && claude plugin install ${BUNDLE_PLUGIN}@${MARKETPLACE_NAME}`,
82
- codex: `codex plugin marketplace add ${url}`,
101
+ codex: [
102
+ `codex plugin marketplace add ${url}`,
103
+ `codex plugin add ${CODEX_PLUGIN}@${MARKETPLACE_NAME}`,
104
+ `codex mcp login ${MCP_SERVER_NAME}`,
105
+ `codex exec --skip-git-repo-check "Call the ${MCP_SERVER_NAME} MCP server's list_tools tool and print the tool names it returns."`,
106
+ ].join('\n'),
83
107
  skills: `npx skills add ${url} --all -y`,
84
108
  };
85
109
  }
86
110
 
111
+ /** Why the Codex block has a login line — said beside the block wherever it is shown. */
112
+ export const CODEX_LOGIN_NOTE =
113
+ "Codex signs in through your browser once: the login line is needed because the plugin's server entry carries no credentials.";
114
+
87
115
  /** For tests — module-global state must not leak between them. */
88
116
  export function resetMarketplaceGitUrlForTests(): void {
89
117
  configured = null;
@@ -5,9 +5,9 @@ import { canDeepLink, chatgptInstallUrl } from './connect-snippets';
5
5
  /**
6
6
  * The ChatGPT counterpart of {@link ClaudeInstallLink} — with one honest
7
7
  * difference. Claude's link PREFILLS the connector; ChatGPT publishes no
8
- * such link, so this one only opens the settings pane where a custom MCP
9
- * server is created. The person still turns on Developer mode, presses
10
- * Create, types the name and pastes the URL. It is a shortcut through a menu
8
+ * such link, so this one only opens ChatGPT's settings. The person still
9
+ * opens Plugins, turns on Developer Mode, presses Create, types the name and
10
+ * pastes the URL. It is a shortcut through a menu
11
11
  * nobody finds on the first try, not a grant of anything — which is why it
12
12
  * carries no warning, and why every surface that shows it also shows the
13
13
  * name and the URL to paste.
@@ -3,16 +3,17 @@ import { ClaudeInstallLink } from './ClaudeInstallLink';
3
3
  import { ChatGptInstallLink } from './ChatGptInstallLink';
4
4
  import { MCP_DISPLAY_NAME, claudeCodeCommand, jsonConfigSnippet } from './connect-snippets';
5
5
 
6
- /**
7
- * How to point an interactive agent at this workspace: the three
8
- * no-key connection configs, plus the Claude and ChatGPT install links when
9
- * the deployment is reachable enough for them to work.
6
+ /*
7
+ * How to point an interactive agent at this workspace's HOSTED endpoint, in
8
+ * two parts, because the External agent access page shows them in two
9
+ * drawers: Claude and ChatGPT lead the page, and the configs for every other
10
+ * agent sit two drawers further down.
10
11
  *
11
- * Its own component rather than a block inside `ExternalAgentAccessPage`
12
+ * Their own components rather than blocks inside `ExternalAgentAccessPage`
12
13
  * because that page fetches external API keys on mount. Testing "does the
13
14
  * install button appear" by rendering the whole page meant mocking the
14
15
  * credential API first — a test coupled to code it does not care about, which
15
- * breaks whenever that API changes. This takes a URL and renders; there is
16
+ * breaks whenever that API changes. These take a URL and render; there is
16
17
  * nothing to mock.
17
18
  *
18
19
  * Every URL here comes from the one `mcpUrl` prop. That is the point: the
@@ -20,30 +21,40 @@ import { MCP_DISPLAY_NAME, claudeCodeCommand, jsonConfigSnippet } from './connec
20
21
  * `window.location.origin`, which is the browser's idea of where we are
21
22
  * rather than the deployment's.
22
23
  */
23
- export function ConnectionInstructions({ mcpUrl }: { mcpUrl: string }) {
24
+
25
+ /**
26
+ * Claude and ChatGPT: the install links when the deployment is reachable
27
+ * enough for them to work, and the address to paste by hand either way.
28
+ */
29
+ export function AssistantConnectionInstructions({ mcpUrl }: { mcpUrl: string }) {
30
+ return (
31
+ <div>
32
+ {/* The buttons first, then the manual routes underneath — the fallback
33
+ has to stay visible, because the buttons are unavailable on any
34
+ deployment the assistants cannot reach, and the copy-paste URL is
35
+ the only thing that always works. ChatGPT's button only opens the
36
+ settings root (no prefill exists), so the name and URL to type sit
37
+ right below it. */}
38
+ <div className="mb-1.5 flex flex-wrap items-center gap-2">
39
+ <ClaudeInstallLink mcpUrl={mcpUrl} showHint />
40
+ <ChatGptInstallLink mcpUrl={mcpUrl} />
41
+ </div>
42
+ <p className="text-[11px] text-ink-muted mb-1 leading-snug">
43
+ Or add it by hand and paste this URL — Claude: Settings → Connectors → Add custom
44
+ connector. ChatGPT: Settings → Plugins (or Apps &amp; Connectors) → turn on Developer
45
+ Mode (under Advanced in older versions), go back and choose Create (or Add), and name it <span className="font-medium">{MCP_DISPLAY_NAME}</span>.
46
+ When asked to authorize, your browser opens this app to finish connecting.
47
+ </p>
48
+ <CopyBlock label={null} value={mcpUrl} rows={1} />
49
+ </div>
50
+ );
51
+ }
52
+
53
+ /** Every other agent on the hosted endpoint: Claude Code's one-liner and the JSON config. */
54
+ export function OtherAgentConnectionInstructions({ mcpUrl }: { mcpUrl: string }) {
24
55
  return (
25
56
  <>
26
57
  <CopyBlock label="Connect Claude Code" value={claudeCodeCommand(mcpUrl)} rows={2} />
27
- <div>
28
- <div className="text-xs font-medium text-ink mb-1">claude.ai, Claude Desktop and ChatGPT</div>
29
- {/* The buttons first, then the manual routes underneath — the fallback
30
- has to stay visible, because the buttons are unavailable on any
31
- deployment the assistants cannot reach, and the copy-paste URL is
32
- the only thing that always works. ChatGPT's button only opens the
33
- settings pane (no prefill exists), so the name and URL to type sit
34
- right below it. */}
35
- <div className="mb-1.5 flex flex-wrap items-center gap-2">
36
- <ClaudeInstallLink mcpUrl={mcpUrl} showHint />
37
- <ChatGptInstallLink mcpUrl={mcpUrl} />
38
- </div>
39
- <p className="text-[11px] text-ink-muted mb-1 leading-snug">
40
- Or add it by hand and paste this URL — Claude: Settings → Connectors → Add custom
41
- connector. ChatGPT: Settings → Apps &amp; Connectors → Advanced → turn on Developer
42
- mode, then Create, and name it <span className="font-medium">{MCP_DISPLAY_NAME}</span>.
43
- When asked to authorize, your browser opens this app to finish connecting.
44
- </p>
45
- <CopyBlock label={null} value={mcpUrl} rows={1} />
46
- </div>
47
58
  <div>
48
59
  <div className="text-xs font-medium text-ink mb-1">Other agents (JSON config)</div>
49
60
  <p className="text-[11px] text-ink-muted mb-1 leading-snug">
@@ -328,11 +328,11 @@ describe('claudeInstallUrl: the documented install link', () => {
328
328
  });
329
329
  });
330
330
 
331
- describe('chatgptInstallUrl: the settings pane, since ChatGPT prefills nothing', () => {
332
- it('opens ChatGPT’s connector settings over https', () => {
331
+ describe('chatgptInstallUrl: settings itself, since ChatGPT prefills nothing', () => {
332
+ it('opens ChatGPT’s settings root over https, not a pane it can rename', () => {
333
333
  const link = chatgptInstallUrl();
334
334
  expect(link.startsWith('https://chatgpt.com/')).toBe(true);
335
- expect(link).toContain('settings');
335
+ expect(link).toBe('https://chatgpt.com/#settings');
336
336
  });
337
337
  });
338
338
 
@@ -328,19 +328,24 @@ export function claudeInstallUrl(mcpUrl: string, name: string): string {
328
328
  }
329
329
 
330
330
  /**
331
- * Where ChatGPT keeps its connector settings — the pane whose "Advanced"
332
- * section holds the Developer mode toggle and, once it is on, the "Create"
333
- * button for a custom MCP server.
331
+ * ChatGPT's settings — the root, not a pane inside it.
332
+ *
333
+ * This used to point at `#settings/Connectors`, the old "Apps & Connectors"
334
+ * pane. ChatGPT has since renamed that page Plugins, and people who followed
335
+ * that link and the old steps could not find their way. A pane anchor names a
336
+ * page ChatGPT can rename again without notice; the settings root is the one
337
+ * that survives, and the numbered steps beside the button (see
338
+ * `AGENT_CLIENTS`) start from exactly there and name both page names.
334
339
  *
335
340
  * Unlike Claude, ChatGPT publishes no install link: there is no query
336
- * parameter that prefills a connector's name or URL. So this is a shortcut to
337
- * the right settings pane and nothing more — the person still types the name
338
- * and pastes the endpoint, which is why every surface that offers this link
339
- * shows both right beside it. The settings pane is a hash route, so it takes
340
- * no parameters and there is nothing to encode.
341
+ * parameter that prefills a connector's name or URL. So this is a shortcut
342
+ * into settings and nothing more — the person still types the name and
343
+ * pastes the endpoint, which is why every surface that offers this link shows
344
+ * both right beside it. Settings is a hash route, so it takes no parameters
345
+ * and there is nothing to encode.
341
346
  */
342
347
  export function chatgptInstallUrl(): string {
343
- return 'https://chatgpt.com/#settings/Connectors';
348
+ return 'https://chatgpt.com/#settings';
344
349
  }
345
350
 
346
351
  /* ------------------------------------------------------------------ *
@@ -30,6 +30,6 @@ export {
30
30
 
31
31
  export { ClaudeInstallLink } from './ClaudeInstallLink';
32
32
  export { ChatGptInstallLink } from './ChatGptInstallLink';
33
- export { ConnectionInstructions } from './ConnectionInstructions';
33
+ export { AssistantConnectionInstructions, OtherAgentConnectionInstructions } from './ConnectionInstructions';
34
34
  export { CopyBlock } from './CopyBlock';
35
35
  export { useCopyFeedback } from './useCopyFeedback';
@@ -0,0 +1,197 @@
1
+ /**
2
+ * The header band must stay ONE number in ONE place.
3
+ *
4
+ * The bug this guards is not "the header is the wrong height" — it is "the
5
+ * two headers under the toolbar each computed their own height, and nothing
6
+ * in the build noticed they disagreed." Tailwind compiles `h-header` whatever
7
+ * `--spacing-header` says; tsc has no opinion on a class string; the
8
+ * design-system ratchet counts OFF-system values and `h-header` is the
9
+ * on-system answer. A page that quietly goes back to `h-[52px]`, or to a
10
+ * `mt-1.5` nudging its title into place, breaks the seam and every existing
11
+ * gate stays silent. Only reading the sources catches it.
12
+ *
13
+ * So this test asserts the two halves of the contract:
14
+ * 1. the token exists in `tokens.css`, and `HEADER_BAND` is what spends it;
15
+ * 2. every header row in the app comes through `HEADER_BAND` — no page
16
+ * keeps a private header height.
17
+ *
18
+ * The measured half of the contract — that the sidebar's row and a page's
19
+ * title bar actually render to the same pixel height — is
20
+ * `modules/layout/__tests__/HeaderAlignment.test.tsx`.
21
+ */
22
+ import { describe, it, expect } from 'vitest';
23
+ import { readdirSync, readFileSync } from 'node:fs';
24
+ import { dirname, join, sep } from 'node:path';
25
+ import { fileURLToPath } from 'node:url';
26
+ import { HEADER_BAND, HEADER_COLUMN_TOP } from '../header';
27
+
28
+ // Resolved off this file rather than `process.cwd()`, and deliberately not as
29
+ // `new URL(..., import.meta.url)`: Vite rewrites that exact pattern into an
30
+ // asset URL, whose http scheme fails `fileURLToPath`. Same reasoning as
31
+ // `accent-contrast.test.ts`, which reads the same stylesheet.
32
+ const HERE = dirname(fileURLToPath(import.meta.url));
33
+ const SRC = join(HERE, '..', '..', '..');
34
+
35
+ const read = (relativeToSrc: string) => readFileSync(join(SRC, relativeToSrc), 'utf8');
36
+
37
+ const TOKENS = read('shared/theme/tokens.css');
38
+
39
+ /**
40
+ * Every row that renders a header — the sidebar's, and each surface's page
41
+ * title bar. The ticket's third acceptance criterion is this list: the file
42
+ * page, the skill page, the tool page and the Library's own pages all inherit
43
+ * the fix, and none of them keeps a height of its own.
44
+ */
45
+ const HEADER_ROWS = [
46
+ 'modules/layout/components/SidebarFrame.tsx',
47
+ 'modules/workspace/components/KbPageHeader.tsx',
48
+ 'modules/library/components/LibraryPage.tsx',
49
+ 'modules/library/components/PluginPage.tsx',
50
+ 'modules/library/components/PersonalPluginPage.tsx',
51
+ 'modules/library/components/LockedPluginView.tsx',
52
+ 'modules/library/components/skill-page/SkillPage.tsx',
53
+ 'modules/library/components/tool-page/ToolPage.tsx',
54
+ ];
55
+
56
+ /** Every column that opens on a band, and so must open at the same offset. */
57
+ const HEADER_COLUMNS = [
58
+ 'modules/layout/components/SidebarFrame.tsx',
59
+ 'modules/library/components/LibraryLayout.tsx',
60
+ 'modules/workspace/components/KbDocumentShell.tsx',
61
+ ];
62
+
63
+ /** What marks an element as a header row, and as a header column. */
64
+ const ROW_MARKER = String.raw`data-testid=\{(?:PAGE_HEADER_TESTID|SIDEBAR_HEADER_TESTID)\}`;
65
+ const COLUMN_MARKER = String.raw`\bHEADER_COLUMN_TOP\b`;
66
+
67
+ /**
68
+ * Every `.tsx` under `src/` that a header row or a header column could be
69
+ * hiding in — the app's own code, not its tests.
70
+ *
71
+ * This is what stops `HEADER_ROWS` and `HEADER_COLUMNS` from going quietly
72
+ * stale. Two enumerations of "every page with a title bar", maintained by
73
+ * hand, are two more things that can be forgotten: a page added next year
74
+ * would render a private header height and the whole suite would stay green,
75
+ * which is the exact shape of the bug this file exists to prevent. So the
76
+ * lists are checked against the tree rather than trusted — see 'the list of
77
+ * header rows is the whole list' below.
78
+ */
79
+ const APP_SOURCES = readdirSync(SRC, { recursive: true, encoding: 'utf8' })
80
+ .map((entry) => entry.split(sep).join('/'))
81
+ .filter((entry) => entry.endsWith('.tsx') && !entry.includes('__tests__/'));
82
+
83
+ /** The app files whose source matches `pattern`, as paths relative to `src/`. */
84
+ function sourcesMatching(pattern: string): string[] {
85
+ return APP_SOURCES.filter((file) => new RegExp(pattern).test(read(file))).sort();
86
+ }
87
+
88
+ /**
89
+ * The opening tag around each hit of `marker` in a source file — from the
90
+ * `<` that opens it to the end of that tag. Scoped to the tag rather than the
91
+ * whole file on purpose: a page is allowed its own `h-[60vh]` panel three
92
+ * hundred lines further down, and its own `pt-[34px]` on something that is
93
+ * not a header column; what it is not allowed is a height or an offset on the
94
+ * element that has to agree with the sidebar.
95
+ */
96
+ function tagsAround(source: string, marker: string): string[] {
97
+ const tags: string[] = [];
98
+ const hits = new RegExp(marker, 'g');
99
+ for (let hit = hits.exec(source); hit; hit = hits.exec(source)) {
100
+ // From the '<' that opens the tag, so the attribute order does not
101
+ // decide whether the test can see the className.
102
+ const start = source.lastIndexOf('<', hit.index);
103
+ const end = source.indexOf('>', hit.index);
104
+ // Not every mention of the marker is inside a tag: the import that brings
105
+ // `HEADER_COLUMN_TOP` into the file names it too. Such a hit has no '<'
106
+ // before it, or has one that already closed — and slicing forward from it
107
+ // to the next '>' hands the assertions a window over whatever constants
108
+ // happen to sit between, which is how a `pt-` belonging to some unrelated
109
+ // class string gets read as a second offset on the column. A mention that
110
+ // is not in a tag is not a tag.
111
+ if (start === -1 || source.slice(start, hit.index).includes('>')) continue;
112
+ // An unterminated tag is a parse the assertions cannot trust, so hand
113
+ // them the rest of the file rather than a silently empty string.
114
+ tags.push(source.slice(start === -1 ? hit.index : start, end === -1 ? undefined : end));
115
+ }
116
+ return tags;
117
+ }
118
+
119
+ const headerRowTagsIn = (source: string) => tagsAround(source, ROW_MARKER);
120
+ const columnTagsIn = (source: string) => tagsAround(source, COLUMN_MARKER);
121
+
122
+ describe('the header height token', () => {
123
+ it('is declared once, in tokens.css', () => {
124
+ const declarations = TOKENS.match(/^\s*--spacing-header:\s*[^;]+;/gm) ?? [];
125
+ expect(declarations).toHaveLength(1);
126
+ expect(declarations[0]).toMatch(/--spacing-header:\s*\d+(\.\d+)?px;/);
127
+ });
128
+
129
+ it('is what HEADER_BAND spends', () => {
130
+ // `h-header` is the utility Tailwind compiles the token into. If the band
131
+ // ever stops naming it, the token has become decoration.
132
+ expect(HEADER_BAND).toContain('h-header');
133
+ // Centred, because the band's two sides hold text at different sizes — a
134
+ // 13px nav row against a 26px title — and centring identical boxes is the
135
+ // only rule that survives either of them changing.
136
+ expect(HEADER_BAND).toContain('items-center');
137
+ });
138
+ });
139
+
140
+ describe('the enumerations cannot go stale', () => {
141
+ // Both directions, in one assertion each. A header row in a file nobody
142
+ // listed is a page that quietly kept a private height; a listed file that
143
+ // no longer renders one is a list describing an app that no longer exists,
144
+ // and its `it.each` case would keep passing vacuously either way.
145
+ it('the list of header rows is the whole list', () => {
146
+ expect(sourcesMatching(ROW_MARKER)).toEqual([...HEADER_ROWS].sort());
147
+ });
148
+
149
+ it('the list of header columns is the whole list', () => {
150
+ expect(sourcesMatching(COLUMN_MARKER)).toEqual([...HEADER_COLUMNS].sort());
151
+ });
152
+ });
153
+
154
+ describe('every header row uses the shared band', () => {
155
+ it.each(HEADER_ROWS)('%s imports HEADER_BAND', (file) => {
156
+ expect(read(file)).toMatch(/import \{[^}]*\bHEADER_BAND\b[^}]*\} from '[^']*shared\/theme\/header'/);
157
+ });
158
+
159
+ it.each(HEADER_ROWS)('%s renders its header row on the band, and nothing else', (file) => {
160
+ const rows = headerRowTagsIn(read(file));
161
+ // Every file in this list renders one, or the list is out of date.
162
+ expect(rows.length).toBeGreaterThan(0);
163
+ for (const tag of rows) {
164
+ expect(tag).toContain('HEADER_BAND');
165
+ // A height, a vertical padding or a top margin ON THE ROW ITSELF is
166
+ // the private-height regression coming back — `h-[52px]`, `py-2`, the
167
+ // `mt-1.5` that used to nudge a title into place. The band decides all
168
+ // three. A bottom margin is not on the list: it is the gap to whatever
169
+ // comes next, which is the page's business and moves nothing above it.
170
+ expect(tag).not.toMatch(/\b(?:min-)?h-(?:\[|\d)/);
171
+ expect(tag).not.toMatch(/\b(?:mt|pt|pb|py)-/);
172
+ }
173
+ });
174
+
175
+ it.each(HEADER_COLUMNS)('%s opens on the shared offset', (file) => {
176
+ const source = read(file);
177
+ expect(source).toMatch(
178
+ /import \{[^}]*\bHEADER_COLUMN_TOP\b[^}]*\} from '[^']*shared\/theme\/header'/,
179
+ );
180
+ const columns = columnTagsIn(source);
181
+ expect(columns.length).toBeGreaterThan(0);
182
+ for (const tag of columns) {
183
+ // Scoped to the column's own tag, the same way the rows are: a page is
184
+ // allowed a `pt-[34px]` on some panel far below, and even a comment
185
+ // quoting the class it used to open on. What it may not have is a
186
+ // literal top padding on the element that opens the column — the 34px
187
+ // the Library used to open on was the other half of the seam, and any
188
+ // second number here re-creates it whatever its value.
189
+ expect(tag).not.toMatch(/'[^']*\bpt-/);
190
+ expect(tag).not.toMatch(/"[^"]*\bpt-/);
191
+ }
192
+ });
193
+
194
+ it('states the column offset once', () => {
195
+ expect(HEADER_COLUMN_TOP).toMatch(/^pt-[\w.[\]]+$/);
196
+ });
197
+ });
@@ -0,0 +1,75 @@
1
+ /**
2
+ * The header band — ONE row height for the two headers that sit side by side.
3
+ *
4
+ * Under the toolbar the app shows two rows at once: the sidebar's header row
5
+ * on the left, and the page's title bar on the right. They are laid out by
6
+ * different files (`layout/components/SidebarFrame` and each surface's page
7
+ * header), and until this constant existed each of them arrived at its own
8
+ * height by accident — the frame's column padding plus whatever its header
9
+ * slot happened to be tall, against a page column's top padding plus an
10
+ * `<h1>`'s line box. The two answers were about 20px apart, and the seam
11
+ * between them is the first thing anyone sees below the toolbar.
12
+ *
13
+ * So the height is a TOKEN (`--spacing-header` in `./tokens.css`, which
14
+ * Tailwind compiles into `.h-header`) and this is the one class string that
15
+ * spends it. A header row wears `HEADER_BAND` and nothing else about its
16
+ * height; a page that writes its own `h-[…]`, `py-…` or `mt-…` to make a
17
+ * title bar "look right" has re-created the bug, which is why
18
+ * `__tests__/header-band.test.ts` checks that every page title bar comes
19
+ * through here.
20
+ *
21
+ * It lives in `shared/theme` rather than beside either header for the reason
22
+ * `./measure.ts` does: the band belongs to neither of the two files that
23
+ * render it, and a change to it has to move both or it is not a fix.
24
+ *
25
+ * `items-center` is what puts the two texts on one line. The band's contents
26
+ * differ in size — a 13px nav row on one side, a 26px title on the other —
27
+ * so centring them in an identical box is the only rule that survives either
28
+ * one changing. `flex-none` keeps the band its own height inside the
29
+ * sidebar's flex column, where a `flex-1` sibling would otherwise squeeze it.
30
+ */
31
+ export const HEADER_BAND = 'flex h-header flex-none items-center';
32
+
33
+ /**
34
+ * The air above the band, for every column that shows one.
35
+ *
36
+ * The band's TOP edge is the seam, not just its height, so a column that
37
+ * starts its band lower than its neighbour breaks the alignment however well
38
+ * the two heights agree. This was the actual bug: the Library's column opened
39
+ * on 34px of padding ("Skills opens on a heading and keeps the roomier
40
+ * default", `./measure.ts`) while Knowledge opened on 12px and the sidebar on
41
+ * 16px — three numbers, three files, one seam.
42
+ *
43
+ * 12px is Knowledge's, kept: the toolbar already separates the column from
44
+ * the window, so this only has to keep the band off the bar
45
+ * (`.wrap.kb`, proto:695-699). The prototype's 34px `.wrap` padding is no
46
+ * longer used by any column — under a toolbar the window edge it was written
47
+ * for does not exist.
48
+ */
49
+ export const HEADER_COLUMN_TOP = 'pt-3';
50
+
51
+ /**
52
+ * The wrapper for a quiet `size="sm"` Button that LEADS a band — the `‹ Back`
53
+ * link on the skill and tool pages.
54
+ *
55
+ * The negative margin is not a nudge. `Button`'s quiet `sm` size carries
56
+ * `px-2` (`QUIET_SIZE.sm` in `shared/components/Button.tsx`), so a button
57
+ * placed at the band's leading edge starts its TEXT 8px inside that edge,
58
+ * while every other page's title starts on it — and a back link that hangs
59
+ * 8px right of the heading below it is the same kind of not-quite-aligned
60
+ * this whole band exists to remove. `-ml-2` cancels exactly that padding, so
61
+ * the label's left edge is the column's left edge; the button's hover
62
+ * background still covers its own padding, which is what the padding is for.
63
+ *
64
+ * It is a constant, and it says the number it is cancelling, because the
65
+ * coupling runs the wrong way: this file cannot see `QUIET_SIZE`, so a change
66
+ * to that padding silently moves the link. One place to fix beats two, and a
67
+ * named constant is a thing a reader can grep for from `Button.tsx`.
68
+ */
69
+ export const HEADER_BAND_LEAD = '-ml-2 flex-none';
70
+
71
+ /** The sidebar's header row, for the layout test that measures the seam. */
72
+ export const SIDEBAR_HEADER_TESTID = 'sidebar-header-row';
73
+
74
+ /** A page's title bar — the band on the other side of the seam. */
75
+ export const PAGE_HEADER_TESTID = 'page-header-row';
@@ -17,10 +17,13 @@
17
17
  * rather than moving the column. That is deliberate: hiding the nav should buy
18
18
  * margin, not line length.
19
19
  *
20
- * TOP padding is deliberately NOT here. It is the one measure the two surfaces
21
- * do not share: Knowledge opens on a tab strip and starts high (12px), Skills
22
- * opens on a heading and keeps the roomier default (34px). See
23
- * `plans/05-knowledge-ui.md` §1. Set it at the call site.
20
+ * TOP padding is NOT here either, but it is no longer the measure the two
21
+ * surfaces disagree about. It used to be — Knowledge opened on a tab strip at
22
+ * 12px, Skills on a heading at 34px (`plans/05-knowledge-ui.md` §1) — and
23
+ * those 22px were the reported seam: the Library's title bar sat a fifth of an
24
+ * inch below the sidebar header row beside it. Both columns now open on
25
+ * `HEADER_COLUMN_TOP` from `./header.ts`, which is where the shared band's
26
+ * geometry lives. Take it from there rather than restating a number here.
24
27
  */
25
28
 
26
29
  /** The default column: an 880px measure, centred. */
@@ -93,6 +93,31 @@
93
93
  seven of these at three different alphas. */
94
94
  --color-scrim: rgba(55, 53, 47, 0.28);
95
95
 
96
+ /* ── layout ─────────────────────────────────────────────────────────
97
+ ONE header height, for the two rows that sit side by side under the
98
+ toolbar: the sidebar's header row and a page's title bar.
99
+
100
+ Before this token each side owned its own arithmetic — the sidebar
101
+ frame's column padding plus whatever its header slot happened to be
102
+ tall, against the page column's top padding plus an `<h1>`'s line box —
103
+ and the two answers were about 20px apart. The seam between them is the
104
+ first thing anyone sees below the toolbar, so "close enough, twice"
105
+ reads as a broken layout.
106
+
107
+ Tailwind compiles this into `.h-header { height: var(--spacing-header) }`,
108
+ which is the rule `shared/theme/header.ts` hands to both call sites. Do
109
+ NOT write a height on either header row directly: a second number is the
110
+ drift this token exists to prevent, and `__tests__/header-band.test.ts`
111
+ fails if one appears.
112
+
113
+ 48px is the smallest 4px step that holds BOTH sides at their present
114
+ size, which is why the fix moves the page title bar onto the sidebar's
115
+ line rather than either side onto a new one. The sidebar's pill is
116
+ 31.5px (`py-1.5` over `--text-ui` 13px at a 1.5 line height); a page's
117
+ `--text-display` heading is 29.9px (26px at 1.15). The band centres the
118
+ taller of the two with 9px of air above and below. */
119
+ --spacing-header: 48px;
120
+
96
121
  /* ── radii ────────────────────────────────────────────────────────────
97
122
  Six ROLES, collapsed from the prototype's 16 hand-tuned values:
98
123
  xs tags, inline code