@bevel-software/platform-core-frontend 0.14.0 → 0.19.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 (360) hide show
  1. package/THIRD-PARTY-NOTICES.md +2 -2
  2. package/package.json +3 -3
  3. package/src/core/CoreAppShell.tsx +34 -26
  4. package/src/core/__tests__/AppChrome.test.tsx +0 -3
  5. package/src/core/__tests__/bootstrap.test.ts +33 -1
  6. package/src/core/__tests__/events.test.ts +43 -0
  7. package/src/core/bootstrap.ts +38 -1
  8. package/src/core/events.ts +85 -3
  9. package/src/core/registry.ts +1 -1
  10. package/src/lib/__tests__/api.test.ts +38 -0
  11. package/src/lib/__tests__/email.test.ts +44 -0
  12. package/src/lib/api.ts +19 -2
  13. package/src/lib/email.ts +37 -1
  14. package/src/lib/utils.ts +2 -0
  15. package/src/modules/access/__tests__/ManageAccessDialog.add-row-picking.test.tsx +141 -0
  16. package/src/modules/access/__tests__/ManageAccessDialog.chip-truncation.test.tsx +204 -0
  17. package/src/modules/access/__tests__/ManageAccessDialog.download-read.test.tsx +234 -0
  18. package/src/modules/access/__tests__/ManageAccessDialog.edited-row-visible.test.tsx +160 -0
  19. package/src/modules/access/__tests__/ManageAccessDialog.placement.test.tsx +2 -2
  20. package/src/modules/access/__tests__/ManageAccessDialog.proposal.test.tsx +166 -0
  21. package/src/modules/access/__tests__/ManageAccessDialog.restrict.test.tsx +510 -0
  22. package/src/modules/access/__tests__/ManageAccessDialog.row-menu-axes.test.tsx +299 -0
  23. package/src/modules/access/__tests__/ManageAccessDialog.row-menu-width.test.tsx +226 -0
  24. package/src/modules/access/__tests__/ManageAccessDialog.test.tsx +781 -76
  25. package/src/modules/access/__tests__/ManageAccessDialog.unknown-email.test.tsx +314 -0
  26. package/src/modules/access/__tests__/manage-access-affordance.test.ts +14 -0
  27. package/src/modules/access/__tests__/plugin-token.test.ts +21 -0
  28. package/src/modules/access/__tests__/tailwindDeclarations.ts +210 -0
  29. package/src/modules/access/api.ts +192 -10
  30. package/src/modules/access/components/ManageAccessDialog.tsx +1337 -570
  31. package/src/modules/access/manage-access-affordance.ts +17 -0
  32. package/src/modules/admin/__tests__/AddMemberInput.test.tsx +297 -0
  33. package/src/modules/admin/__tests__/AdminRolesPage.capabilities.test.tsx +2 -2
  34. package/src/modules/admin/__tests__/AdminRolesPage.fixed-admin.test.tsx +189 -0
  35. package/src/modules/admin/__tests__/AdminRolesPage.suggest.test.tsx +1 -1
  36. package/src/modules/admin/__tests__/ConnectionKeysPage.test.tsx +266 -0
  37. package/src/modules/admin/__tests__/DirectoryGroupsPage.suggest.test.tsx +182 -0
  38. package/src/modules/admin/__tests__/DirectoryGroupsPage.test.tsx +165 -14
  39. package/src/modules/admin/__tests__/UserAccountsPage.test.tsx +401 -4
  40. package/src/modules/admin/__tests__/group-members-path.test.ts +27 -0
  41. package/src/modules/admin/components/AddMemberInput.tsx +268 -0
  42. package/src/modules/admin/components/AdminRolesPage.tsx +97 -132
  43. package/src/modules/admin/components/ConnectionKeysPage.tsx +269 -0
  44. package/src/modules/admin/components/DirectoryGroupsPage.tsx +91 -39
  45. package/src/modules/admin/components/UserAccountsPage.tsx +271 -37
  46. package/src/modules/admin/components/connection-keys-grouping.ts +43 -0
  47. package/src/modules/admin/components/group-members-path.ts +32 -0
  48. package/src/modules/admin/services/connection-keys.api.ts +47 -0
  49. package/src/modules/admin/services/roles.api.ts +12 -1
  50. package/src/modules/auth/__tests__/AccountPage.test.tsx +50 -2
  51. package/src/modules/auth/components/AccountPage.tsx +73 -54
  52. package/src/modules/auth/components/LoginScreen.tsx +1 -0
  53. package/src/modules/auth/services/account.api.ts +78 -4
  54. package/src/modules/change-requests/__tests__/ChangeRequestDialog.access-rules.test.tsx +144 -0
  55. package/src/modules/change-requests/__tests__/ChangeRequestDialog.binary.test.tsx +422 -0
  56. package/src/modules/change-requests/__tests__/ChangeRequestDialog.brings-itself-up-to-date.test.tsx +431 -0
  57. package/src/modules/change-requests/__tests__/ChangeRequestDialog.fork-point.test.tsx +193 -0
  58. package/src/modules/change-requests/__tests__/ChangeRequestDialog.initial-file.test.tsx +142 -0
  59. package/src/modules/change-requests/__tests__/ChangeRequestDialog.moved.test.tsx +202 -0
  60. package/src/modules/change-requests/__tests__/ChangeRequestDialog.test.tsx +205 -13
  61. package/src/modules/change-requests/__tests__/ChangeRequestDialog.unreadable.test.tsx +271 -0
  62. package/src/modules/change-requests/__tests__/FileChangeBoxes.test.tsx +208 -0
  63. package/src/modules/change-requests/__tests__/apply-outcome-for-every-viewer.test.tsx +286 -0
  64. package/src/modules/change-requests/__tests__/propose.concurrent.test.ts +273 -0
  65. package/src/modules/change-requests/__tests__/readFailure.test.ts +122 -0
  66. package/src/modules/change-requests/__tests__/useCrFileDiffs.test.tsx +238 -0
  67. package/src/modules/change-requests/__tests__/useFileOnBranch.test.tsx +56 -1
  68. package/src/modules/change-requests/__tests__/useForkPointFile.test.tsx +79 -0
  69. package/src/modules/change-requests/components/BranchFilePreview.tsx +357 -0
  70. package/src/modules/change-requests/components/ChangeBox.tsx +31 -2
  71. package/src/modules/change-requests/components/ChangeRequestDialog.tsx +862 -72
  72. package/src/modules/change-requests/components/CrFileTree.tsx +74 -58
  73. package/src/modules/change-requests/components/FileChangeBoxes.tsx +19 -15
  74. package/src/modules/change-requests/hooks/useApplyChangeRequest.ts +41 -7
  75. package/src/modules/change-requests/hooks/useCrFileDiffs.ts +181 -23
  76. package/src/modules/change-requests/hooks/useFileOnBranch.ts +70 -7
  77. package/src/modules/change-requests/hooks/useForkPointFile.ts +77 -0
  78. package/src/modules/change-requests/services/change-requests.api.ts +57 -1
  79. package/src/modules/change-requests/services/denied-file.api.ts +53 -0
  80. package/src/modules/change-requests/services/propose.api.ts +97 -8
  81. package/src/modules/change-requests/utils/approval.ts +15 -0
  82. package/src/modules/change-requests/utils/author.ts +32 -0
  83. package/src/modules/change-requests/utils/readFailure.ts +110 -0
  84. package/src/modules/git/__tests__/FileHistoryPanel.test.tsx +20 -0
  85. package/src/modules/git/__tests__/GitSyncFailedBanner.test.tsx +65 -1
  86. package/src/modules/git/components/FileHistoryPanel.tsx +5 -0
  87. package/src/modules/git/components/GitSyncFailedBanner.tsx +68 -5
  88. package/src/modules/git/components/PullRequestsForMe.tsx +51 -24
  89. package/src/modules/git/services/__tests__/error-messages.test.ts +29 -0
  90. package/src/modules/git/services/error-messages.ts +12 -0
  91. package/src/modules/git/services/pr-prompts.ts +5 -5
  92. package/src/modules/layout/__tests__/HeaderAlignment.test.tsx +401 -0
  93. package/src/modules/layout/__tests__/SidebarFooterGrid.test.tsx +286 -0
  94. package/src/modules/layout/__tests__/SidebarFrameResponsive.test.tsx +61 -0
  95. package/src/modules/layout/components/AppLayout.tsx +2 -0
  96. package/src/modules/layout/components/MobileChatLayout.tsx +4 -1
  97. package/src/modules/layout/components/ResizableThreePaneLayout.tsx +4 -1
  98. package/src/modules/layout/components/SidebarFrame.tsx +109 -4
  99. package/src/modules/library/__tests__/AddToPluginDialog.test.tsx +171 -5
  100. package/src/modules/library/__tests__/DeleteToolDialog.test.tsx +356 -0
  101. package/src/modules/library/__tests__/IntegrationsSetupReminder.test.tsx +60 -0
  102. package/src/modules/library/__tests__/LibraryCard.test.tsx +91 -10
  103. package/src/modules/library/__tests__/LibraryRoutes.test.tsx +242 -107
  104. package/src/modules/library/__tests__/LibrarySidebarMenu.test.tsx +104 -99
  105. package/src/modules/library/__tests__/LinkSkillPanel.test.tsx +136 -0
  106. package/src/modules/library/__tests__/LockedPluginView.test.tsx +103 -7
  107. package/src/modules/library/__tests__/NewPluginDialog.test.tsx +18 -8
  108. package/src/modules/library/__tests__/PersonalAddDialog.test.tsx +79 -3
  109. package/src/modules/library/__tests__/PersonalPluginPage.test.tsx +201 -0
  110. package/src/modules/library/__tests__/PluginExtras.test.tsx +115 -9
  111. package/src/modules/library/__tests__/PluginJoinRequests.test.tsx +60 -1
  112. package/src/modules/library/__tests__/PluginPage.test.tsx +453 -7
  113. package/src/modules/library/__tests__/PluginsSidebar.contextmenu.test.tsx +17 -57
  114. package/src/modules/library/__tests__/PluginsSidebar.test.tsx +161 -97
  115. package/src/modules/library/__tests__/PluginsSidebarMenu.test.tsx +16 -0
  116. package/src/modules/library/__tests__/SharedViaPlugins.test.tsx +106 -0
  117. package/src/modules/library/__tests__/SkillPage.test.tsx +391 -78
  118. package/src/modules/library/__tests__/SkillsTree.test.tsx +461 -0
  119. package/src/modules/library/__tests__/ToolConnectionSection.test.tsx +582 -71
  120. package/src/modules/library/__tests__/ToolPage.test.tsx +94 -4
  121. package/src/modules/library/__tests__/WorkspaceItemRoute.test.tsx +279 -21
  122. package/src/modules/library/__tests__/auth-harness.tsx +9 -9
  123. package/src/modules/library/__tests__/card-row-menu.test.tsx +320 -0
  124. package/src/modules/library/__tests__/library-data.mapping.test.tsx +98 -0
  125. package/src/modules/library/__tests__/library-data.stale.test.tsx +183 -0
  126. package/src/modules/library/__tests__/library-data.test.ts +7 -0
  127. package/src/modules/library/__tests__/library-paths.test.ts +75 -0
  128. package/src/modules/library/__tests__/link-membership.test.ts +129 -0
  129. package/src/modules/library/__tests__/name-with-badges.test.tsx +273 -0
  130. package/src/modules/library/__tests__/newSkillMarkdown.test.ts +30 -0
  131. package/src/modules/library/__tests__/owner-pill.test.tsx +357 -0
  132. package/src/modules/library/__tests__/pending-tools.test.tsx +400 -0
  133. package/src/modules/library/__tests__/plugin-entries.test.ts +122 -0
  134. package/src/modules/library/__tests__/plugin-summary.test.ts +67 -0
  135. package/src/modules/library/__tests__/status.test.ts +82 -2
  136. package/src/modules/library/__tests__/tools.api.test.ts +44 -1
  137. package/src/modules/library/__tests__/useJoinRequests.test.tsx +46 -0
  138. package/src/modules/library/components/AccessRequestsBanner.tsx +85 -47
  139. package/src/modules/library/components/AddDialogTabs.tsx +103 -0
  140. package/src/modules/library/components/AddToPluginDialog.tsx +107 -18
  141. package/src/modules/library/components/IntegrationsSetupReminder.tsx +59 -0
  142. package/src/modules/library/components/ItemActionsMenu.tsx +288 -0
  143. package/src/modules/library/components/LibraryCard.tsx +149 -34
  144. package/src/modules/library/components/LibraryLayout.tsx +120 -247
  145. package/src/modules/library/components/LibraryPage.tsx +172 -39
  146. package/src/modules/library/components/LinkSkillPanel.tsx +169 -0
  147. package/src/modules/library/components/LockedPluginView.tsx +63 -35
  148. package/src/modules/library/components/NameWithBadges.tsx +164 -0
  149. package/src/modules/library/components/NewPluginDialog.tsx +19 -5
  150. package/src/modules/library/components/PageActions.tsx +31 -9
  151. package/src/modules/library/components/{PendingSkillReview.tsx → PendingItemReview.tsx} +14 -7
  152. package/src/modules/library/components/PersonalAddDialog.tsx +68 -18
  153. package/src/modules/library/components/PersonalPluginPage.tsx +123 -23
  154. package/src/modules/library/components/PluginExtras.tsx +143 -18
  155. package/src/modules/library/components/PluginIndexRow.tsx +47 -12
  156. package/src/modules/library/components/PluginPage.tsx +234 -38
  157. package/src/modules/library/components/PluginRows.tsx +286 -0
  158. package/src/modules/library/components/PluginsSidebar.tsx +271 -238
  159. package/src/modules/library/components/PluginsSidebarMenu.tsx +26 -1
  160. package/src/modules/library/components/RenamePluginDialog.tsx +136 -0
  161. package/src/modules/library/components/ShareButton.tsx +17 -0
  162. package/src/modules/library/components/SkillsTree.tsx +204 -0
  163. package/src/modules/library/components/StatusDot.tsx +1 -0
  164. package/src/modules/library/components/TeamRoute.tsx +15 -0
  165. package/src/modules/library/components/__tests__/upload-notices-once-per-page.test.tsx +144 -0
  166. package/src/modules/library/components/plugin-page-parts.tsx +132 -23
  167. package/src/modules/library/components/skill-page/SharedViaPlugins.tsx +212 -0
  168. package/src/modules/library/components/skill-page/SkillFilePane.tsx +5 -0
  169. package/src/modules/library/components/skill-page/SkillPage.tsx +337 -121
  170. package/src/modules/library/components/tool-page/DeleteToolDialog.tsx +218 -0
  171. package/src/modules/library/components/tool-page/ToolConnectionSection.tsx +79 -178
  172. package/src/modules/library/components/tool-page/ToolPage.tsx +116 -17
  173. package/src/modules/library/components/tool-page/ToolVarRow.tsx +42 -41
  174. package/src/modules/library/hooks/__tests__/useLibraryData.test.ts +98 -0
  175. package/src/modules/library/hooks/useJoinRequests.ts +48 -18
  176. package/src/modules/library/hooks/useLibraryData.ts +92 -19
  177. package/src/modules/library/routes/LibraryRoutes.tsx +14 -11
  178. package/src/modules/library/routes/WorkspaceItemRoute.tsx +229 -82
  179. package/src/modules/library/routes/library-paths.ts +46 -35
  180. package/src/modules/library/services/library.api.ts +89 -17
  181. package/src/modules/library/services/plugins.api.ts +161 -9
  182. package/src/modules/library/services/teams.api.ts +15 -0
  183. package/src/modules/library/services/tools.api.ts +78 -0
  184. package/src/modules/library/state/library-data.tsx +268 -37
  185. package/src/modules/library/utils/personal-plugin.ts +13 -15
  186. package/src/modules/library/utils/plugin-entries.ts +134 -0
  187. package/src/modules/library/utils/plugin-summary.ts +102 -0
  188. package/src/modules/library/utils/status.ts +204 -35
  189. package/src/modules/onboarding/__tests__/creator-welcome.test.tsx +11 -3
  190. package/src/modules/onboarding/__tests__/onboarding.test.tsx +853 -760
  191. package/src/modules/onboarding/agent-clients.ts +55 -23
  192. package/src/modules/onboarding/components/ConnectAgentPill.tsx +5 -1
  193. package/src/modules/onboarding/components/WelcomePage.tsx +98 -62
  194. package/src/modules/pr/services/pr-merge.api.ts +2 -1
  195. package/src/modules/review/components/MarkdownDiffViewer.tsx +53 -8
  196. package/src/modules/review/components/ReviewPanel.tsx +15 -17
  197. package/src/modules/review/components/__tests__/MarkdownDiffViewer.test.tsx +64 -0
  198. package/src/modules/review/components/__tests__/ReviewPanel.test.tsx +25 -1
  199. package/src/modules/secrets-vault/components/ConnectToolsPage.tsx +454 -117
  200. package/src/modules/secrets-vault/components/SecretsPage.tsx +48 -7
  201. package/src/modules/secrets-vault/components/ToolSecretsPanel.tsx +84 -5
  202. package/src/modules/secrets-vault/components/__tests__/ConnectToolsPage.test.tsx +425 -0
  203. package/src/modules/secrets-vault/components/__tests__/SecretsPage.test.tsx +417 -82
  204. package/src/modules/secrets-vault/components/__tests__/ToolSecretsPanel.test.tsx +105 -0
  205. package/src/modules/secrets-vault/components/__tests__/connect-lists-what-the-banner-counted.test.tsx +407 -0
  206. package/src/modules/secrets-vault/probe/SavedKeyProbeResult.tsx +98 -0
  207. package/src/modules/secrets-vault/probe/__tests__/probe-verdict.test.ts +160 -0
  208. package/src/modules/secrets-vault/probe/probe-verdict.ts +108 -0
  209. package/src/modules/secrets-vault/probe/useSavedKeyProbe.ts +228 -0
  210. package/src/modules/secrets-vault/services/connect.api.ts +36 -5
  211. package/src/modules/secrets-vault/utils/connect-status.ts +98 -0
  212. package/src/modules/settings/components/ClaudeConnectionCard.tsx +154 -0
  213. package/src/modules/settings/components/ClaudeConnectionFields.tsx +23 -0
  214. package/src/modules/settings/components/DeploymentPage.tsx +16 -22
  215. package/src/modules/settings/components/MarketplaceSection.tsx +152 -0
  216. package/src/modules/settings/components/__tests__/ClaudeConnectionCard.test.tsx +63 -0
  217. package/src/modules/settings/components/__tests__/DeploymentPage.test.tsx +74 -1
  218. package/src/modules/settings/components/__tests__/MarketplaceSection.test.tsx +325 -0
  219. package/src/modules/settings/components/__tests__/SettingsLayout.test.tsx +5 -5
  220. package/src/modules/settings/services/github-facade.api.ts +66 -0
  221. package/src/modules/settings/settings-nav-items.tsx +10 -2
  222. package/src/modules/setup/__tests__/setup.oidc.test.tsx +172 -0
  223. package/src/modules/setup/__tests__/setup.probe-refusal.test.tsx +123 -0
  224. package/src/modules/setup/__tests__/setup.test.tsx +615 -4
  225. package/src/modules/setup/__tests__/useSetupStatus.test.tsx +130 -0
  226. package/src/modules/setup/components/SetupGate.tsx +16 -16
  227. package/src/modules/setup/components/SetupScreen.tsx +711 -40
  228. package/src/modules/setup/hooks/useSetupStatus.ts +93 -0
  229. package/src/modules/setup/services/setup.api.ts +218 -3
  230. package/src/modules/setup/utils/__tests__/root-folders.test.ts +72 -0
  231. package/src/modules/setup/utils/root-folders.ts +46 -0
  232. package/src/modules/toolbar/assets/claude-setup/01-add-manually.webp +0 -0
  233. package/src/modules/toolbar/assets/claude-setup/02-add-configuration.webp +0 -0
  234. package/src/modules/toolbar/assets/claude-setup/03-connect-account.webp +0 -0
  235. package/src/modules/toolbar/assets/claude-setup/04-pick-instance.webp +0 -0
  236. package/src/modules/toolbar/assets/claude-setup/05-plugins-add.webp +0 -0
  237. package/src/modules/toolbar/assets/claude-setup/06-add-marketplace.webp +0 -0
  238. package/src/modules/toolbar/assets/claude-setup/07-paste-url-sync.webp +0 -0
  239. package/src/modules/toolbar/assets/claude-setup/08-install-plugins.webp +0 -0
  240. package/src/modules/toolbar/assets/claude-setup/09-select-repository.webp +0 -0
  241. package/src/modules/toolbar/assets/claude-setup/10-connector-not-added.webp +0 -0
  242. package/src/modules/toolbar/assets/claude-setup/11-add-custom-connector.webp +0 -0
  243. package/src/modules/toolbar/assets/claude-setup/README.md +68 -0
  244. package/src/modules/toolbar/components/AgentInstructionsCard.tsx +296 -0
  245. package/src/modules/toolbar/components/ClaudeMarketplaceCarousel.tsx +107 -0
  246. package/src/modules/toolbar/components/ClaudeRegistrationSteps.tsx +127 -0
  247. package/src/modules/toolbar/components/CoworkSetupSteps.tsx +100 -0
  248. package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +395 -124
  249. package/src/modules/toolbar/components/ScreenshotStep.tsx +77 -0
  250. package/src/modules/toolbar/components/SetupCarousel.tsx +177 -0
  251. package/src/modules/toolbar/components/__tests__/AgentInstructionsCard.test.tsx +370 -0
  252. package/src/modules/toolbar/components/__tests__/ExternalAgentAccessPage.test.tsx +659 -36
  253. package/src/modules/toolbar/components/__tests__/Toolbar.test.tsx +2 -2
  254. package/src/modules/toolbar/components/__tests__/claude-setup-shots.test.ts +104 -0
  255. package/src/modules/toolbar/components/claude-connector-slide.tsx +38 -0
  256. package/src/modules/toolbar/components/claude-setup-shots.ts +167 -0
  257. package/src/modules/toolbar/components/deployment-address.ts +29 -0
  258. package/src/modules/toolbar/components/setup-step-parts.tsx +35 -0
  259. package/src/modules/toolbar/services/__tests__/agent-instructions.api.test.ts +89 -0
  260. package/src/modules/toolbar/services/agent-instructions.api.ts +167 -0
  261. package/src/modules/toolbar/services/external-api-keys.api.ts +8 -0
  262. package/src/modules/workflow/state/ChangeRequestStaleBinder.tsx +43 -0
  263. package/src/modules/workflow/state/EventBusProvider.tsx +122 -11
  264. package/src/modules/workflow/state/__tests__/EventBusProvider.storage.test.tsx +87 -0
  265. package/src/modules/workflow/state/__tests__/EventBusProvider.watch.test.tsx +223 -0
  266. package/src/modules/workflow/state/event-bus.context.ts +10 -0
  267. package/src/modules/workspace/__tests__/testFixtures.ts +6 -3
  268. package/src/modules/workspace/components/FileExplorer.tsx +1527 -367
  269. package/src/modules/workspace/components/FileRoute.tsx +376 -22
  270. package/src/modules/workspace/components/FileViewer.tsx +166 -45
  271. package/src/modules/workspace/components/KbDocumentShell.tsx +50 -6
  272. package/src/modules/workspace/components/KbPageHeader.tsx +120 -55
  273. package/src/modules/workspace/components/TreeActionConfirm.tsx +350 -0
  274. package/src/modules/workspace/components/__tests__/FileExplorer.test.tsx +2473 -129
  275. package/src/modules/workspace/components/__tests__/FileRoute.test.tsx +768 -16
  276. package/src/modules/workspace/components/__tests__/FileViewer.test.tsx +332 -12
  277. package/src/modules/workspace/components/__tests__/KbDocumentShell.test.tsx +39 -0
  278. package/src/modules/workspace/components/__tests__/KbPageHeader.test.tsx +33 -20
  279. package/src/modules/workspace/components/renderers/DocxRenderer.tsx +4 -5
  280. package/src/modules/workspace/components/renderers/DownloadFileButton.tsx +13 -4
  281. package/src/modules/workspace/components/renderers/EmailRenderer.tsx +4 -3
  282. package/src/modules/workspace/components/renderers/HtmlRenderer.tsx +8 -14
  283. package/src/modules/workspace/components/renderers/ImageRenderer.tsx +75 -16
  284. package/src/modules/workspace/components/renderers/KbImage.tsx +180 -0
  285. package/src/modules/workspace/components/renderers/KbMarkdownView.tsx +22 -6
  286. package/src/modules/workspace/components/renderers/MarkdownRenderer.tsx +48 -22
  287. package/src/modules/workspace/components/renderers/PdfRenderer.tsx +4 -5
  288. package/src/modules/workspace/components/renderers/PptxRenderer.tsx +4 -3
  289. package/src/modules/workspace/components/renderers/XlsxRenderer.tsx +4 -3
  290. package/src/modules/workspace/components/renderers/__tests__/DocxRenderer.test.tsx +12 -0
  291. package/src/modules/workspace/components/renderers/__tests__/DownloadFileButton.test.tsx +57 -9
  292. package/src/modules/workspace/components/renderers/__tests__/EmailRenderer.test.tsx +13 -1
  293. package/src/modules/workspace/components/renderers/__tests__/ImageRenderer.test.tsx +163 -0
  294. package/src/modules/workspace/components/renderers/__tests__/KbMarkdownView.test.tsx +237 -0
  295. package/src/modules/workspace/components/renderers/__tests__/MarkdownRenderer.test.tsx +108 -14
  296. package/src/modules/workspace/components/renderers/__tests__/PptxRenderer.test.tsx +14 -1
  297. package/src/modules/workspace/components/renderers/__tests__/XlsxRenderer.test.tsx +16 -1
  298. package/src/modules/workspace/components/renderers/__tests__/rendererSelection.test.tsx +66 -1
  299. package/src/modules/workspace/components/renderers/index.ts +53 -2
  300. package/src/modules/workspace/components/renderers/kbMarkdownPipeline.tsx +25 -4
  301. package/src/modules/workspace/components/renderers/rendererWorkspace.ts +40 -0
  302. package/src/modules/workspace/hooks/__tests__/useImageRevision.test.tsx +174 -0
  303. package/src/modules/workspace/hooks/__tests__/useOpenChangeRequests.test.tsx +179 -1
  304. package/src/modules/workspace/hooks/__tests__/useWorkspaceImageResolver.test.tsx +122 -0
  305. package/src/modules/workspace/hooks/__tests__/useWorkspaceState.test.tsx +892 -7
  306. package/src/modules/workspace/hooks/useImageRevision.ts +101 -0
  307. package/src/modules/workspace/hooks/useMergedWorkspaceTree.ts +89 -0
  308. package/src/modules/workspace/hooks/useWorkspaceImageResolver.ts +55 -0
  309. package/src/modules/workspace/hooks/useWorkspaceState.ts +438 -66
  310. package/src/modules/workspace/routing/__tests__/kb-routes.test.tsx +279 -3
  311. package/src/modules/workspace/routing/kb-routes.ts +207 -30
  312. package/src/modules/workspace/services/__tests__/workspace.api.test.ts +57 -1
  313. package/src/modules/workspace/services/workspace.api.ts +57 -4
  314. package/src/modules/workspace/state/__tests__/applied-request-clears-pending.test.tsx +343 -0
  315. package/src/modules/workspace/state/__tests__/upload-lands-where-it-was-dropped.test.tsx +158 -0
  316. package/src/modules/workspace/state/open-change-requests.tsx +100 -12
  317. package/src/modules/workspace/state/workspace.context.ts +130 -16
  318. package/src/modules/workspace/utils/__tests__/file-trace.test.ts +73 -0
  319. package/src/modules/workspace/utils/__tests__/fileTree.test.ts +234 -5
  320. package/src/modules/workspace/utils/__tests__/pasteLink.test.ts +76 -0
  321. package/src/modules/workspace/utils/__tests__/treeConfirm.test.ts +364 -0
  322. package/src/modules/workspace/utils/__tests__/uploadError.test.ts +35 -0
  323. package/src/modules/workspace/utils/file-trace.ts +50 -0
  324. package/src/modules/workspace/utils/fileTree.ts +126 -52
  325. package/src/modules/workspace/utils/frontmatter.ts +8 -4
  326. package/src/modules/workspace/utils/pasteLink.ts +90 -0
  327. package/src/modules/workspace/utils/treeConfirm.ts +338 -0
  328. package/src/modules/workspace/utils/uploadError.ts +29 -0
  329. package/src/shared/__tests__/marketplace-url.test.ts +59 -0
  330. package/src/shared/components/Badge.tsx +3 -1
  331. package/src/shared/components/Banner.tsx +5 -1
  332. package/src/shared/components/Button.tsx +16 -2
  333. package/src/shared/components/Dialog.tsx +27 -11
  334. package/src/shared/components/Menu.tsx +13 -1
  335. package/src/shared/components/PageShell.tsx +13 -8
  336. package/src/shared/components/__tests__/primitives.test.tsx +116 -2
  337. package/src/shared/components/__tests__/useFocusHandoff.test.tsx +192 -0
  338. package/src/shared/components/index.ts +2 -0
  339. package/src/shared/components/useDismissableMenu.ts +32 -10
  340. package/src/shared/components/useFocusHandoff.ts +51 -0
  341. package/src/shared/components/useLatestRef.ts +28 -0
  342. package/src/shared/markdown/Markdown.tsx +12 -3
  343. package/src/shared/markdown/__tests__/escapeSpacesInLinkDestinations.test.ts +39 -0
  344. package/src/shared/markdown/hrefs.ts +50 -0
  345. package/src/shared/marketplace-url.ts +118 -0
  346. package/src/shared/mcp/ChatGptInstallLink.tsx +3 -3
  347. package/src/shared/mcp/ConnectionInstructions.tsx +38 -27
  348. package/src/shared/mcp/__tests__/connect-snippets.test.ts +3 -3
  349. package/src/shared/mcp/connect-snippets.ts +14 -9
  350. package/src/shared/mcp/index.ts +1 -1
  351. package/src/shared/theme/__tests__/header-band.test.ts +197 -0
  352. package/src/shared/theme/header.ts +75 -0
  353. package/src/shared/theme/measure.ts +7 -4
  354. package/src/shared/theme/tokens.css +34 -0
  355. package/src/modules/library/__tests__/PluginsIndexPage.test.tsx +0 -363
  356. package/src/modules/library/__tests__/PluginsSidebar.locked.test.tsx +0 -97
  357. package/src/modules/library/components/PluginsIndexPage.tsx +0 -265
  358. package/src/modules/update-check/__tests__/UpdateBanner.test.tsx +0 -126
  359. package/src/modules/update-check/components/UpdateBanner.tsx +0 -92
  360. package/src/modules/update-check/services/update-check.api.ts +0 -24
@@ -15,13 +15,22 @@ const DEFAULT_PLUGINS: RemarkPlugins = [remarkGfm];
15
15
  // agent emits paths like this routinely (KB filenames contain spaces). Wrap
16
16
  // any unwrapped destination that contains a space in `<...>`, which CommonMark
17
17
  // accepts. Skips destinations that already start with `<` so we don't
18
- // double-wrap.
18
+ // double-wrap. The same tail serves an image: `![alt](Some Shot.png)`.
19
19
  const LINK_WITH_SPACE_RE = /(\[[^\]\n]*\])\(([^<\s)][^)\n]*)\)/g;
20
20
 
21
+ // A destination may end in a title: `path "title"` or `path 'title'`. The
22
+ // title is the one place a space is legal, so it is split off before the path
23
+ // is judged and wrapped; wrapping the whole thing (`<path "title">`) used to
24
+ // turn the title into part of the path and lose it.
25
+ const TRAILING_TITLE_RE = /^(.*?)(\s+(?:"[^"]*"|'[^']*'))$/;
26
+
21
27
  export function escapeSpacesInLinkDestinations(markdown: string): string {
22
28
  return markdown.replace(LINK_WITH_SPACE_RE, (match, label, destination) => {
23
- if (!destination.includes(' ')) return match;
24
- return `${label}(<${destination}>)`;
29
+ const titled = (destination as string).match(TRAILING_TITLE_RE);
30
+ const path = titled ? titled[1] : destination;
31
+ const title = titled ? titled[2] : '';
32
+ if (!path.includes(' ')) return match;
33
+ return `${label}(<${path}>${title})`;
25
34
  });
26
35
  }
27
36
 
@@ -0,0 +1,39 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { escapeSpacesInLinkDestinations } from '../Markdown';
3
+
4
+ /**
5
+ * The pre-parse that lets a KB link or image reach a file whose name has
6
+ * spaces in it. Every KB markdown surface runs it, so what it does to a
7
+ * destination is what the reader gets.
8
+ */
9
+ describe('escapeSpacesInLinkDestinations', () => {
10
+ it('wraps a destination with spaces in angle brackets, for links and images alike', () => {
11
+ expect(escapeSpacesInLinkDestinations('[Foo](Some File.md)')).toBe('[Foo](<Some File.md>)');
12
+ expect(escapeSpacesInLinkDestinations('![Shot](./assets/Approval screen.png)')).toBe(
13
+ '![Shot](<./assets/Approval screen.png>)',
14
+ );
15
+ });
16
+
17
+ it('leaves a destination without spaces, or one already wrapped, alone', () => {
18
+ expect(escapeSpacesInLinkDestinations('[Foo](Some-File.md)')).toBe('[Foo](Some-File.md)');
19
+ expect(escapeSpacesInLinkDestinations('[Foo](<Some File.md>)')).toBe('[Foo](<Some File.md>)');
20
+ });
21
+
22
+ // A title is the one place a space is legal in a destination. Wrapping the
23
+ // whole tail (`<path "title">`) used to make the title part of the path and
24
+ // lose it as a title; the path is what gets wrapped, the title stays outside.
25
+ it('wraps only the path of a titled destination and keeps the title', () => {
26
+ expect(escapeSpacesInLinkDestinations('![Shot](./assets/Approval screen.png "The approval screen")')).toBe(
27
+ '![Shot](<./assets/Approval screen.png> "The approval screen")',
28
+ );
29
+ expect(escapeSpacesInLinkDestinations("[Foo](Some File.md 'A note')")).toBe(
30
+ "[Foo](<Some File.md> 'A note')",
31
+ );
32
+ });
33
+
34
+ it('does not wrap a plain path just because its title has spaces', () => {
35
+ expect(escapeSpacesInLinkDestinations('![Shot](./assets/shot.png "The approval screen")')).toBe(
36
+ '![Shot](./assets/shot.png "The approval screen")',
37
+ );
38
+ });
39
+ });
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Whether a link or image destination leaves the workspace: anything with a
3
+ * scheme (`https:`, `mailto:`, `sms:`, `geo:`, an app's own
4
+ * `x-devonthink-item:`), or protocol-relative (`//cdn.example.com/…`).
5
+ * Everything else is a path in the workspace.
6
+ *
7
+ * A bare name with a colon in it (`Notes: today.md`) reads as a scheme too,
8
+ * as it does to a browser, and that is fine: react-markdown's URL transform
9
+ * and rehype-sanitize both drop an href whose scheme they do not know before
10
+ * the pipeline sees it, the frontmatter panel applies the same transform to
11
+ * its own links, and an HTML file's anchor is parsed by the browser, which
12
+ * agrees. So such a name cannot reach us as a link. A path with a segment
13
+ * before the colon (`./Notes: today.md`, `Knowledge/Notes: today.md`) starts
14
+ * with a character no scheme may contain and stays a workspace path.
15
+ *
16
+ * Shared by the routing module (link resolution) and the markdown pipeline
17
+ * (image sources), which must not import each other: the pipeline is bundled
18
+ * into the enterprise embed, which has no router.
19
+ */
20
+ export function isExternalHref(href: string): boolean {
21
+ return /^[a-z][a-z0-9+.-]*:/i.test(href) || href.startsWith('//');
22
+ }
23
+
24
+ /**
25
+ * The schemes an external destination may be OPENED with. `isExternalHref`
26
+ * answers "does this leave the workspace"; this answers "may we hand it to
27
+ * `window.open`", and the two are not the same question.
28
+ *
29
+ * `window.open('javascript:…')` runs the script in a document that inherits
30
+ * the OPENER's origin — so an allowlist here is what keeps the HTML sandbox a
31
+ * sandbox. Agent HTML gets `globalThis.bevel.navigate(anyString)`, which posts
32
+ * straight to the host; sanitising the anchor hrefs in the document is not
33
+ * enough when a script can call the bridge directly.
34
+ *
35
+ * Protocol-relative (`//cdn.example.com/…`) has no scheme to check and resolves
36
+ * against the page's own — always http(s) here — so it is allowed.
37
+ *
38
+ * The list mirrors the schemes `isExternalHref` names as ordinary external
39
+ * destinations. An exotic app scheme (`x-devonthink-item:`) is NOT on it and
40
+ * stays a dead click, as it is today. Adding one is a deliberate decision,
41
+ * not a default.
42
+ */
43
+ const OPENABLE_SCHEMES = new Set(['http:', 'https:', 'mailto:', 'tel:', 'sms:', 'geo:']);
44
+
45
+ export function isOpenableExternalHref(href: string): boolean {
46
+ if (href.startsWith('//')) return true;
47
+ const colon = href.indexOf(':');
48
+ if (colon < 0) return false;
49
+ return OPENABLE_SCHEMES.has(href.slice(0, colon + 1).toLowerCase());
50
+ }
@@ -0,0 +1,118 @@
1
+ /**
2
+ * The per-user marketplace git remote, as `/api/config` names it — the same
3
+ * "configured at boot, read through a function" shape as `mcpEndpointUrl`
4
+ * (see `shared/mcp/connect-snippets.ts` for why a module-scope constant would
5
+ * snapshot the wrong value).
6
+ *
7
+ * The URL never carries a credential: the person adds their own connection
8
+ * key when they paste the command, and `withConnectionKey` is how the
9
+ * settings card composes that.
10
+ */
11
+
12
+ const GIT_PATH = '/git/marketplace.git';
13
+
14
+ let configured: string | null = null;
15
+
16
+ /** Record what the server said; absent or unusable falls back to the origin. */
17
+ export function configureMarketplaceGitUrl(url: unknown): void {
18
+ if (typeof url !== 'string' || url.trim() === '') {
19
+ configured = null;
20
+ return;
21
+ }
22
+ try {
23
+ const parsed = new URL(url);
24
+ if (parsed.protocol !== 'https:' && parsed.protocol !== 'http:') {
25
+ configured = null;
26
+ return;
27
+ }
28
+ parsed.username = '';
29
+ parsed.password = '';
30
+ configured = parsed.toString();
31
+ } catch {
32
+ configured = null;
33
+ }
34
+ }
35
+
36
+ /** The remote to show people, without any credential. */
37
+ export function marketplaceGitUrl(): string {
38
+ return configured ?? `${window.location.origin}${GIT_PATH}`;
39
+ }
40
+
41
+ /**
42
+ * The remote with a connection key in the userinfo — what git sends as HTTP
43
+ * Basic, and what Claude Code's background refresh needs because it disables
44
+ * credential helpers. `key` is the placeholder when the person has not
45
+ * minted one yet.
46
+ *
47
+ * Spliced as TEXT, not set through `URL.password`: the URL parser
48
+ * percent-encodes what it is given, and the placeholder `<external-api-key>`
49
+ * came out as `%3Cexternal-api-key%3E` — a thing to paste that looks like a
50
+ * secret. A real key never needs encoding: it is a tenant prefix plus base64url,
51
+ * all of it URL-safe by construction.
52
+ */
53
+ export function withConnectionKey(key: string): string {
54
+ const { protocol, host, pathname } = new URL(marketplaceGitUrl());
55
+ return `${protocol}//key:${key}@${host}${pathname}`;
56
+ }
57
+
58
+ /** The marketplace's registered name — what `plugin@<name>` refers to in Claude Code. */
59
+ export const MARKETPLACE_NAME = 'hexis';
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
+ */
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';
75
+
76
+ /**
77
+ * The KIND stored on a connection key minted when a person connects an
78
+ * account on a product that treats this deployment as a GitHub Enterprise
79
+ * host (claude.ai, Cowork) — the backend's `GITHUB_LINK_KEY_KIND`, spelled
80
+ * once more here so the key list can tell those links from keys people
81
+ * created by hand. The kind, never the label: a label is free text anyone
82
+ * can type.
83
+ */
84
+ export const GITHUB_LINK_KIND = 'github-link';
85
+
86
+ /**
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.
96
+ */
97
+ export function marketplaceCommands(key: string): { claude: string; codex: string; skills: string } {
98
+ const url = withConnectionKey(key);
99
+ return {
100
+ claude: `claude plugin marketplace add ${url} && claude plugin install ${BUNDLE_PLUGIN}@${MARKETPLACE_NAME}`,
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'),
107
+ skills: `npx skills add ${url} --all -y`,
108
+ };
109
+ }
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
+
115
+ /** For tests — module-global state must not leak between them. */
116
+ export function resetMarketplaceGitUrlForTests(): void {
117
+ configured = null;
118
+ }
@@ -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
+ });