@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
@@ -1,17 +1,26 @@
1
- import { useMemo, useState } from 'react';
1
+ import { useCallback, useMemo, useState } from 'react';
2
2
  import { useNavigate } from 'react-router-dom';
3
+ import { DEFAULT_BRANCH, type FileTreeEntry } from '@bevel-software/platform-shared';
3
4
  import '../library.css';
4
5
  import { useLibrary, type LibraryItem } from '../state/library-data';
5
6
  import { urlForLibraryItem } from '../routes/library-paths';
6
7
  import { useWorkspace } from '../../workspace/state/workspace.context';
7
- import { emptyMessageFor, filterLibraryItems, type LibraryFilter } from '../utils/status';
8
+ import { EVERYONE_TEAM, emptyMessageFor, filterLibraryItems, type LibraryFilter } from '../utils/status';
9
+ import { pluginEntriesFor } from '../utils/plugin-entries';
10
+ import { personalPluginName } from '../utils/personal-plugin';
8
11
  import { Banner, TextField } from '../../../shared/components';
12
+ import { cn } from '../../../lib/utils';
13
+ import { HEADER_BAND, PAGE_HEADER_TESTID } from '../../../shared/theme/header';
14
+ import { ManageAccessDialog } from '../../access/components/ManageAccessDialog';
15
+ import { offersManageAccess } from '../../access/manage-access-affordance';
9
16
  import { PluginItemSections } from './plugin-page-parts';
10
- import { PendingSkillReview } from './PendingSkillReview';
17
+ import { PluginRows } from './PluginRows';
18
+ import { ManagedPluginRequests } from './ManagedPluginRequests';
19
+ import { PendingItemReview } from './PendingItemReview';
11
20
 
12
21
  /**
13
- * The Library gallery — the card grid at `/skills-and-tools/everything` and its
14
- * filtered views (`/owned`, and a plugin's cards).
22
+ * The Library gallery — Everything (the root), Owned by me, and a team's
23
+ * page: plugins as rows, then skills and tools as cards, under one search.
15
24
  *
16
25
  * This is CONTENT only: the sidebar, the flex shell and the data live in
17
26
  * `LibraryLayout` + `LibraryProvider` above it. The filter arrives as a prop
@@ -19,6 +28,12 @@ import { PendingSkillReview } from './PendingSkillReview';
19
28
  * anywhere, so a deep link, the back button and the sidebar can never disagree
20
29
  * about what is selected.
21
30
  *
31
+ * Plugins head the page because they are where things live and who they are
32
+ * for; the all-plugins index that used to be the root is this band. A team's
33
+ * page is the same page sliced by the server's answer for that team — what
34
+ * being in the group lets a person use — and never by anything the items
35
+ * themselves claim.
36
+ *
22
37
  * Two things it does not have, and won't:
23
38
  *
24
39
  * - the LOADOUT. It came from a retired mock; the prototype has no such
@@ -37,7 +52,9 @@ function headingFor(filter: LibraryFilter): string {
37
52
  case 'owned':
38
53
  return 'Owned by me';
39
54
  case 'ungrouped':
40
- return 'Yours alone';
55
+ return personalPluginName();
56
+ case 'team':
57
+ return filter.group;
41
58
  case 'group':
42
59
  return filter.plugin;
43
60
  }
@@ -48,19 +65,65 @@ export function LibraryPage({ filter }: { filter: LibraryFilter }) {
48
65
  const navigate = useNavigate();
49
66
  const { kbDirName } = useWorkspace();
50
67
  const [query, setQuery] = useState('');
51
- /** The proposed skill being reviewed, if the reader opened one. */
68
+ /** The proposal — skill or tool — being reviewed, if the reader opened one. */
52
69
  const [reviewing, setReviewing] = useState<LibraryItem | null>(null);
70
+ /**
71
+ * What the gallery's ONE access dialog is open on — the folder of whichever
72
+ * card or row the reader chose Share from. One instance for both bands,
73
+ * exactly as `SkillPage` keeps one for its title row and its request banner:
74
+ * two dialogs would be two copies of the same state, and only one of them
75
+ * can be open anyway.
76
+ */
77
+ const [manageTarget, setManageTarget] = useState<FileTreeEntry | null>(null);
78
+
79
+ /**
80
+ * A repo-relative folder as the access dialog addresses it — the same entry
81
+ * the explorer's right-click hands over, and the same one the skill page
82
+ * builds for its Share. Null until the KB directory has resolved: a
83
+ * half-built path would manage the wrong folder, or the KB root, so a page
84
+ * that does not have it yet offers no Share at all.
85
+ */
86
+ const folderTarget = useCallback(
87
+ (folder: string): FileTreeEntry | null => {
88
+ if (!kbDirName) return null;
89
+ const entry: FileTreeEntry = {
90
+ name: folder.split('/').pop() ?? folder,
91
+ relativePath: `${kbDirName}/${folder}`,
92
+ type: 'directory',
93
+ };
94
+ return offersManageAccess(entry) ? entry : null;
95
+ },
96
+ [kbDirName],
97
+ );
98
+ const shareFolder = useCallback(
99
+ (folder: string) => setManageTarget(folderTarget(folder)),
100
+ [folderTarget],
101
+ );
53
102
 
54
103
  const visible = useMemo(
55
- () => filterLibraryItems(data.items, filter, query),
56
- [data.items, filter, query],
104
+ () => filterLibraryItems(data.items, filter, query, data.teams),
105
+ [data.items, filter, query, data.teams],
106
+ );
107
+ const personalLabel = personalPluginName();
108
+ const plugins = useMemo(
109
+ () => pluginEntriesFor(data.items, data.pluginSummaries, filter, data.teams, query, personalLabel),
110
+ [data.items, data.pluginSummaries, filter, data.teams, query, personalLabel],
57
111
  );
112
+ const count = plugins.length + visible.length;
113
+ // A team the server LISTED NOTHING LIKE is not a team — a stale link, a
114
+ // renamed group — and the page says so instead of showing an empty slice
115
+ // as fact. Only once the list has arrived, and only when it arrived: a
116
+ // pending request has no list yet, and a failed one is "we could not
117
+ // ask", which is not "there is no such team".
118
+ const teamsSettled = filter.kind === 'team' && !data.teamsLoading && data.teamsError === null;
119
+ const unknownTeam = teamsSettled && !data.teams.some((t) => t.name === filter.group);
58
120
 
59
121
  /**
60
122
  * Both kinds open a PAGE now — the skill page landed alongside the tool one.
61
- * A PROPOSED skill is the exception: it has no page, because the skill page
62
- * reads the default branch and the skill is not on it yet. Its card opens the
63
- * change request instead, which is the only thing there is to read.
123
+ * A PROPOSAL is the exception, skill or tool alike: it has no page, because
124
+ * both pages read the default branch and the file is not on it yet. Its card
125
+ * opens the change request instead, which is the only thing there is to read
126
+ * — and the reason a Proposed card can never be opened AS the thing.
64
127
  */
65
128
  function openItem(item: LibraryItem) {
66
129
  if (item.pending) {
@@ -72,21 +135,44 @@ export function LibraryPage({ filter }: { filter: LibraryFilter }) {
72
135
 
73
136
  return (
74
137
  <>
75
- <div className="flex items-start gap-4">
76
- <div>
77
- <h1 className="text-display font-semibold">{headingFor(filter)}</h1>
78
- <p className="mt-0.5 text-ui text-ink-muted">
79
- {data.loading ? '…' : `${visible.length} ${visible.length === 1 ? 'item' : 'items'}`}
80
- </p>
81
- </div>
138
+ {/* The title bar, on the band the sidebar's header row is also on. The
139
+ count and the org-wide note used to share a column with the heading
140
+ INSIDE this row, which made the row as tall as whatever prose it was
141
+ carrying — a height no other page could match. They read below it
142
+ now, where they always looked like they were. */}
143
+ <div data-testid={PAGE_HEADER_TESTID} className={cn(HEADER_BAND, 'gap-4')}>
144
+ <h1 className="min-w-0 truncate text-display font-semibold" title={headingFor(filter)}>
145
+ {headingFor(filter)}
146
+ </h1>
82
147
  <TextField
83
- className="ml-auto w-64"
84
- placeholder="Search the library…"
85
- aria-label="Search the library"
148
+ className="ml-auto w-64 flex-none"
149
+ placeholder="Search"
150
+ aria-label="Search"
86
151
  value={query}
87
152
  onChange={(e) => setQuery(e.target.value)}
88
153
  />
89
154
  </div>
155
+ <p className="mt-0.5 text-ui text-ink-muted">
156
+ {data.loading ? '…' : `${count} ${count === 1 ? 'item' : 'items'}`}
157
+ </p>
158
+ {/* Everyone is not a group but the organisation: say what the page
159
+ holds, because the name alone reads like one more team. Only
160
+ once the list has settled and names it — while it loads, or
161
+ when it failed, the state below is the whole story. */}
162
+ {filter.kind === 'team' && filter.group === EVERYONE_TEAM && teamsSettled && !unknownTeam && (
163
+ <p className="mt-2 max-w-prose text-ui text-ink-muted">
164
+ Org-wide: what every signed-in person and their agents can use, with no group or role needed.
165
+ </p>
166
+ )}
167
+
168
+ {/* Somebody asking to join one of the plugins is the news on the page
169
+ the Library opens on — the one place the ask is certain to be seen.
170
+ Renders nothing when nothing pends. */}
171
+ {filter.kind === 'all' && (
172
+ <div className="mt-5 empty:mt-0">
173
+ <ManagedPluginRequests />
174
+ </div>
175
+ )}
90
176
 
91
177
  <div className="mt-5" />
92
178
 
@@ -99,36 +185,83 @@ export function LibraryPage({ filter }: { filter: LibraryFilter }) {
99
185
  </Banner>
100
186
  ) : data.loading ? (
101
187
  <div className="py-16 text-center text-ui text-ink-faint">Loading the library…</div>
102
- ) : visible.length === 0 ? (
188
+ ) : filter.kind === 'team' && data.teamsLoading ? (
189
+ <div className="py-16 text-center text-ui text-ink-faint">Loading teams…</div>
190
+ ) : filter.kind === 'team' && data.teamsError ? (
191
+ <Banner role="alert" tone="danger">
192
+ {data.teamsError}
193
+ <button type="button" className="ml-3 font-semibold underline" onClick={data.reloadPlugins}>
194
+ Try again
195
+ </button>
196
+ </Banner>
197
+ ) : unknownTeam ? (
103
198
  <div className="py-16 text-center text-ui text-ink-faint">
104
- {emptyMessageFor(filter, query)}
199
+ {`There's no team called ${filter.kind === 'team' ? filter.group : ''}.`}
105
200
  </div>
106
201
  ) : (
107
- // Skills and tools, split — the same two bands a plugin page has.
108
- // One undifferentiated grid made you read every card's body to learn
109
- // what kind of thing it was; the heading does that now, once, for a
110
- // whole band. A band with nothing in it is dropped rather than shown
111
- // empty: this is a search result, not an inventory of what could be.
112
202
  <div className="pb-14">
113
- <PluginItemSections
114
- skillItems={visible.filter((i) => i.kind === 'skill')}
115
- toolItems={visible.filter((i) => i.kind === 'integration')}
116
- onOpen={openItem}
117
- hideEmpty
118
- emptySkills=""
203
+ <PluginRows
204
+ entries={plugins}
205
+ showCreate={filter.kind === 'all'}
206
+ onShare={kbDirName ? shareFolder : undefined}
119
207
  />
208
+ {visible.length === 0 && plugins.length === 0 ? (
209
+ <div className="py-16 text-center text-ui text-ink-faint">
210
+ {emptyMessageFor(filter, query)}
211
+ </div>
212
+ ) : (
213
+ // Skills and tools, split — the same two bands a plugin page has.
214
+ // One undifferentiated grid made you read every card's body to learn
215
+ // what kind of thing it was; the heading does that now, once, for a
216
+ // whole band. A band with nothing in it is dropped rather than shown
217
+ // empty: this is a search result, not an inventory of what could be.
218
+ <PluginItemSections
219
+ skillItems={visible.filter((i) => i.kind === 'skill')}
220
+ toolItems={visible.filter((i) => i.kind === 'integration')}
221
+ onOpen={openItem}
222
+ // A skill's rules live on its own folder — the same folder the
223
+ // skill page's Share opens. Tools get none: access to a tool is
224
+ // decided at the plugin that carries it.
225
+ onShare={kbDirName ? (item) => shareFolder(item.path) : undefined}
226
+ hideEmpty
227
+ emptySkills=""
228
+ />
229
+ )}
120
230
  </div>
121
231
  )}
122
232
 
233
+ {manageTarget && (
234
+ <ManageAccessDialog
235
+ // Keyed on the path, so retargeting at an ancestor remounts it
236
+ // against that folder — the explorer's arrangement exactly.
237
+ key={manageTarget.relativePath}
238
+ // The Library speaks the DEFAULT branch: the gallery lists what is
239
+ // on it, so the rules it shares are edited where it read them,
240
+ // whatever branch the ambient workspace happens to be on. Same
241
+ // choice the skill page's Share makes.
242
+ workspaceId={encodeURIComponent(DEFAULT_BRANCH)}
243
+ entry={manageTarget}
244
+ onManageAncestor={setManageTarget}
245
+ onClose={() => {
246
+ setManageTarget(null);
247
+ // Granting can change what the reader — or a plugin's members —
248
+ // can see, so both witnesses are re-read: the catalog and the
249
+ // plugin index.
250
+ data.reload();
251
+ data.reloadPlugins();
252
+ }}
253
+ />
254
+ )}
255
+
123
256
  {reviewing && (
124
- <PendingSkillReview
257
+ <PendingItemReview
125
258
  item={reviewing}
126
259
  onClose={() => setReviewing(null)}
127
260
  onResolved={() => {
128
261
  setReviewing(null);
129
- // The skill leaves the review shelf and joins the catalog by the
130
- // same reload — one load answers both, so the card cannot appear
131
- // twice in the frame between them.
262
+ // The proposal — skill or tool alike — leaves the review shelf and
263
+ // joins the catalog by the same reload: one load answers both, so
264
+ // the card cannot appear twice in the frame between them.
132
265
  data.reload();
133
266
  }}
134
267
  />
@@ -0,0 +1,169 @@
1
+ import { useMemo, useState } from 'react';
2
+ import { Button, Badge } from '../../../shared/components';
3
+ import type { LibraryItem } from '../state/library-data';
4
+ import { useLibraryToast } from '../state/toast.context';
5
+ import { NeedsSkillWriteError, linkSkill } from '../services/plugins.api';
6
+ import { requestSkillAccess } from '../services/library.api';
7
+ import { isInPlugin } from '../utils/status';
8
+
9
+ /**
10
+ * "Link an existing skill" — the picker behind adding a shared skill to a
11
+ * plugin without copying it.
12
+ *
13
+ * Every released skill the caller can read is offered, minus the ones already
14
+ * in this plugin. Linking needs write on the skill's rules as well as on the
15
+ * plugin (the link grants the plugin's principal on the skill), and the server
16
+ * is the one that knows: a refusal of that shape turns the row's action into
17
+ * "Request write access", which opens the same kind of change request as
18
+ * asking to join a plugin. Nothing is decided client-side from a stale verdict.
19
+ *
20
+ * Prop-driven (the caller hands it the catalog) so it renders anywhere the
21
+ * plugin page's data is, without reaching for the library context itself.
22
+ */
23
+ export function LinkSkillPanel({
24
+ plugin,
25
+ items,
26
+ onLinked,
27
+ }: {
28
+ plugin: string;
29
+ /** The caller's catalog; the panel offers its released skills not yet in `plugin`. */
30
+ items: LibraryItem[];
31
+ onLinked(): void;
32
+ }) {
33
+ const toast = useLibraryToast();
34
+ const [query, setQuery] = useState('');
35
+ // What is in flight, and for which skill: the live region names the
36
+ // operation, so a write-access request is never announced as a link.
37
+ const [busy, setBusy] = useState<{ id: string; op: 'link' | 'request' } | null>(null);
38
+ /** Per skill: the server said write on the skill is missing / a request is open. */
39
+ const [needsWrite, setNeedsWrite] = useState<Record<string, 'ask' | 'requested'>>({});
40
+
41
+ const candidates = useMemo(() => {
42
+ const q = query.trim().toLowerCase();
43
+ return items
44
+ .filter((i): i is LibraryItem => i.kind === 'skill' && !i.pending && !isInPlugin(i, plugin))
45
+ .filter((i) => !q || i.name.toLowerCase().includes(q) || i.description.toLowerCase().includes(q))
46
+ .sort((a, b) => a.name.localeCompare(b.name));
47
+ }, [items, plugin, query]);
48
+
49
+ async function link(item: LibraryItem) {
50
+ setBusy({ id: item.id, op: 'link' });
51
+ try {
52
+ const result = await linkSkill(plugin, item.path);
53
+ toast(
54
+ result.skills.length === 1
55
+ ? `${item.name} is now in ${plugin}. Its members can read it; its managers can edit it.`
56
+ : `${result.skills.length} skills are now in ${plugin}.`,
57
+ );
58
+ onLinked();
59
+ } catch (err) {
60
+ if (err instanceof NeedsSkillWriteError) {
61
+ setNeedsWrite((m) => ({ ...m, [item.id]: 'ask' }));
62
+ } else {
63
+ toast(err instanceof Error ? err.message : "Couldn't link that skill.", 'danger');
64
+ }
65
+ } finally {
66
+ setBusy(null);
67
+ }
68
+ }
69
+
70
+ async function request(item: LibraryItem) {
71
+ setBusy({ id: item.id, op: 'request' });
72
+ try {
73
+ await requestSkillAccess(item.name);
74
+ setNeedsWrite((m) => ({ ...m, [item.id]: 'requested' }));
75
+ toast(`Asked ${item.name}'s editors for write access. Link it once they say yes.`);
76
+ } catch (err) {
77
+ toast(err instanceof Error ? err.message : "Couldn't request access.", 'danger');
78
+ } finally {
79
+ setBusy(null);
80
+ }
81
+ }
82
+
83
+ return (
84
+ <div data-testid="link-skill-panel">
85
+ <p className="text-ui text-ink-muted">
86
+ {`Link a skill that already exists. It stays where it is; ${plugin}'s members get to read it and its managers get to edit it.`}
87
+ </p>
88
+ {/* The in-flight word for assistive tech. The clicked button says
89
+ "Linking…" too, but a button that goes disabled drops focus, so a
90
+ label change there is never read out; a live region is. */}
91
+ <span role="status" aria-live="polite" aria-label="Link progress" className="sr-only">
92
+ {busy === null
93
+ ? ''
94
+ : busy.op === 'link'
95
+ ? `Linking ${busy.id}…`
96
+ : `Requesting write access to ${busy.id}…`}
97
+ </span>
98
+ <input
99
+ type="search"
100
+ value={query}
101
+ onChange={(e) => setQuery(e.target.value)}
102
+ placeholder="Search skills…"
103
+ aria-label="Search skills to link"
104
+ className="mt-2.5 w-full rounded-md border border-line bg-surface px-2.5 py-1.5 text-ui text-ink placeholder:text-ink-faint focus:outline-none"
105
+ />
106
+ <ul className="mt-2 max-h-64 divide-y divide-line overflow-auto rounded-md border border-line">
107
+ {candidates.length === 0 && (
108
+ <li className="px-3 py-3 text-detail text-ink-faint">
109
+ {query.trim() ? 'No skill matches.' : 'Every skill you can see is already in this plugin.'}
110
+ </li>
111
+ )}
112
+ {candidates.map((item) => {
113
+ const state = needsWrite[item.id];
114
+ return (
115
+ <li key={item.id} className="flex items-center gap-3 px-3 py-2">
116
+ <div className="min-w-0 flex-1">
117
+ <div className="flex items-center gap-1.5">
118
+ <span className="truncate text-ui font-medium text-ink">{item.name}</span>
119
+ {item.shared ? (
120
+ <Badge tone="outline" size="xs" className="shrink-0 uppercase">
121
+ Shared
122
+ </Badge>
123
+ ) : item.plugin ? (
124
+ <Badge tone="outline" size="xs" className="shrink-0 uppercase">
125
+ {item.plugin}
126
+ </Badge>
127
+ ) : null}
128
+ </div>
129
+ {item.description && (
130
+ <div className="truncate text-detail text-ink-muted">{item.description}</div>
131
+ )}
132
+ {state === 'ask' && (
133
+ <div className="text-detail text-wait">
134
+ {"You can't change who may read this skill yet. Ask its editors first."}
135
+ </div>
136
+ )}
137
+ </div>
138
+ {state === 'requested' ? (
139
+ <span className="shrink-0 text-detail text-ink-faint">Requested</span>
140
+ ) : state === 'ask' ? (
141
+ <Button
142
+ variant="outline"
143
+ size="tiny"
144
+ disabled={busy !== null}
145
+ onClick={() => void request(item)}
146
+ >
147
+ {busy?.id === item.id ? 'Requesting…' : 'Request write access'}
148
+ </Button>
149
+ ) : (
150
+ <Button
151
+ variant="outline"
152
+ size="tiny"
153
+ disabled={busy !== null}
154
+ onClick={() => void link(item)}
155
+ >
156
+ {/* A link is a commit and a push — a second or two. The
157
+ button says so, or a greyed "Link" reads as a page that
158
+ froze. Same word as the panel beside it: "Creating…";
159
+ the live region above says it for screen readers. */}
160
+ {busy?.id === item.id ? 'Linking…' : 'Link'}
161
+ </Button>
162
+ )}
163
+ </li>
164
+ );
165
+ })}
166
+ </ul>
167
+ </div>
168
+ );
169
+ }
@@ -1,12 +1,13 @@
1
1
  import { useState } from 'react';
2
- import { Link } from 'react-router-dom';
2
+ import { cn } from '../../../lib/utils';
3
+ import { HEADER_BAND, PAGE_HEADER_TESTID } from '../../../shared/theme/header';
3
4
  import { Badge, Button, Surface } from '../../../shared/components';
4
- import { pathForPluginsIndex } from '../routes/library-paths';
5
- import { ownersTextOf, primaryFolderOf } from '../utils/plugin-summary';
5
+ import { adminNamesOf, ownersTextOf, primaryFolderOf } from '../utils/plugin-summary';
6
6
  import { AlreadyReadableError, requestPluginAccess, type PluginSummary } from '../services/plugins.api';
7
7
  import { firstNames, joinNames } from '../utils/names';
8
8
  import { useLibraryToast } from '../state/toast.context';
9
9
  import { LockGlyph } from './LockGlyph';
10
+ import { PluginBreadcrumb } from './plugin-page-parts';
10
11
 
11
12
  /**
12
13
  * A plugin you cannot read, as a place you can still stand in.
@@ -22,6 +23,16 @@ import { LockGlyph } from './LockGlyph';
22
23
  * It is the SAME frame as the member view — breadcrumb, h1, run-by lede — so
23
24
  * the two never read as different products. Only the middle changes.
24
25
  *
26
+ * ASKING HAS THREE STATES, and the button carries two of them. It reads
27
+ * "Requesting…" and refuses further clicks from the moment it is pressed
28
+ * until the server answers; the "Requested" card replaces it on that answer,
29
+ * which the server gives as soon as it has RECORDED the request rather than
30
+ * once the change request exists. If the git work that follows the answer
31
+ * fails, the next load has `requestFailure` set and no request standing, so
32
+ * the button is back with a sentence above it naming what went wrong —
33
+ * pressing it again continues the recorded request rather than opening a
34
+ * second one.
35
+ *
25
36
  * `Manage access` is the escape hatch for a locked-out platform Admin. Admin
26
37
  * rescue applies to WRITING `access.md`, not to reading the folder, so an Admin
27
38
  * can genuinely be locked out of a plugin they are nevertheless the right person
@@ -50,6 +61,10 @@ export function LockedPluginView({ plugin, onRequested, onUnlocked, onManage }:
50
61
  const adminsText = ownersTextOf(plugin);
51
62
  const primaryFolder = primaryFolderOf(plugin);
52
63
  const pending = plugin.hasRequested || requested;
64
+ // The server could not finish the last request. It says so only while there
65
+ // is no request standing — `hasRequested` and this are never both true —
66
+ // so the sentence always sits above a button the person can press again.
67
+ const failure = pending ? null : (plugin.requestFailure ?? null);
53
68
 
54
69
  async function request() {
55
70
  setRequesting(true);
@@ -79,18 +94,20 @@ export function LockedPluginView({ plugin, onRequested, onUnlocked, onManage }:
79
94
 
80
95
  return (
81
96
  <div className="pb-14">
82
- <nav aria-label="Breadcrumb" className="flex items-center gap-1.5 text-detail text-ink-faint">
83
- <Link to={pathForPluginsIndex()} className="rounded-xs hover:text-ink">
84
- All plugins
85
- </Link>
86
- <span aria-hidden="true">›</span>
87
- <span aria-current="page" className="truncate text-ink-muted">
88
- {plugin.name}
89
- </span>
90
- </nav>
91
-
92
- <div className="mt-1.5 flex items-center gap-2.5">
93
- <h1 className="text-display font-semibold">{plugin.name}</h1>
97
+ {/* The same band every other page title bar is on, so a plugin you
98
+ cannot open still lines its heading up with the nav beside it — and
99
+ the page's FIRST row, with the breadcrumb on the band rather than
100
+ above it, for the same reason. `PluginBreadcrumb` is the one an
101
+ openable plugin page uses; a locked page is still a plugin page, and
102
+ two copies of one trail drift the first time either is touched. */}
103
+ <div data-testid={PAGE_HEADER_TESTID} className={cn(HEADER_BAND, 'gap-2.5')}>
104
+ <PluginBreadcrumb />
105
+ <h1
106
+ className="min-w-0 truncate text-display font-semibold"
107
+ title={plugin.displayName || plugin.name}
108
+ >
109
+ {plugin.displayName || plugin.name}
110
+ </h1>
94
111
  <Badge tone="outline" size="sm">
95
112
  <LockGlyph className="size-3 shrink-0" />
96
113
  Locked
@@ -103,6 +120,22 @@ export function LockedPluginView({ plugin, onRequested, onUnlocked, onManage }:
103
120
  for access; a name would tell you what is inside. */}
104
121
  <p className="mt-1 text-ui text-ink-muted">{countsLine(plugin)}</p>
105
122
 
123
+ {/* The in-flight word for assistive tech, matching `LinkSkillPanel`.
124
+ The button says "Requesting…" too, but pressing it disables it and a
125
+ disabled button drops focus, so that label change is never read out.
126
+ The acknowledgement is the whole point of this ticket, and it has to
127
+ reach somebody who cannot see the label.
128
+
129
+ `pending`, not `requesting`, is what ends it. The success path never
130
+ clears `requesting` — deliberately, so the button cannot flicker back
131
+ to life between the answer and the swap to the Requested card — which
132
+ left this region presenting "Requesting access to …" for as long as
133
+ the page stayed up. A screen-reader user arriving at the region after
134
+ the card had rendered was told the request was still going. */}
135
+ <span role="status" aria-live="polite" aria-label="Request progress" className="sr-only">
136
+ {requesting && !pending ? `Requesting access to ${plugin.displayName || plugin.name}…` : ''}
137
+ </span>
138
+
106
139
  <div className="mt-5">
107
140
  {pending ? (
108
141
  <Surface tone="sunken" radius="lg" elevation="none" padded className="max-w-lg">
@@ -111,9 +144,21 @@ export function LockedPluginView({ plugin, onRequested, onUnlocked, onManage }:
111
144
  </p>
112
145
  </Surface>
113
146
  ) : (
114
- <Button variant="primary" disabled={requesting} onClick={() => void request()}>
115
- Subscribe to its skills and tools
116
- </Button>
147
+ <>
148
+ {failure && (
149
+ <p className="mb-2.5 max-w-lg text-body text-ink-muted">
150
+ {`Your request to join ${plugin.displayName || plugin.name} could not be sent: ${failure}. Try again.`}
151
+ </p>
152
+ )}
153
+ {/* The label is the acknowledgement. Nothing else on the page can
154
+ say "we heard you" in the render that follows the click — the
155
+ server's answer is a round-trip away, and the whole reason the
156
+ click used to look like a freeze is that this button greyed out
157
+ and kept its word. */}
158
+ <Button variant="primary" disabled={requesting} onClick={() => void request()}>
159
+ {requesting ? 'Requesting…' : 'Subscribe to this plugin'}
160
+ </Button>
161
+ </>
117
162
  )}
118
163
  </div>
119
164
 
@@ -140,20 +185,3 @@ function countsLine(plugin: Pick<PluginSummary, 'skillCount' | 'toolCount'>): st
140
185
  return `${skills} · ${tools}. Visible once you have access.`;
141
186
  }
142
187
 
143
- /**
144
- * The people `ownersTextOf` names, as a list.
145
- *
146
- * Mirrors that helper's chain exactly — owners, else writers, else nobody — so
147
- * the sentence and the count of subjects in it can never disagree. It is a
148
- * separate function only because the toast needs the NAMES (to take first
149
- * names) and the verb needs the COUNT, and prose gives back neither.
150
- */
151
- function adminNamesOf(plugin: Pick<PluginSummary, 'owners' | 'writers'>): string[] {
152
- const owners = [...plugin.owners.users.map((u) => u.name), ...plugin.owners.roles];
153
- const named = owners.filter((s) => s.length > 0);
154
- if (named.length > 0) return named;
155
- return [...plugin.writers.users.map((u) => u.name), ...plugin.writers.roles].filter(
156
- (s) => s.length > 0,
157
- );
158
- }
159
-