@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
@@ -0,0 +1,296 @@
1
+ import { useCallback, useContext, useEffect, useRef, useState } from 'react';
2
+ import { Pencil } from 'lucide-react';
3
+ import { AdminContext } from '../../admin/state/admin.context';
4
+ import { WorkspaceContext } from '../../workspace/state/workspace.context';
5
+ import { Button } from '../../../shared/components';
6
+ import { Markdown } from '../../../shared/markdown/Markdown';
7
+ import {
8
+ PREAMBLE_CAP,
9
+ PREAMBLE_FILE,
10
+ TOOL_PREFIX_CAP,
11
+ fetchEditableAgentDescription,
12
+ fetchAgentInstructions,
13
+ saveAgentDescription,
14
+ sourceHasUnterminatedComment,
15
+ type AgentInstructions,
16
+ type EditableAgentDescription,
17
+ } from '../services/agent-instructions.api';
18
+
19
+ type State =
20
+ | { status: 'loading' }
21
+ | { status: 'error'; message: string }
22
+ | { status: 'ready'; data: AgentInstructions };
23
+
24
+ /** `1,240 / 6,000 characters`, the same count the server truncates on. */
25
+ function count(n: number, cap: number): string {
26
+ return `${n.toLocaleString('en-US')} / ${cap.toLocaleString('en-US')} characters`;
27
+ }
28
+
29
+ // `text-ink`, not `text-wait`: tokens.css marks `wait` too light for text on
30
+ // its own soft ground (2.63:1). Same pairing as Banner's `wait` tone.
31
+ const WARNING = 'text-meta text-ink bg-wait-soft border border-wait rounded-sm px-2 py-1.5';
32
+ const BOX = 'text-xs bg-sunken border border-line rounded-sm px-2.5 py-2';
33
+ /**
34
+ * The description is a preview at the page's own size, not a document: the
35
+ * prose defaults would render a `##` twice the size of everything around it.
36
+ */
37
+ const DESCRIPTION_MARKDOWN =
38
+ 'text-xs leading-snug [&_h1]:text-xs [&_h2]:text-xs [&_h3]:text-xs [&_h4]:text-xs ' +
39
+ '[&_h1]:font-medium [&_h2]:font-medium [&_h3]:font-medium [&_h4]:font-medium ' +
40
+ '[&_h1]:mt-2.5 [&_h2]:mt-2.5 [&_h3]:mt-2 [&_h4]:mt-2 [&_h1]:mb-1 [&_h2]:mb-1 [&_h3]:mb-1 [&_h4]:mb-1 ' +
41
+ '[&_p]:my-1.5 [&_ul]:my-1.5 [&_ol]:my-1.5 [&_li]:my-0.5';
42
+
43
+ /**
44
+ * "What agents are told about this knowledge base": the text every MCP
45
+ * session starts with, organised around the part the admin owns. The fixed
46
+ * platform message sits in a closed drawer (it is sent first, and nobody here
47
+ * can change it); the admin's description is the centrepiece, with its count
48
+ * against the cap right beside it.
49
+ *
50
+ * Sits in its own card below connection setup: it applies to every connection
51
+ * type, but it is a separate administrative concern rather than part of the
52
+ * user's setup flow.
53
+ *
54
+ * Both contexts are read WITHOUT their hooks' provider guard: the page renders
55
+ * in tests and in shells that mount no admin or workspace provider, and a
56
+ * card that throws there would take the whole page with it. Absent admin
57
+ * context means no Edit action; absent `kbDirName` means no Edit action yet.
58
+ */
59
+ export function AgentInstructionsCard() {
60
+ const isAdmin = useContext(AdminContext)?.isAdmin ?? false;
61
+ const kbDirName = useContext(WorkspaceContext)?.kbDirName ?? null;
62
+ const [state, setState] = useState<State>({ status: 'loading' });
63
+ const [editor, setEditor] = useState<(EditableAgentDescription & { value: string }) | null>(null);
64
+ const [editBusy, setEditBusy] = useState<'loading' | 'saving' | null>(null);
65
+ const [editError, setEditError] = useState<string | null>(null);
66
+
67
+ /**
68
+ * Only the NEWEST composed-preview request may land, and only while the
69
+ * card is mounted. Two requests are in flight together whenever an admin
70
+ * edits and saves before the first load answers, and the older one
71
+ * resolving last would put the pre-save text back on the page as though
72
+ * the save had not happened.
73
+ *
74
+ * Mounted is tracked separately from the ticket rather than folded into it:
75
+ * a save in flight at unmount starts its own refresh AFTERWARDS, which
76
+ * takes a fresh ticket and would pass any ticket comparison. The flag is
77
+ * re-armed on the way in, so a remount (StrictMode's double-invoke among
78
+ * them) is a mounted card again.
79
+ */
80
+ const previewRequest = useRef(0);
81
+ const mounted = useRef(true);
82
+ const loadInstructions = useCallback((whenFailed: (err: unknown) => string): Promise<void> => {
83
+ const ticket = ++previewRequest.current;
84
+ const isCurrent = (): boolean => mounted.current && ticket === previewRequest.current;
85
+ return fetchAgentInstructions().then(
86
+ (data) => {
87
+ if (isCurrent()) setState({ status: 'ready', data });
88
+ },
89
+ (err: unknown) => {
90
+ if (isCurrent()) setState({ status: 'error', message: whenFailed(err) });
91
+ },
92
+ );
93
+ }, []);
94
+
95
+ useEffect(() => {
96
+ mounted.current = true;
97
+ void loadInstructions((err) =>
98
+ err instanceof Error ? err.message : "Couldn't load what agents are told.",
99
+ );
100
+ return () => {
101
+ mounted.current = false;
102
+ previewRequest.current += 1;
103
+ };
104
+ }, [loadInstructions]);
105
+
106
+ // The editor is offered only once the KB dir name is known: the save path
107
+ // otherwise has a missing segment and cannot safely target the source file.
108
+ // Any falsy name, not just null, so the offer matches `beginEdit`'s guard.
109
+ const canEdit = isAdmin && Boolean(kbDirName);
110
+
111
+ const beginEdit = async () => {
112
+ if (!kbDirName || editBusy) return;
113
+ setEditError(null);
114
+ setEditBusy('loading');
115
+ try {
116
+ const editable = await fetchEditableAgentDescription(kbDirName);
117
+ setEditor({ ...editable, value: editable.description });
118
+ } catch (err) {
119
+ setEditError(err instanceof Error ? err.message : "Couldn't load the description editor.");
120
+ } finally {
121
+ setEditBusy(null);
122
+ }
123
+ };
124
+
125
+ const saveEdit = async () => {
126
+ if (!kbDirName || !editor || editBusy) return;
127
+ setEditError(null);
128
+ setEditBusy('saving');
129
+ try {
130
+ await saveAgentDescription(editor.workspaceId, kbDirName, editor.source, editor.value);
131
+ } catch (err) {
132
+ setEditError(err instanceof Error ? err.message : "Couldn't save the description.");
133
+ setEditBusy(null);
134
+ return;
135
+ }
136
+
137
+ // The write has landed. Close the editor even if refreshing the composed
138
+ // preview fails, so a successful save is never presented as unsaved work.
139
+ setEditor(null);
140
+ await loadInstructions(
141
+ (err) =>
142
+ `Description saved, but the preview couldn't refresh: ${err instanceof Error ? err.message : 'unknown error'}`,
143
+ );
144
+ setEditBusy(null);
145
+ };
146
+
147
+ // The open comment lives in the part the editor does not show, so the
148
+ // visible text can be identical while the file is still withholding
149
+ // everything after the `<!--`. Saving is what closes it
150
+ // (`mergeEditableDescription`), so Save has to be reachable with the text
151
+ // unchanged — otherwise the warning names a repair the admin cannot make,
152
+ // in a file this PR hides from the tree.
153
+ const openCommentInSource = editor !== null && sourceHasUnterminatedComment(editor.source);
154
+ const nothingToSave = editor !== null && editor.value === editor.description && !openCommentInSource;
155
+
156
+ const displayedPreambleChars = editor ? editor.value.trim().length : state.status === 'ready' ? state.data.preambleChars : 0;
157
+ const displayedPreambleTruncated = editor ? displayedPreambleChars > PREAMBLE_CAP : state.status === 'ready' && state.data.truncated;
158
+ return (
159
+ <section
160
+ className="bg-white border border-line rounded-lg px-4 py-3 space-y-3"
161
+ aria-labelledby="agent-instructions-title"
162
+ data-testid="agent-instructions-section"
163
+ >
164
+ <div className="flex items-center justify-between gap-3">
165
+ <h2 id="agent-instructions-title" className="text-xs font-medium text-ink">
166
+ What agents are told about this knowledge base
167
+ </h2>
168
+ {canEdit && !editor && (
169
+ <Button
170
+ size="sm"
171
+ leadingIcon={<Pencil size={12} />}
172
+ onClick={() => void beginEdit()}
173
+ disabled={editBusy !== null}
174
+ >
175
+ {editBusy === 'loading' ? 'Loading editor…' : 'Edit description'}
176
+ </Button>
177
+ )}
178
+ </div>
179
+ <p className="text-meta text-ink-muted leading-snug">
180
+ Every agent that connects, on either tab, gets this at the start of each session, whatever it may read in
181
+ the repository. A fixed platform message goes first, then your description of what is here.
182
+ </p>
183
+
184
+ {state.status === 'loading' && <p className="text-meta text-ink-muted">Loading…</p>}
185
+ {state.status === 'error' && (
186
+ <div role="alert" className="text-xs text-danger bg-danger-soft border border-danger rounded-sm px-2 py-1.5">
187
+ {state.message}
188
+ </div>
189
+ )}
190
+ {editError && (
191
+ <div role="alert" className="text-xs text-danger bg-danger-soft border border-danger rounded-sm px-2 py-1.5">
192
+ {editError}
193
+ </div>
194
+ )}
195
+ {(state.status === 'ready' || editor) && (
196
+ <div className="space-y-3">
197
+ {state.status === 'ready' && (
198
+ <details className="border border-line rounded-sm">
199
+ <summary className="cursor-pointer px-2.5 py-1.5 text-xs text-ink-muted">
200
+ Platform message (fixed, sent first)
201
+ </summary>
202
+ <p className="px-2.5 pb-2 text-xs text-ink-muted leading-snug whitespace-pre-wrap" data-testid="header-text">
203
+ {state.data.header}
204
+ </p>
205
+ </details>
206
+ )}
207
+
208
+ <div className="space-y-1.5">
209
+ <div className="flex items-baseline justify-between gap-2">
210
+ <h3 className="text-xs font-medium text-ink">Your description</h3>
211
+ <span
212
+ className={`text-meta ${displayedPreambleTruncated ? 'text-wait' : 'text-ink-muted'}`}
213
+ data-testid="preamble-count"
214
+ >
215
+ {count(displayedPreambleChars, PREAMBLE_CAP)}
216
+ </span>
217
+ </div>
218
+ {displayedPreambleTruncated && (
219
+ <p role="alert" className={WARNING}>
220
+ Over the cap: agents receive only the first {PREAMBLE_CAP.toLocaleString('en-US')} characters. Shorten
221
+ the description.
222
+ </p>
223
+ )}
224
+ {state.status === 'ready' && state.data.unterminatedComment && (
225
+ <p role="alert" className={WARNING}>
226
+ A comment is left open: everything after the last <span className="font-mono">&lt;!--</span> is withheld
227
+ from agents.{' '}
228
+ {canEdit
229
+ ? 'Open the editor and save: the comment is closed for you, and the text below is sent as it stands.'
230
+ : `An admin can close it from this page, or with --> in ${PREAMBLE_FILE} in the repository.`}
231
+ </p>
232
+ )}
233
+ {state.status === 'ready' && state.data.toolPrefixTruncated && (
234
+ <p role="alert" className={WARNING}>
235
+ The fixed line and your first paragraph are also sent together at the start of four knowledge-base tool
236
+ descriptions, and together they are over that channel's{' '}
237
+ {TOOL_PREFIX_CAP.toLocaleString('en-US')}-character cap
238
+ ({state.data.toolPrefixChars.toLocaleString('en-US')}): the end is cut off for the clients that read
239
+ only tool descriptions, claude.ai on the web, the Agent SDK and Cline among them. Clients that honour
240
+ the handshake, such as Claude Code, Claude Desktop and Cursor, get the whole description above instead
241
+ and are unaffected. Shorten the first paragraph.
242
+ </p>
243
+ )}
244
+ {editor ? (
245
+ <div className="space-y-2">
246
+ <textarea
247
+ aria-label="Your description"
248
+ className={`${BOX} block w-full min-h-[44px] max-h-56 [field-sizing:content] resize-y leading-snug text-ink focus:outline-2 focus:outline-offset-1 focus:outline-ink-muted`}
249
+ rows={1}
250
+ value={editor.value}
251
+ onChange={(event) => setEditor({ ...editor, value: event.target.value })}
252
+ placeholder="Describe what this knowledge base holds, what is where, and when agents should look here first."
253
+ autoFocus
254
+ />
255
+ <div className="flex items-center justify-end gap-2">
256
+ <Button
257
+ size="sm"
258
+ variant="quiet"
259
+ onClick={() => {
260
+ setEditor(null);
261
+ setEditError(null);
262
+ }}
263
+ disabled={editBusy === 'saving'}
264
+ >
265
+ Cancel
266
+ </Button>
267
+ <Button
268
+ size="sm"
269
+ variant="primary"
270
+ onClick={() => void saveEdit()}
271
+ disabled={editBusy === 'saving' || nothingToSave}
272
+ >
273
+ {editBusy === 'saving'
274
+ ? 'Saving…'
275
+ : openCommentInSource && editor.value === editor.description
276
+ ? 'Save and close the comment'
277
+ : 'Save description'}
278
+ </Button>
279
+ </div>
280
+ </div>
281
+ ) : state.status === 'ready' && state.data.preamble ? (
282
+ <div className={`${BOX} max-h-56 overflow-y-auto overflow-x-hidden break-words`} data-testid="description-text">
283
+ <Markdown className={DESCRIPTION_MARKDOWN}>{state.data.preamble}</Markdown>
284
+ </div>
285
+ ) : (
286
+ <p className={`${BOX} text-ink-muted leading-snug`} data-testid="description-empty">
287
+ Nothing written yet, so agents get the platform message only. Describe what this knowledge base holds,
288
+ what is where, and when to look here first.
289
+ </p>
290
+ )}
291
+ </div>
292
+ </div>
293
+ )}
294
+ </section>
295
+ );
296
+ }
@@ -0,0 +1,107 @@
1
+ import { SetupCarousel, type CarouselSlide } from './SetupCarousel';
2
+ import { connectorSlide } from './claude-connector-slide';
3
+ import {
4
+ addMarketplaceShot,
5
+ installPluginsShot,
6
+ pasteUrlShot,
7
+ pluginsAddShot,
8
+ selectRepositoryShot,
9
+ } from './claude-setup-shots';
10
+
11
+ const CLAUDE_CODE_WEB = 'https://claude.ai/code';
12
+ const CLAUDE_WEB = 'https://claude.ai';
13
+
14
+ function slides(host: string): CarouselSlide[] {
15
+ return [
16
+ {
17
+ shortLabel: 'Connect',
18
+ stage: 'Connect your account',
19
+ title: 'Select this deployment in Claude Code',
20
+ instruction: (
21
+ <>
22
+ Open{' '}
23
+ <a
24
+ href={CLAUDE_CODE_WEB}
25
+ target="_blank"
26
+ rel="noopener noreferrer"
27
+ className="underline text-ink-muted hover:text-ink"
28
+ >
29
+ Claude Code on the web↗
30
+ </a>
31
+ . You do not need to start a coding task. Choose <b>Select repository</b>, then click{' '}
32
+ <b>Connect to URL</b> and select <b>{host}</b>. Do not use <b>Connect to GitHub</b> — that
33
+ signs you in to github.com instead. Approve the sign-in here and Claude returns you to the
34
+ repository picker.
35
+ </>
36
+ ),
37
+ shots: [selectRepositoryShot],
38
+ },
39
+ {
40
+ shortLabel: 'Plugins',
41
+ stage: 'Add the marketplace',
42
+ title: 'Open the Plugins menu',
43
+ instruction: (
44
+ <>
45
+ Back in Cowork or on{' '}
46
+ <a
47
+ href={CLAUDE_WEB}
48
+ target="_blank"
49
+ rel="noopener noreferrer"
50
+ className="underline text-ink-muted hover:text-ink"
51
+ >
52
+ claude.ai↗
53
+ </a>
54
+ , open <b>Customize</b>, select the <b>Plugins</b> tab, then choose <b>Add</b>.
55
+ </>
56
+ ),
57
+ shots: [pluginsAddShot],
58
+ },
59
+ {
60
+ shortLabel: 'Marketplace',
61
+ stage: 'Add the marketplace',
62
+ title: 'Choose Add marketplace',
63
+ instruction: (
64
+ <>
65
+ In the Add menu, choose <b>Add marketplace</b>. This opens the field where Claude can
66
+ fetch this deployment's plugin catalog.
67
+ </>
68
+ ),
69
+ shots: [addMarketplaceShot],
70
+ },
71
+ {
72
+ shortLabel: 'Sync',
73
+ stage: 'Add the marketplace',
74
+ title: 'Paste the URL and sync',
75
+ instruction: (
76
+ <>
77
+ Paste the <b>Marketplace URL</b> copied above into the URL field, then choose <b>Sync</b>.
78
+ Syncing makes the plugins available; it does not install them yet.
79
+ </>
80
+ ),
81
+ shots: [pasteUrlShot],
82
+ },
83
+ {
84
+ shortLabel: 'Install',
85
+ stage: 'Install the plugin',
86
+ title: 'Add Hexis all',
87
+ instruction: (
88
+ <>
89
+ Open <b>Discover</b> and choose the <b>Hexis all</b> row to install every skill you may
90
+ read, plus the knowledge base MCP server. The other rows are smaller subsets if you prefer
91
+ to pick. Use <b>Update</b> in Claude to pull changes later.
92
+ </>
93
+ ),
94
+ shots: [installPluginsShot],
95
+ },
96
+ connectorSlide,
97
+ ];
98
+ }
99
+
100
+ /**
101
+ * The non-admin path: connect the account, add the marketplace, install the
102
+ * plugin, then add the connector the plugin does not add for you. The shell
103
+ * is `SetupCarousel`, shared with the admin's registration steps.
104
+ */
105
+ export function ClaudeMarketplaceCarousel({ host }: { host: string }) {
106
+ return <SetupCarousel label="Set up the Claude marketplace" slides={slides(host)} />;
107
+ }
@@ -0,0 +1,127 @@
1
+ import { ClaudeConnectionCard } from '../../settings/components/ClaudeConnectionCard';
2
+ import { SetupCarousel, type CarouselSlide } from './SetupCarousel';
3
+ import { connectorSlide } from './claude-connector-slide';
4
+ import { Out, Prose } from './setup-step-parts';
5
+ import { deploymentHost, deploymentPort } from './deployment-address';
6
+ import {
7
+ addConfigurationShot,
8
+ addManuallyShot,
9
+ connectAccountShot,
10
+ pickInstanceShot,
11
+ } from './claude-setup-shots';
12
+
13
+ /** Where an Owner registers a GitHub Enterprise Server with the organization. */
14
+ const CLAUDE_CODE_ADMIN = 'https://claude.ai/admin-settings/claude-code';
15
+ /** Where an Owner connects their own account to a registered instance. */
16
+ const GITHUB_ADMIN = 'https://claude.ai/admin-settings/github';
17
+ /** The repository picker, which offers the same connection to everyone else. */
18
+ const CLAUDE_CODE_WEB = 'https://claude.ai/code';
19
+
20
+ function slides(host: string, opened: boolean): CarouselSlide[] {
21
+ return [
22
+ {
23
+ shortLabel: 'Add manually',
24
+ stage: 'Register the instance',
25
+ title: 'Register this deployment with your Claude organization',
26
+ instruction: (
27
+ <>
28
+ An Owner of your Claude organization does this once, on a Team or Enterprise plan. Open{' '}
29
+ <Out href={CLAUDE_CODE_ADMIN}>Admin settings → Claude Code</Out>, scroll to Self-hosted
30
+ infrastructure, and choose <b>Add manually</b> beside GitHub Enterprise.
31
+ </>
32
+ ),
33
+ shots: [addManuallyShot],
34
+ },
35
+ {
36
+ shortLabel: 'Configure',
37
+ stage: 'Register the instance',
38
+ title: 'Fill the form and add the configuration',
39
+ instruction: (
40
+ <>
41
+ Fill it from the fields below, which this deployment generated for exactly this form. Any
42
+ display name will do, the port is {deploymentPort()}, and read replicas stay empty. Choose{' '}
43
+ <b>Add configuration</b>. The webhook URL Claude shows afterwards can be ignored: nothing
44
+ here sends webhooks yet, and the private key is required by the form but unused by this
45
+ flow.
46
+ </>
47
+ ),
48
+ // Two gates, both required: the drawer is open, and this is the slide
49
+ // that asks for them. A closed <details> still mounts its children, so
50
+ // the first keeps a client secret out of a drawer nobody looked at;
51
+ // the carousel mounts only the active slide, so the second keeps it
52
+ // off the four slides that have no use for it.
53
+ extra: opened ? <ClaudeConnectionCard /> : null,
54
+ shots: [addConfigurationShot],
55
+ },
56
+ {
57
+ shortLabel: 'Connect',
58
+ stage: 'Connect your account',
59
+ title: 'Connect your own Claude account to it',
60
+ instruction: (
61
+ <>
62
+ Registering the instance signs nobody in, and Claude never prompts for this. Open{' '}
63
+ <Out href={GITHUB_ADMIN}>Admin settings → GitHub</Out> and choose <b>Connect</b>.
64
+ </>
65
+ ),
66
+ shots: [connectAccountShot],
67
+ },
68
+ {
69
+ shortLabel: 'Instance',
70
+ stage: 'Connect your account',
71
+ title: 'Pick this deployment as the GitHub instance',
72
+ instruction: (
73
+ <>
74
+ Under GitHub instance, pick {host} instead of github.com, then continue. You land on the
75
+ sign-in here: approve, and you are back in Claude. Everyone else does the same from the
76
+ repository picker on <Out href={CLAUDE_CODE_WEB}>claude.ai/code</Out>, which offers the
77
+ same instance.
78
+ </>
79
+ ),
80
+ shots: [pickInstanceShot],
81
+ },
82
+ connectorSlide,
83
+ ];
84
+ }
85
+
86
+ /**
87
+ * Registering this deployment with a Claude organization as a GitHub
88
+ * Enterprise Server: the admin's half of the Cowork route, which used to be
89
+ * the admin branch of the External agent access tutorial and now lives in
90
+ * the Marketplace section of Deployment configuration.
91
+ *
92
+ * A carousel on the same shell as the personal tutorial, rather than the
93
+ * ordered list this used to be: four full-size screenshots down a page is a
94
+ * wall, and the admin reading it is following one screen at a time anyway.
95
+ * The last slide is the shared connector step, the same one everybody else
96
+ * ends on.
97
+ *
98
+ * `opened` gates the credentials. A closed <details> still mounts its
99
+ * children, so without it every admin who scrolled past the section fetched
100
+ * a client secret and a private key into a drawer they never looked at.
101
+ * Secrets load when someone is reading the step that asks for them, not
102
+ * before — and now only while that step is the slide on screen.
103
+ *
104
+ * Admin HERE is not the same authority as Owner of the Claude organization:
105
+ * the copy names the Claude side explicitly so an admin without it knows who
106
+ * to hand step 1 to.
107
+ */
108
+ export function ClaudeRegistrationSteps({ opened }: { opened: boolean }) {
109
+ const host = deploymentHost();
110
+
111
+ return (
112
+ <div className="space-y-3">
113
+ <Prose>
114
+ Cowork and claude.ai install marketplaces only from GitHub, or from a GitHub Enterprise
115
+ Server your Claude organization has registered. This deployment answers as one. The four
116
+ registration steps are yours. Adding the marketplace is what every person here does next,
117
+ from External agent access — the connector at the end is on both lists, because it is the
118
+ same action.
119
+ </Prose>
120
+
121
+ {/* Not the drawer's own words. The <summary> above already reads
122
+ "Register this deployment with Claude", and a region nested inside
123
+ the control that carries that name would announce it twice. */}
124
+ <SetupCarousel label="Claude registration steps" slides={slides(host, opened)} />
125
+ </div>
126
+ );
127
+ }
@@ -0,0 +1,100 @@
1
+ import { useEffect, useState } from 'react';
2
+ import { Link } from 'react-router-dom';
3
+ import { Banner } from '../../../shared/components';
4
+ import { CopyBlock } from '../../../shared/mcp';
5
+ import { marketplaceGitUrl } from '../../../shared/marketplace-url';
6
+ import { fetchMarketplaceRegistration } from '../../settings/services/github-facade.api';
7
+ import { ClaudeMarketplaceCarousel } from './ClaudeMarketplaceCarousel';
8
+ import { Prose } from './setup-step-parts';
9
+ import { deploymentHost } from './deployment-address';
10
+
11
+ /**
12
+ * How a person installs this deployment's skills as plugins in Cowork and on
13
+ * claude.ai — the SAME tutorial for everyone, admin or not.
14
+ *
15
+ * Registering the deployment with a Claude organization is not a step anyone
16
+ * takes from here any more: it lives in the Marketplace section of Deployment
17
+ * configuration. What this page needs to know is only whether that happened,
18
+ * a boolean any signed-in person may read:
19
+ *
20
+ * - registered — the personal tutorial, identical for admins and everyone.
21
+ * - not registered — no tutorial, because its first screen would list no
22
+ * deployment. Everyone is told an admin has to configure the marketplace;
23
+ * an admin is also sent to the section that does it.
24
+ *
25
+ * `isAdmin` decides only the wording of that notice, never what the tutorial
26
+ * shows.
27
+ *
28
+ * The state is read each time the drawer OPENS, not on mount. A closed
29
+ * <details> still mounts its children, so reading on mount asked for it from
30
+ * everyone who merely switched tabs — and then never again, which left the
31
+ * "not set up yet" notice standing after an admin registered the deployment
32
+ * in another tab. Reading on open answers with what is true when someone
33
+ * looks; the last answer stays on screen while the next one arrives.
34
+ */
35
+ export function CoworkSetupSteps({ isAdmin, opened }: { isAdmin: boolean; opened: boolean }) {
36
+ const [registered, setRegistered] = useState<boolean | null>(null);
37
+ const [error, setError] = useState<string | null>(null);
38
+
39
+ useEffect(() => {
40
+ if (!opened) return;
41
+ let live = true;
42
+ fetchMarketplaceRegistration()
43
+ .then((r) => {
44
+ if (!live) return;
45
+ setError(null);
46
+ setRegistered(r);
47
+ })
48
+ .catch((err: unknown) => {
49
+ if (live) setError(err instanceof Error ? err.message : String(err));
50
+ });
51
+ return () => {
52
+ live = false;
53
+ };
54
+ }, [opened]);
55
+
56
+ if (error) {
57
+ return (
58
+ <Banner tone="danger" role="alert">
59
+ {error}
60
+ </Banner>
61
+ );
62
+ }
63
+ if (registered === null) return <div className="text-meta text-ink-muted">Loading…</div>;
64
+
65
+ if (!registered) {
66
+ return (
67
+ <Banner tone="wait" role="status" data-testid="marketplace-not-configured">
68
+ {isAdmin ? (
69
+ <>
70
+ Cowork and claude.ai are not set up for this deployment yet. Register it with your
71
+ Claude organization in the{' '}
72
+ <Link to="/deployment#marketplace" className="underline">
73
+ Marketplace section of Deployment settings
74
+ </Link>
75
+ , then mark it registered there. The steps for adding the marketplace appear here, for
76
+ everyone, once it is.
77
+ </>
78
+ ) : (
79
+ <>
80
+ Cowork and claude.ai are not set up for this deployment yet. An admin has to configure
81
+ the marketplace before you can add it there. Claude Code and Codex work already, below.
82
+ </>
83
+ )}
84
+ </Banner>
85
+ );
86
+ }
87
+
88
+ return (
89
+ <div className="space-y-3">
90
+ <Prose>
91
+ Cowork and claude.ai install marketplaces only from GitHub, or from a GitHub Enterprise
92
+ Server your Claude organization has registered. This deployment answers as one. An admin
93
+ here registers it once. If the first step does not list this deployment, ask an admin to
94
+ register it.
95
+ </Prose>
96
+ <CopyBlock label="Marketplace URL" value={marketplaceGitUrl()} rows={2} />
97
+ <ClaudeMarketplaceCarousel host={deploymentHost()} />
98
+ </div>
99
+ );
100
+ }