@bevel-software/platform-core-frontend 0.15.1 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (347) hide show
  1. package/THIRD-PARTY-NOTICES.md +2 -2
  2. package/package.json +3 -3
  3. package/src/core/CoreAppShell.tsx +20 -9
  4. package/src/core/__tests__/AppChrome.test.tsx +0 -3
  5. package/src/core/__tests__/events.test.ts +43 -0
  6. package/src/core/bootstrap.ts +11 -3
  7. package/src/core/events.ts +85 -3
  8. package/src/core/registry.ts +1 -1
  9. package/src/lib/__tests__/email.test.ts +44 -0
  10. package/src/lib/email.ts +37 -1
  11. package/src/modules/access/__tests__/ManageAccessDialog.add-row-picking.test.tsx +141 -0
  12. package/src/modules/access/__tests__/ManageAccessDialog.chip-truncation.test.tsx +204 -0
  13. package/src/modules/access/__tests__/ManageAccessDialog.download-read.test.tsx +234 -0
  14. package/src/modules/access/__tests__/ManageAccessDialog.edited-row-visible.test.tsx +160 -0
  15. package/src/modules/access/__tests__/ManageAccessDialog.placement.test.tsx +2 -2
  16. package/src/modules/access/__tests__/ManageAccessDialog.proposal.test.tsx +166 -0
  17. package/src/modules/access/__tests__/ManageAccessDialog.restrict.test.tsx +510 -0
  18. package/src/modules/access/__tests__/ManageAccessDialog.row-menu-axes.test.tsx +299 -0
  19. package/src/modules/access/__tests__/ManageAccessDialog.row-menu-width.test.tsx +226 -0
  20. package/src/modules/access/__tests__/ManageAccessDialog.test.tsx +721 -126
  21. package/src/modules/access/__tests__/ManageAccessDialog.unknown-email.test.tsx +314 -0
  22. package/src/modules/access/__tests__/manage-access-affordance.test.ts +14 -0
  23. package/src/modules/access/__tests__/tailwindDeclarations.ts +210 -0
  24. package/src/modules/access/api.ts +140 -6
  25. package/src/modules/access/components/ManageAccessDialog.tsx +1299 -561
  26. package/src/modules/access/manage-access-affordance.ts +17 -0
  27. package/src/modules/admin/__tests__/AddMemberInput.test.tsx +297 -0
  28. package/src/modules/admin/__tests__/AdminRolesPage.capabilities.test.tsx +2 -2
  29. package/src/modules/admin/__tests__/AdminRolesPage.fixed-admin.test.tsx +189 -0
  30. package/src/modules/admin/__tests__/AdminRolesPage.suggest.test.tsx +1 -1
  31. package/src/modules/admin/__tests__/DirectoryGroupsPage.suggest.test.tsx +182 -0
  32. package/src/modules/admin/__tests__/DirectoryGroupsPage.test.tsx +165 -14
  33. package/src/modules/admin/__tests__/UserAccountsPage.test.tsx +401 -4
  34. package/src/modules/admin/__tests__/group-members-path.test.ts +27 -0
  35. package/src/modules/admin/components/AddMemberInput.tsx +268 -0
  36. package/src/modules/admin/components/AdminRolesPage.tsx +97 -132
  37. package/src/modules/admin/components/DirectoryGroupsPage.tsx +91 -39
  38. package/src/modules/admin/components/UserAccountsPage.tsx +271 -37
  39. package/src/modules/admin/components/group-members-path.ts +32 -0
  40. package/src/modules/admin/services/roles.api.ts +12 -1
  41. package/src/modules/audit/__tests__/AuditLogPage.test.tsx +312 -0
  42. package/src/modules/audit/components/AuditEventsPanel.tsx +319 -0
  43. package/src/modules/audit/components/AuditLogPage.tsx +373 -0
  44. package/src/modules/audit/components/principal-grouping.ts +49 -0
  45. package/src/modules/audit/services/audit.api.ts +98 -0
  46. package/src/modules/auth/__tests__/AccountPage.test.tsx +50 -2
  47. package/src/modules/auth/components/AccountPage.tsx +73 -54
  48. package/src/modules/auth/components/LoginScreen.tsx +1 -0
  49. package/src/modules/auth/services/account.api.ts +78 -4
  50. package/src/modules/change-requests/__tests__/ChangeRequestDialog.access-rules.test.tsx +144 -0
  51. package/src/modules/change-requests/__tests__/ChangeRequestDialog.binary.test.tsx +422 -0
  52. package/src/modules/change-requests/__tests__/ChangeRequestDialog.brings-itself-up-to-date.test.tsx +431 -0
  53. package/src/modules/change-requests/__tests__/ChangeRequestDialog.fork-point.test.tsx +193 -0
  54. package/src/modules/change-requests/__tests__/ChangeRequestDialog.initial-file.test.tsx +142 -0
  55. package/src/modules/change-requests/__tests__/ChangeRequestDialog.moved.test.tsx +202 -0
  56. package/src/modules/change-requests/__tests__/ChangeRequestDialog.test.tsx +205 -13
  57. package/src/modules/change-requests/__tests__/ChangeRequestDialog.unreadable.test.tsx +271 -0
  58. package/src/modules/change-requests/__tests__/FileChangeBoxes.test.tsx +208 -0
  59. package/src/modules/change-requests/__tests__/apply-outcome-for-every-viewer.test.tsx +286 -0
  60. package/src/modules/change-requests/__tests__/propose.concurrent.test.ts +273 -0
  61. package/src/modules/change-requests/__tests__/readFailure.test.ts +122 -0
  62. package/src/modules/change-requests/__tests__/useCrFileDiffs.test.tsx +238 -0
  63. package/src/modules/change-requests/__tests__/useFileOnBranch.test.tsx +56 -1
  64. package/src/modules/change-requests/__tests__/useForkPointFile.test.tsx +79 -0
  65. package/src/modules/change-requests/components/BranchFilePreview.tsx +357 -0
  66. package/src/modules/change-requests/components/ChangeBox.tsx +31 -2
  67. package/src/modules/change-requests/components/ChangeRequestDialog.tsx +862 -72
  68. package/src/modules/change-requests/components/CrFileTree.tsx +74 -58
  69. package/src/modules/change-requests/components/FileChangeBoxes.tsx +19 -15
  70. package/src/modules/change-requests/hooks/useApplyChangeRequest.ts +41 -7
  71. package/src/modules/change-requests/hooks/useCrFileDiffs.ts +181 -23
  72. package/src/modules/change-requests/hooks/useFileOnBranch.ts +70 -7
  73. package/src/modules/change-requests/hooks/useForkPointFile.ts +77 -0
  74. package/src/modules/change-requests/services/change-requests.api.ts +57 -1
  75. package/src/modules/change-requests/services/denied-file.api.ts +53 -0
  76. package/src/modules/change-requests/services/propose.api.ts +97 -8
  77. package/src/modules/change-requests/utils/approval.ts +15 -0
  78. package/src/modules/change-requests/utils/author.ts +32 -0
  79. package/src/modules/change-requests/utils/readFailure.ts +110 -0
  80. package/src/modules/git/__tests__/FileHistoryPanel.test.tsx +20 -0
  81. package/src/modules/git/components/FileHistoryPanel.tsx +5 -0
  82. package/src/modules/git/components/PullRequestsForMe.tsx +51 -24
  83. package/src/modules/git/services/__tests__/error-messages.test.ts +29 -0
  84. package/src/modules/git/services/error-messages.ts +12 -0
  85. package/src/modules/git/services/pr-prompts.ts +5 -5
  86. package/src/modules/layout/__tests__/HeaderAlignment.test.tsx +401 -0
  87. package/src/modules/layout/__tests__/SidebarFooterGrid.test.tsx +286 -0
  88. package/src/modules/layout/__tests__/SidebarFrameResponsive.test.tsx +61 -0
  89. package/src/modules/layout/components/AppLayout.tsx +2 -0
  90. package/src/modules/layout/components/MobileChatLayout.tsx +4 -1
  91. package/src/modules/layout/components/ResizableThreePaneLayout.tsx +4 -1
  92. package/src/modules/layout/components/SidebarFrame.tsx +108 -3
  93. package/src/modules/library/__tests__/AddToPluginDialog.test.tsx +171 -5
  94. package/src/modules/library/__tests__/DeleteToolDialog.test.tsx +356 -0
  95. package/src/modules/library/__tests__/IntegrationsSetupReminder.test.tsx +60 -0
  96. package/src/modules/library/__tests__/LibraryCard.test.tsx +91 -10
  97. package/src/modules/library/__tests__/LibraryRoutes.test.tsx +242 -107
  98. package/src/modules/library/__tests__/LibrarySidebarMenu.test.tsx +103 -98
  99. package/src/modules/library/__tests__/LinkSkillPanel.test.tsx +20 -5
  100. package/src/modules/library/__tests__/LockedPluginView.test.tsx +97 -7
  101. package/src/modules/library/__tests__/NewPluginDialog.test.tsx +13 -4
  102. package/src/modules/library/__tests__/PersonalAddDialog.test.tsx +79 -3
  103. package/src/modules/library/__tests__/PersonalPluginPage.test.tsx +201 -0
  104. package/src/modules/library/__tests__/PluginExtras.test.tsx +100 -9
  105. package/src/modules/library/__tests__/PluginJoinRequests.test.tsx +60 -1
  106. package/src/modules/library/__tests__/PluginPage.test.tsx +258 -6
  107. package/src/modules/library/__tests__/PluginsSidebar.contextmenu.test.tsx +16 -56
  108. package/src/modules/library/__tests__/PluginsSidebar.test.tsx +155 -152
  109. package/src/modules/library/__tests__/PluginsSidebarMenu.test.tsx +16 -0
  110. package/src/modules/library/__tests__/SharedViaPlugins.test.tsx +106 -0
  111. package/src/modules/library/__tests__/SkillPage.test.tsx +386 -80
  112. package/src/modules/library/__tests__/SkillsTree.test.tsx +293 -4
  113. package/src/modules/library/__tests__/ToolConnectionSection.test.tsx +582 -71
  114. package/src/modules/library/__tests__/ToolPage.test.tsx +87 -4
  115. package/src/modules/library/__tests__/WorkspaceItemRoute.test.tsx +173 -26
  116. package/src/modules/library/__tests__/auth-harness.tsx +9 -9
  117. package/src/modules/library/__tests__/card-row-menu.test.tsx +320 -0
  118. package/src/modules/library/__tests__/library-data.mapping.test.tsx +98 -0
  119. package/src/modules/library/__tests__/library-data.stale.test.tsx +121 -28
  120. package/src/modules/library/__tests__/library-data.test.ts +7 -0
  121. package/src/modules/library/__tests__/library-paths.test.ts +47 -4
  122. package/src/modules/library/__tests__/link-membership.test.ts +13 -4
  123. package/src/modules/library/__tests__/name-with-badges.test.tsx +273 -0
  124. package/src/modules/library/__tests__/newSkillMarkdown.test.ts +30 -0
  125. package/src/modules/library/__tests__/owner-pill.test.tsx +357 -0
  126. package/src/modules/library/__tests__/pending-tools.test.tsx +400 -0
  127. package/src/modules/library/__tests__/plugin-entries.test.ts +122 -0
  128. package/src/modules/library/__tests__/plugin-summary.test.ts +36 -1
  129. package/src/modules/library/__tests__/status.test.ts +82 -2
  130. package/src/modules/library/__tests__/tools.api.test.ts +44 -1
  131. package/src/modules/library/components/AccessRequestsBanner.tsx +85 -47
  132. package/src/modules/library/components/AddDialogTabs.tsx +103 -0
  133. package/src/modules/library/components/AddToPluginDialog.tsx +74 -18
  134. package/src/modules/library/components/IntegrationsSetupReminder.tsx +59 -0
  135. package/src/modules/library/components/ItemActionsMenu.tsx +288 -0
  136. package/src/modules/library/components/LibraryCard.tsx +146 -45
  137. package/src/modules/library/components/LibraryLayout.tsx +119 -256
  138. package/src/modules/library/components/LibraryPage.tsx +172 -39
  139. package/src/modules/library/components/LinkSkillPanel.tsx +1 -3
  140. package/src/modules/library/components/LockedPluginView.tsx +62 -34
  141. package/src/modules/library/components/NameWithBadges.tsx +164 -0
  142. package/src/modules/library/components/NewPluginDialog.tsx +16 -2
  143. package/src/modules/library/components/PageActions.tsx +11 -9
  144. package/src/modules/library/components/{PendingSkillReview.tsx → PendingItemReview.tsx} +14 -7
  145. package/src/modules/library/components/PersonalAddDialog.tsx +68 -18
  146. package/src/modules/library/components/PersonalPluginPage.tsx +121 -22
  147. package/src/modules/library/components/PluginExtras.tsx +140 -17
  148. package/src/modules/library/components/PluginIndexRow.tsx +47 -12
  149. package/src/modules/library/components/PluginPage.tsx +157 -41
  150. package/src/modules/library/components/PluginRows.tsx +286 -0
  151. package/src/modules/library/components/PluginsSidebar.tsx +239 -263
  152. package/src/modules/library/components/PluginsSidebarMenu.tsx +26 -1
  153. package/src/modules/library/components/ShareButton.tsx +17 -0
  154. package/src/modules/library/components/SkillsTree.tsx +141 -28
  155. package/src/modules/library/components/TeamRoute.tsx +15 -0
  156. package/src/modules/library/components/__tests__/upload-notices-once-per-page.test.tsx +144 -0
  157. package/src/modules/library/components/plugin-page-parts.tsx +103 -17
  158. package/src/modules/library/components/skill-page/SharedViaPlugins.tsx +6 -12
  159. package/src/modules/library/components/skill-page/SkillFilePane.tsx +5 -0
  160. package/src/modules/library/components/skill-page/SkillPage.tsx +274 -122
  161. package/src/modules/library/components/tool-page/DeleteToolDialog.tsx +218 -0
  162. package/src/modules/library/components/tool-page/ToolConnectionSection.tsx +79 -178
  163. package/src/modules/library/components/tool-page/ToolPage.tsx +106 -16
  164. package/src/modules/library/components/tool-page/ToolVarRow.tsx +42 -41
  165. package/src/modules/library/hooks/__tests__/useLibraryData.test.ts +98 -0
  166. package/src/modules/library/hooks/useLibraryData.ts +92 -19
  167. package/src/modules/library/routes/LibraryRoutes.tsx +14 -11
  168. package/src/modules/library/routes/WorkspaceItemRoute.tsx +77 -27
  169. package/src/modules/library/routes/library-paths.ts +26 -28
  170. package/src/modules/library/services/library.api.ts +38 -20
  171. package/src/modules/library/services/plugins.api.ts +69 -8
  172. package/src/modules/library/services/teams.api.ts +15 -0
  173. package/src/modules/library/services/tools.api.ts +78 -0
  174. package/src/modules/library/state/library-data.tsx +170 -32
  175. package/src/modules/library/utils/personal-plugin.ts +13 -15
  176. package/src/modules/library/utils/plugin-entries.ts +134 -0
  177. package/src/modules/library/utils/plugin-summary.ts +75 -9
  178. package/src/modules/library/utils/status.ts +135 -33
  179. package/src/modules/onboarding/__tests__/creator-welcome.test.tsx +8 -1
  180. package/src/modules/onboarding/__tests__/onboarding.test.tsx +853 -760
  181. package/src/modules/onboarding/agent-clients.ts +55 -23
  182. package/src/modules/onboarding/components/ConnectAgentPill.tsx +5 -1
  183. package/src/modules/onboarding/components/WelcomePage.tsx +98 -62
  184. package/src/modules/pr/services/pr-merge.api.ts +2 -1
  185. package/src/modules/review/components/MarkdownDiffViewer.tsx +53 -8
  186. package/src/modules/review/components/ReviewPanel.tsx +15 -17
  187. package/src/modules/review/components/__tests__/MarkdownDiffViewer.test.tsx +64 -0
  188. package/src/modules/review/components/__tests__/ReviewPanel.test.tsx +25 -1
  189. package/src/modules/secrets-vault/components/ConnectToolsPage.tsx +454 -117
  190. package/src/modules/secrets-vault/components/SecretsPage.tsx +48 -7
  191. package/src/modules/secrets-vault/components/ToolSecretsPanel.tsx +84 -5
  192. package/src/modules/secrets-vault/components/__tests__/ConnectToolsPage.test.tsx +425 -0
  193. package/src/modules/secrets-vault/components/__tests__/SecretsPage.test.tsx +417 -82
  194. package/src/modules/secrets-vault/components/__tests__/ToolSecretsPanel.test.tsx +105 -0
  195. package/src/modules/secrets-vault/components/__tests__/connect-lists-what-the-banner-counted.test.tsx +407 -0
  196. package/src/modules/secrets-vault/probe/SavedKeyProbeResult.tsx +98 -0
  197. package/src/modules/secrets-vault/probe/__tests__/probe-verdict.test.ts +160 -0
  198. package/src/modules/secrets-vault/probe/probe-verdict.ts +108 -0
  199. package/src/modules/secrets-vault/probe/useSavedKeyProbe.ts +228 -0
  200. package/src/modules/secrets-vault/services/connect.api.ts +36 -5
  201. package/src/modules/secrets-vault/utils/connect-status.ts +98 -0
  202. package/src/modules/settings/components/ClaudeConnectionCard.tsx +9 -24
  203. package/src/modules/settings/components/ClaudeConnectionFields.tsx +23 -0
  204. package/src/modules/settings/components/DeploymentPage.tsx +10 -30
  205. package/src/modules/settings/components/MarketplaceSection.tsx +152 -0
  206. package/src/modules/settings/components/__tests__/DeploymentPage.test.tsx +67 -4
  207. package/src/modules/settings/components/__tests__/MarketplaceSection.test.tsx +325 -0
  208. package/src/modules/settings/components/__tests__/SettingsLayout.test.tsx +7 -6
  209. package/src/modules/settings/services/github-facade.api.ts +23 -0
  210. package/src/modules/settings/settings-nav-items.tsx +13 -3
  211. package/src/modules/setup/__tests__/setup.oidc.test.tsx +172 -0
  212. package/src/modules/setup/__tests__/setup.probe-refusal.test.tsx +123 -0
  213. package/src/modules/setup/__tests__/setup.test.tsx +497 -4
  214. package/src/modules/setup/__tests__/useSetupStatus.test.tsx +130 -0
  215. package/src/modules/setup/components/SetupGate.tsx +16 -16
  216. package/src/modules/setup/components/SetupScreen.tsx +532 -43
  217. package/src/modules/setup/hooks/useSetupStatus.ts +93 -0
  218. package/src/modules/setup/services/setup.api.ts +141 -4
  219. package/src/modules/setup/utils/__tests__/root-folders.test.ts +72 -0
  220. package/src/modules/setup/utils/root-folders.ts +46 -0
  221. package/src/modules/toolbar/assets/claude-setup/01-add-manually.webp +0 -0
  222. package/src/modules/toolbar/assets/claude-setup/02-add-configuration.webp +0 -0
  223. package/src/modules/toolbar/assets/claude-setup/03-connect-account.webp +0 -0
  224. package/src/modules/toolbar/assets/claude-setup/04-pick-instance.webp +0 -0
  225. package/src/modules/toolbar/assets/claude-setup/05-plugins-add.webp +0 -0
  226. package/src/modules/toolbar/assets/claude-setup/06-add-marketplace.webp +0 -0
  227. package/src/modules/toolbar/assets/claude-setup/07-paste-url-sync.webp +0 -0
  228. package/src/modules/toolbar/assets/claude-setup/08-install-plugins.webp +0 -0
  229. package/src/modules/toolbar/assets/claude-setup/09-select-repository.webp +0 -0
  230. package/src/modules/toolbar/assets/claude-setup/10-connector-not-added.webp +0 -0
  231. package/src/modules/toolbar/assets/claude-setup/11-add-custom-connector.webp +0 -0
  232. package/src/modules/toolbar/assets/claude-setup/README.md +68 -0
  233. package/src/modules/toolbar/components/AgentInstructionsCard.tsx +296 -0
  234. package/src/modules/toolbar/components/ClaudeMarketplaceCarousel.tsx +107 -0
  235. package/src/modules/toolbar/components/ClaudeRegistrationSteps.tsx +127 -0
  236. package/src/modules/toolbar/components/CoworkSetupSteps.tsx +100 -0
  237. package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +177 -118
  238. package/src/modules/toolbar/components/ScreenshotStep.tsx +77 -0
  239. package/src/modules/toolbar/components/SetupCarousel.tsx +177 -0
  240. package/src/modules/toolbar/components/__tests__/AgentInstructionsCard.test.tsx +370 -0
  241. package/src/modules/toolbar/components/__tests__/ExternalAgentAccessPage.test.tsx +542 -42
  242. package/src/modules/toolbar/components/__tests__/Toolbar.test.tsx +2 -2
  243. package/src/modules/toolbar/components/__tests__/claude-setup-shots.test.ts +104 -0
  244. package/src/modules/toolbar/components/claude-connector-slide.tsx +38 -0
  245. package/src/modules/toolbar/components/claude-setup-shots.ts +167 -0
  246. package/src/modules/toolbar/components/deployment-address.ts +29 -0
  247. package/src/modules/toolbar/components/setup-step-parts.tsx +35 -0
  248. package/src/modules/toolbar/services/__tests__/agent-instructions.api.test.ts +89 -0
  249. package/src/modules/toolbar/services/agent-instructions.api.ts +167 -0
  250. package/src/modules/toolbar/services/external-api-keys.api.ts +8 -0
  251. package/src/modules/workflow/state/ChangeRequestStaleBinder.tsx +43 -0
  252. package/src/modules/workflow/state/EventBusProvider.tsx +122 -11
  253. package/src/modules/workflow/state/__tests__/EventBusProvider.storage.test.tsx +87 -0
  254. package/src/modules/workflow/state/__tests__/EventBusProvider.watch.test.tsx +223 -0
  255. package/src/modules/workflow/state/event-bus.context.ts +10 -0
  256. package/src/modules/workspace/__tests__/testFixtures.ts +5 -3
  257. package/src/modules/workspace/components/FileExplorer.tsx +1295 -191
  258. package/src/modules/workspace/components/FileRoute.tsx +353 -36
  259. package/src/modules/workspace/components/FileViewer.tsx +172 -46
  260. package/src/modules/workspace/components/KbDocumentShell.tsx +50 -6
  261. package/src/modules/workspace/components/KbPageHeader.tsx +120 -55
  262. package/src/modules/workspace/components/TreeActionConfirm.tsx +350 -0
  263. package/src/modules/workspace/components/__tests__/FileExplorer.test.tsx +2533 -129
  264. package/src/modules/workspace/components/__tests__/FileRoute.test.tsx +731 -18
  265. package/src/modules/workspace/components/__tests__/FileViewer.test.tsx +381 -12
  266. package/src/modules/workspace/components/__tests__/KbDocumentShell.test.tsx +39 -0
  267. package/src/modules/workspace/components/__tests__/KbPageHeader.test.tsx +33 -20
  268. package/src/modules/workspace/components/renderers/DocxRenderer.tsx +4 -5
  269. package/src/modules/workspace/components/renderers/DownloadFileButton.tsx +13 -4
  270. package/src/modules/workspace/components/renderers/EmailRenderer.tsx +4 -3
  271. package/src/modules/workspace/components/renderers/HtmlRenderer.tsx +8 -14
  272. package/src/modules/workspace/components/renderers/ImageRenderer.tsx +75 -16
  273. package/src/modules/workspace/components/renderers/KbImage.tsx +180 -0
  274. package/src/modules/workspace/components/renderers/KbMarkdownView.tsx +22 -6
  275. package/src/modules/workspace/components/renderers/MarkdownRenderer.tsx +48 -22
  276. package/src/modules/workspace/components/renderers/PdfRenderer.tsx +4 -5
  277. package/src/modules/workspace/components/renderers/PptxRenderer.tsx +4 -3
  278. package/src/modules/workspace/components/renderers/XlsxRenderer.tsx +4 -3
  279. package/src/modules/workspace/components/renderers/__tests__/DocxRenderer.test.tsx +12 -0
  280. package/src/modules/workspace/components/renderers/__tests__/DownloadFileButton.test.tsx +57 -9
  281. package/src/modules/workspace/components/renderers/__tests__/EmailRenderer.test.tsx +13 -1
  282. package/src/modules/workspace/components/renderers/__tests__/ImageRenderer.test.tsx +163 -0
  283. package/src/modules/workspace/components/renderers/__tests__/KbMarkdownView.test.tsx +237 -0
  284. package/src/modules/workspace/components/renderers/__tests__/MarkdownRenderer.test.tsx +108 -14
  285. package/src/modules/workspace/components/renderers/__tests__/PptxRenderer.test.tsx +14 -1
  286. package/src/modules/workspace/components/renderers/__tests__/XlsxRenderer.test.tsx +16 -1
  287. package/src/modules/workspace/components/renderers/__tests__/rendererSelection.test.tsx +66 -1
  288. package/src/modules/workspace/components/renderers/index.ts +53 -2
  289. package/src/modules/workspace/components/renderers/kbMarkdownPipeline.tsx +25 -4
  290. package/src/modules/workspace/components/renderers/rendererWorkspace.ts +40 -0
  291. package/src/modules/workspace/hooks/__tests__/useImageRevision.test.tsx +174 -0
  292. package/src/modules/workspace/hooks/__tests__/useOpenChangeRequests.test.tsx +179 -1
  293. package/src/modules/workspace/hooks/__tests__/useWorkspaceImageResolver.test.tsx +122 -0
  294. package/src/modules/workspace/hooks/__tests__/useWorkspaceState.test.tsx +892 -7
  295. package/src/modules/workspace/hooks/useImageRevision.ts +101 -0
  296. package/src/modules/workspace/hooks/useMergedWorkspaceTree.ts +22 -3
  297. package/src/modules/workspace/hooks/useWorkspaceImageResolver.ts +55 -0
  298. package/src/modules/workspace/hooks/useWorkspaceState.ts +424 -66
  299. package/src/modules/workspace/routing/__tests__/kb-routes.test.tsx +279 -3
  300. package/src/modules/workspace/routing/kb-routes.ts +206 -29
  301. package/src/modules/workspace/services/__tests__/workspace.api.test.ts +134 -1
  302. package/src/modules/workspace/services/workspace.api.ts +57 -4
  303. package/src/modules/workspace/state/__tests__/applied-request-clears-pending.test.tsx +343 -0
  304. package/src/modules/workspace/state/__tests__/upload-lands-where-it-was-dropped.test.tsx +158 -0
  305. package/src/modules/workspace/state/open-change-requests.tsx +100 -12
  306. package/src/modules/workspace/state/workspace.context.ts +125 -19
  307. package/src/modules/workspace/utils/__tests__/file-trace.test.ts +73 -0
  308. package/src/modules/workspace/utils/__tests__/fileTree.test.ts +220 -6
  309. package/src/modules/workspace/utils/__tests__/pasteLink.test.ts +76 -0
  310. package/src/modules/workspace/utils/__tests__/treeConfirm.test.ts +364 -0
  311. package/src/modules/workspace/utils/__tests__/uploadError.test.ts +35 -0
  312. package/src/modules/workspace/utils/file-trace.ts +50 -0
  313. package/src/modules/workspace/utils/fileTree.ts +112 -36
  314. package/src/modules/workspace/utils/frontmatter.ts +8 -4
  315. package/src/modules/workspace/utils/pasteLink.ts +90 -0
  316. package/src/modules/workspace/utils/treeConfirm.ts +338 -0
  317. package/src/modules/workspace/utils/uploadError.ts +29 -0
  318. package/src/shared/__tests__/marketplace-url.test.ts +6 -1
  319. package/src/shared/components/Button.tsx +16 -2
  320. package/src/shared/components/Dialog.tsx +27 -11
  321. package/src/shared/components/Menu.tsx +13 -1
  322. package/src/shared/components/PageShell.tsx +13 -8
  323. package/src/shared/components/__tests__/primitives.test.tsx +116 -2
  324. package/src/shared/components/__tests__/useFocusHandoff.test.tsx +192 -0
  325. package/src/shared/components/index.ts +2 -0
  326. package/src/shared/components/useDismissableMenu.ts +32 -10
  327. package/src/shared/components/useFocusHandoff.ts +51 -0
  328. package/src/shared/components/useLatestRef.ts +28 -0
  329. package/src/shared/markdown/Markdown.tsx +12 -3
  330. package/src/shared/markdown/__tests__/escapeSpacesInLinkDestinations.test.ts +39 -0
  331. package/src/shared/markdown/hrefs.ts +50 -0
  332. package/src/shared/marketplace-url.ts +33 -5
  333. package/src/shared/mcp/ChatGptInstallLink.tsx +3 -3
  334. package/src/shared/mcp/ConnectionInstructions.tsx +38 -27
  335. package/src/shared/mcp/__tests__/connect-snippets.test.ts +3 -3
  336. package/src/shared/mcp/connect-snippets.ts +14 -9
  337. package/src/shared/mcp/index.ts +1 -1
  338. package/src/shared/theme/__tests__/header-band.test.ts +197 -0
  339. package/src/shared/theme/header.ts +75 -0
  340. package/src/shared/theme/measure.ts +7 -4
  341. package/src/shared/theme/tokens.css +25 -0
  342. package/src/modules/library/__tests__/PluginsIndexPage.test.tsx +0 -363
  343. package/src/modules/library/__tests__/PluginsSidebar.locked.test.tsx +0 -97
  344. package/src/modules/library/components/PluginsIndexPage.tsx +0 -270
  345. package/src/modules/update-check/__tests__/UpdateBanner.test.tsx +0 -126
  346. package/src/modules/update-check/components/UpdateBanner.tsx +0 -92
  347. package/src/modules/update-check/services/update-check.api.ts +0 -24
@@ -1,6 +1,6 @@
1
1
  import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
2
2
  import { render, screen, fireEvent, waitFor, within } from '@testing-library/react';
3
- import { MemoryRouter, Route, Routes } from 'react-router-dom';
3
+ import { MemoryRouter, Route, Routes, useLocation } from 'react-router-dom';
4
4
  import type { ReactNode } from 'react';
5
5
  import {
6
6
  WorkspaceContext,
@@ -63,8 +63,13 @@ vi.mock('../../access/api', async (importOriginal) => {
63
63
  };
64
64
  });
65
65
 
66
+ const teamsMock = vi.hoisted(() => ({ listTeams: vi.fn() }));
67
+ vi.mock('../services/teams.api', () => ({ listTeams: teamsMock.listTeams }));
68
+ // The sidebar's change-request dock pulls in git wiring these routes do not exercise.
69
+ vi.mock('../../git/components/PullRequestsForMe', () => ({ PullRequestsForMe: () => null }));
70
+
66
71
  import { LibraryRoutes } from '../routes/LibraryRoutes';
67
- import { withAuth, TEST_PERSONAL_GROUP } from './auth-harness';
72
+ import { withAuth } from './auth-harness';
68
73
 
69
74
  const CATALOG: LibraryData = {
70
75
  loading: false,
@@ -74,7 +79,10 @@ const CATALOG: LibraryData = {
74
79
  { name: 'scratch', description: 'A skill in no plugin.', path: 'Skills/scratch' },
75
80
  ],
76
81
  tools: [],
82
+ pendingTools: [],
77
83
  ownedSkills: new Set(['outreach']),
84
+ writableSkills: new Set(['outreach']),
85
+ ownedTools: new Set(),
78
86
  allowedToolsBySkill: new Map(),
79
87
  pendingSkills: [],
80
88
  crs: [],
@@ -105,9 +113,9 @@ const PLUGINS: PluginSummary[] = [
105
113
  summary({ name: 'Finance', folders: ['Plugins/Finance'], canRead: false, canWrite: false }),
106
114
  ];
107
115
 
108
- function wrap(children: ReactNode) {
116
+ function wrap(children: ReactNode, isAdmin = false) {
109
117
  const adminValue = {
110
- isAdmin: false,
118
+ isAdmin,
111
119
  unreadCount: 0,
112
120
  lastSeen: null,
113
121
  markSeen: vi.fn(),
@@ -130,13 +138,21 @@ function wrap(children: ReactNode) {
130
138
  );
131
139
  }
132
140
 
133
- function renderLibrary(path = '/skills-and-tools') {
141
+ /** Stands in for the Groups & Members page: shows where "Manage members" landed. */
142
+ function LandedOn() {
143
+ const { pathname, search } = useLocation();
144
+ return <div data-testid="landed">{`${pathname}${search}`}</div>;
145
+ }
146
+
147
+ function renderLibrary(path = '/skills-and-tools', { isAdmin = false } = {}) {
134
148
  return render(
135
149
  <MemoryRouter initialEntries={[path]}>
136
150
  {wrap(
137
151
  <Routes>
138
152
  <Route path="/skills-and-tools/*" element={<LibraryRoutes />} />
153
+ <Route path="/directory-groups" element={<LandedOn />} />
139
154
  </Routes>,
155
+ isAdmin,
140
156
  )}
141
157
  </MemoryRouter>,
142
158
  );
@@ -169,6 +185,9 @@ describe('Library sidebar: right-click, end to end', () => {
169
185
  pluginsMock.listPlugins.mockResolvedValue(PLUGINS);
170
186
  pluginsMock.listJoinRequests.mockResolvedValue([]);
171
187
  pluginsMock.deletePlugin.mockResolvedValue(undefined);
188
+ teamsMock.listTeams.mockResolvedValue([
189
+ { name: 'GTM Team', plugins: ['GTM'], skills: ['outreach'], tools: [] },
190
+ ]);
172
191
  });
173
192
 
174
193
  // Only the globals this file stubs — NOT `restoreAllMocks`, which would strip
@@ -176,19 +195,21 @@ describe('Library sidebar: right-click, end to end', () => {
176
195
  // returning undefined for whichever test happens to run next.
177
196
  afterEach(() => vi.unstubAllGlobals());
178
197
 
179
- it('gives a plugin row the full menu, titled after the plugin', async () => {
198
+ /**
199
+ * A team row, like a lens, is a slice of the catalog and not a folder —
200
+ * there is nothing to add a skill TO and no `access.md` behind it. The
201
+ * plugin verbs (add to, manage access, delete) live on the plugin page and
202
+ * on the plugin's folder in the Plugins tree; the nav answers only with
203
+ * what the nav can do.
204
+ */
205
+ it('gives a team row the verbs a slice of the catalog can answer, titled after the team', async () => {
180
206
  renderLibrary();
181
- await openMenuOn(/^GTM/);
182
- expect(screen.getByRole('menu', { name: 'Actions for GTM' })).toBeInTheDocument();
183
- expect(menuItems()).toEqual(['Add a skill or tool', 'New plugin', 'Copy link', 'Manage access']);
207
+ await openMenuOn(/^GTM Team/);
208
+ expect(screen.getByRole('menu', { name: 'Actions for GTM Team' })).toBeInTheDocument();
209
+ expect(menuItems()).toEqual(['New plugin', 'Copy link']);
184
210
  });
185
211
 
186
- /**
187
- * A lens is a slice of the catalog, not a folder — there is nothing to add a
188
- * skill TO and no `access.md` behind it. The same call the plugin page's
189
- * `PageActions` makes when it hides `Share` on the personal page.
190
- */
191
- it('gives a lens row only the verbs a slice of the catalog can answer', async () => {
212
+ it('gives a lens row the same verbs', async () => {
192
213
  renderLibrary();
193
214
  await openMenuOn(/^Owned by me/);
194
215
  expect(menuItems()).toEqual(['New plugin', 'Copy link']);
@@ -196,57 +217,13 @@ describe('Library sidebar: right-click, end to end', () => {
196
217
  fireEvent.keyDown(document, { key: 'Escape' });
197
218
  await waitFor(() => expect(screen.queryByRole('menu')).toBeNull());
198
219
 
199
- await openMenuOn(new RegExp(`^${TEST_PERSONAL_GROUP}`));
220
+ await openMenuOn(/^Everything/);
200
221
  expect(menuItems()).toEqual(['New plugin', 'Copy link']);
201
222
  });
202
223
 
203
- /**
204
- * `Manage access` is UNGATED on `canWrite`, exactly as the plugin page's
205
- * `Share` is: for a non-writer the dialog renders read-only, which is
206
- * precisely what "who is this shared with?" should answer — and for an admin
207
- * locked out of a plugin it is the self-service way back in.
208
- */
209
- it('offers Manage access on a locked plugin too', async () => {
210
- renderLibrary();
211
- await openMenuOn('Finance (locked)');
212
- expect(screen.getByRole('menu', { name: 'Actions for Finance' })).toBeInTheDocument();
213
- expect(menuItems()).toContain('Manage access');
214
- });
215
-
216
- /**
217
- * Delete is the OWNER's verb: `isOwner` is the same verdict the backend's
218
- * DELETE route enforces, so the affordance appears for exactly the people
219
- * the endpoint will let through. GTM's default summary here says
220
- * `canWrite: true, isOwner: false` — the full-menu test above is therefore
221
- * also the proof that a mere MANAGER does not see the item.
222
- */
223
- it('offers Delete plugin to an owner, and drives the confirm → delete round-trip', async () => {
224
- pluginsMock.listPlugins.mockResolvedValue([summary({ isOwner: true })]);
225
- renderLibrary();
226
- await openMenuOn(/^GTM/);
227
- expect(menuItems()).toEqual([
228
- 'Add a skill or tool',
229
- 'New plugin',
230
- 'Copy link',
231
- 'Manage access',
232
- 'Delete plugin',
233
- ]);
234
-
235
- fireEvent.click(screen.getByRole('menuitem', { name: 'Delete plugin' }));
236
- // The menu hands over to the confirmation — nothing is deleted yet.
237
- const dialog = await screen.findByRole('dialog');
238
- expect(screen.queryByRole('menu')).toBeNull();
239
- expect(pluginsMock.deletePlugin).not.toHaveBeenCalled();
240
-
241
- fireEvent.click(within(dialog).getByRole('button', { name: 'Delete plugin' }));
242
- await waitFor(() => expect(pluginsMock.deletePlugin).toHaveBeenCalledWith('GTM'));
243
- // The layout says so — same voice as every other completed verb here.
244
- expect(await screen.findByText('Deleted GTM.')).toBeInTheDocument();
245
- });
246
-
247
224
  it('gives the empty nav space the one verb that belongs to the nav itself', async () => {
248
225
  renderLibrary();
249
- await navRow(/^GTM/);
226
+ await navRow(/^GTM Team/);
250
227
  fireEvent.contextMenu(nav(), { clientX: 40, clientY: 400 });
251
228
  await screen.findByRole('menu');
252
229
  expect(menuItems()).toEqual(['New plugin']);
@@ -254,52 +231,23 @@ describe('Library sidebar: right-click, end to end', () => {
254
231
 
255
232
  it('opens the new-plugin dialog from the menu', async () => {
256
233
  renderLibrary();
257
- await openMenuOn(/^GTM/);
234
+ await openMenuOn(/^GTM Team/);
258
235
  fireEvent.click(screen.getByRole('menuitem', { name: 'New plugin' }));
259
236
  expect(await screen.findByRole('dialog')).toBeInTheDocument();
260
237
  expect(screen.queryByRole('menu')).toBeNull();
261
238
  });
262
239
 
263
- it('opens the add dialog for the plugin that was clicked, not the page you are on', async () => {
264
- renderLibrary('/skills-and-tools/owned');
265
- await openMenuOn(/^GTM/);
266
- fireEvent.click(screen.getByRole('menuitem', { name: 'Add a skill or tool' }));
267
- // The dialog titles itself with its plugin — proof the layout captured the
268
- // ROW's plugin, and not the route it happened to be sitting on.
269
- const dialog = await screen.findByRole('dialog');
270
- expect(within(dialog).getByText('Add a skill or tool to GTM')).toBeInTheDocument();
271
- });
272
-
273
- it('opens Manage access on the plugin folder, under the KB dir', async () => {
274
- const access = await import('../../access/api');
275
- renderLibrary();
276
- await openMenuOn(/^GTM/);
277
- fireEvent.click(screen.getByRole('menuitem', { name: 'Manage access' }));
278
-
279
- await waitFor(() => expect(access.fetchFileAccess).toHaveBeenCalled());
280
- /**
281
- * The whole round trip, in one assertion. The layout hands the dialog a
282
- * WORKSPACE path (`<kbDirName>/<folder>`), the dialog strips that prefix
283
- * back off, and what reaches the resolver is the REPO-relative folder —
284
- * which is the only address `access.md` is written at. Get either half
285
- * wrong and this is `undefined/Plugins/GTM` or `knowledge-base/Plugins/GTM`,
286
- * and the dialog silently resolves a folder that does not exist. It is the
287
- * same handoff `PluginPage` makes, which is why it has to match exactly.
288
- */
289
- expect(vi.mocked(access.fetchFileAccess).mock.calls[0][1]).toBe('Plugins/GTM');
290
- });
291
-
292
240
  it("copies the clicked row's own URL, not the one you are standing on", async () => {
293
241
  const writeText = vi.fn().mockResolvedValue(undefined);
294
242
  vi.stubGlobal('navigator', { ...navigator, clipboard: { writeText } });
295
243
 
296
244
  renderLibrary('/skills-and-tools/owned');
297
- await openMenuOn(/^GTM/);
245
+ await openMenuOn(/^GTM Team/);
298
246
  fireEvent.click(screen.getByRole('menuitem', { name: 'Copy link' }));
299
247
 
300
248
  await waitFor(() =>
301
249
  expect(writeText).toHaveBeenCalledWith(
302
- `${window.location.origin}/skills-and-tools/plugins/GTM`,
250
+ `${window.location.origin}/skills-and-tools/teams/GTM%20Team`,
303
251
  ),
304
252
  );
305
253
  expect(await screen.findByText('Link copied.')).toBeInTheDocument();
@@ -313,7 +261,7 @@ describe('Library sidebar: right-click, end to end', () => {
313
261
  });
314
262
 
315
263
  renderLibrary();
316
- await openMenuOn(/^GTM/);
264
+ await openMenuOn(/^GTM Team/);
317
265
  fireEvent.click(screen.getByRole('menuitem', { name: 'Copy link' }));
318
266
 
319
267
  // The pill itself, not `getByRole('status')` — the tree carries a second
@@ -329,19 +277,76 @@ describe('Library sidebar: right-click, end to end', () => {
329
277
 
330
278
  it('closes on an outside click, and a left click still navigates', async () => {
331
279
  renderLibrary();
332
- await openMenuOn(/^GTM/);
280
+ await openMenuOn(/^GTM Team/);
333
281
  fireEvent.mouseDown(document.body);
334
282
  await waitFor(() => expect(screen.queryByRole('menu')).toBeNull());
335
283
 
336
- fireEvent.click(await navRow(/^GTM/));
337
- expect(await screen.findByRole('heading', { name: 'GTM', level: 1 })).toBeInTheDocument();
284
+ fireEvent.click(await navRow(/^GTM Team/));
285
+ expect(await screen.findByRole('heading', { name: 'GTM Team', level: 1 })).toBeInTheDocument();
338
286
  });
339
287
 
340
288
  it('hands focus back to the row on Escape', async () => {
341
289
  renderLibrary();
342
- const row = await openMenuOn(/^GTM/);
290
+ const row = await openMenuOn(/^GTM Team/);
343
291
  fireEvent.keyDown(document, { key: 'Escape' });
344
292
  await waitFor(() => expect(screen.queryByRole('menu')).toBeNull());
345
293
  expect(document.activeElement).toBe(row);
346
294
  });
347
295
  });
296
+
297
+ /**
298
+ * "Manage members" — an administrator's way from a group row to that group's
299
+ * roster. Everyone is not a group and has no roster; a non-admin cannot edit
300
+ * one, so neither sees the item.
301
+ */
302
+ describe('Library sidebar: Manage members', () => {
303
+ beforeEach(() => {
304
+ dataMock.useLibraryData.mockReturnValue(CATALOG);
305
+ pluginsMock.listPlugins.mockResolvedValue(PLUGINS);
306
+ pluginsMock.listJoinRequests.mockResolvedValue([]);
307
+ teamsMock.listTeams.mockResolvedValue([
308
+ { name: 'Everyone', plugins: [], skills: [], tools: [] },
309
+ { name: 'GTM Team', plugins: ['GTM'], skills: ['outreach'], tools: [] },
310
+ ]);
311
+ });
312
+
313
+ it("gives an admin's group row Manage members, below the items it already had", async () => {
314
+ renderLibrary('/skills-and-tools', { isAdmin: true });
315
+ await openMenuOn(/^GTM Team/);
316
+ expect(menuItems()).toEqual(['New plugin', 'Copy link', 'Manage members']);
317
+ });
318
+
319
+ it("opens the group's card on the Groups page, the group carried in the URL", async () => {
320
+ renderLibrary('/skills-and-tools', { isAdmin: true });
321
+ await openMenuOn(/^GTM Team/);
322
+ fireEvent.click(screen.getByRole('menuitem', { name: 'Manage members' }));
323
+ expect(await screen.findByTestId('landed')).toHaveTextContent(
324
+ '/directory-groups?group=GTM+Team',
325
+ );
326
+ expect(screen.queryByRole('menu')).toBeNull();
327
+ });
328
+
329
+ it('gives the Everyone row no Manage members, even for an admin', async () => {
330
+ renderLibrary('/skills-and-tools', { isAdmin: true });
331
+ await openMenuOn(/^Everyone/);
332
+ expect(menuItems()).toEqual(['New plugin', 'Copy link']);
333
+ });
334
+
335
+ it('gives no Manage members on a lens or the empty nav space', async () => {
336
+ renderLibrary('/skills-and-tools', { isAdmin: true });
337
+ await openMenuOn(/^Owned by me/);
338
+ expect(menuItems()).toEqual(['New plugin', 'Copy link']);
339
+ fireEvent.keyDown(document, { key: 'Escape' });
340
+ await waitFor(() => expect(screen.queryByRole('menu')).toBeNull());
341
+
342
+ fireEvent.contextMenu(nav(), { clientX: 40, clientY: 400 });
343
+ await screen.findByRole('menu');
344
+ expect(menuItems()).toEqual(['New plugin']);
345
+ });
346
+
347
+ it("leaves a non-admin's group menu unchanged", async () => {
348
+ renderLibrary('/skills-and-tools', { isAdmin: false });
349
+ await openMenuOn(/^GTM Team/);
350
+ expect(menuItems()).toEqual(['New plugin', 'Copy link']);
351
+ });
352
+ });
@@ -27,10 +27,14 @@ import { LinkSkillPanel } from '../components/LinkSkillPanel';
27
27
 
28
28
  const OK = { state: 'ok' as const, text: 'Ready' };
29
29
  const items: LibraryItem[] = [
30
- { kind: 'skill', id: 'deploy', name: 'deploy', description: 'Ship it.', owned: false, plugin: null, shared: true, plugins: [], path: 'Skills/Eng/deploy', status: OK },
31
- { kind: 'skill', id: 'outreach', name: 'outreach', description: '', owned: true, plugin: 'GTM', plugins: [{ name: 'GTM', linked: false, granted: true }], path: 'Plugins/GTM/skills/outreach', status: OK },
32
- { kind: 'skill', id: 'pitch', name: 'pitch', description: 'Sales pitch.', owned: false, plugin: 'Sales', plugins: [{ name: 'Sales', linked: false, granted: true }], path: 'Plugins/Sales/skills/pitch', status: OK },
33
- { kind: 'integration', id: 'notion', name: 'Notion', description: '', owned: false, plugin: 'GTM', path: 'Plugins/GTM/mcp.json', status: OK },
30
+ { kind: 'skill', id: 'deploy', name: 'deploy', description: 'Ship it.', owned: false, canWrite: false, plugin: null, shared: true, plugins: [], path: 'Skills/Eng/deploy', status: OK },
31
+ { kind: 'skill', id: 'outreach', name: 'outreach', description: '', owned: true, canWrite: true, plugin: 'GTM', plugins: [{ name: 'GTM', linked: false, granted: true }], path: 'Plugins/GTM/skills/outreach', status: OK },
32
+ { kind: 'skill', id: 'pitch', name: 'pitch', description: 'Sales pitch.', owned: false, canWrite: false, plugin: 'Sales', plugins: [{ name: 'Sales', linked: false, granted: true }], path: 'Plugins/Sales/skills/pitch', status: OK },
33
+ { kind: 'integration', id: 'notion', name: 'Notion', description: '', owned: false, canWrite: false, plugin: 'GTM', path: 'Plugins/GTM/mcp.json', status: OK },
34
+ // A skill whose SKILL.md still declares the old governance keys. The cast
35
+ // is the point: `lifecycle` is no longer part of `LibraryItem`, and a server
36
+ // that still sends it must not change what the picker offers.
37
+ { kind: 'skill', id: 'legacy', name: 'legacy', description: 'Old but readable.', owned: false, canWrite: false, plugin: null, shared: true, plugins: [], path: 'Skills/Eng/legacy', status: OK, lifecycle: 'retired' } as LibraryItem,
34
38
  ];
35
39
 
36
40
  function renderPanel() {
@@ -57,6 +61,17 @@ describe('LinkSkillPanel', () => {
57
61
  expect(screen.queryByText('Notion')).not.toBeInTheDocument();
58
62
  });
59
63
 
64
+ /**
65
+ * The picker used to hide skills declaring `metadata.lifecycle: retired`,
66
+ * mirroring a server refusal that no longer exists. Lifecycle is the
67
+ * authors' business now: the list offers every readable skill, and the key
68
+ * is ignored rather than acted on.
69
+ */
70
+ it('offers a skill whose frontmatter still says retired, like any other', () => {
71
+ renderPanel();
72
+ expect(screen.getByText('legacy')).toBeInTheDocument();
73
+ });
74
+
60
75
  it('narrows by the search box', () => {
61
76
  renderPanel();
62
77
  fireEvent.change(screen.getByLabelText('Search skills to link'), { target: { value: 'pit' } });
@@ -80,7 +95,7 @@ describe('LinkSkillPanel', () => {
80
95
  // The clicked row says what is happening; the others wait, still saying Link.
81
96
  const linking = await screen.findByRole('button', { name: 'Linking…' });
82
97
  expect(linking).toBeDisabled();
83
- expect(screen.getByRole('button', { name: 'Link' })).toBeDisabled();
98
+ for (const other of screen.getAllByRole('button', { name: 'Link' })) expect(other).toBeDisabled();
84
99
  // A disabled button drops focus, so the word is ALSO in a live region
85
100
  // that assistive tech reads out — and it clears once the link lands.
86
101
  expect(screen.getByRole('status', { name: 'Link progress' })).toHaveTextContent('Linking deploy…');
@@ -60,7 +60,8 @@ function renderLocked(plugin: PluginSummary = finance()) {
60
60
  return { ...view, onRequested, onUnlocked, onManage };
61
61
  }
62
62
 
63
- const askButton = () => screen.getByRole('button', { name: 'Subscribe to its skills and tools' });
63
+ const askButton = () => screen.getByRole('button', { name: 'Subscribe to this plugin' });
64
+ const pendingButton = () => screen.getByRole('button', { name: 'Requesting…' });
64
65
 
65
66
  describe('LockedPluginView', () => {
66
67
  beforeEach(() => {
@@ -74,7 +75,7 @@ describe('LockedPluginView', () => {
74
75
  expect(screen.getByText('Locked')).toBeInTheDocument();
75
76
  expect(screen.getByText('Run by Olga Ivanova.')).toBeInTheDocument();
76
77
  expect(screen.getByText('2 skills · 1 tool. Visible once you have access.')).toBeInTheDocument();
77
- expect(screen.getByRole('link', { name: 'All plugins' })).toHaveAttribute(
78
+ expect(screen.getByRole('link', { name: 'Everything' })).toHaveAttribute(
78
79
  'href',
79
80
  '/skills-and-tools',
80
81
  );
@@ -100,7 +101,7 @@ describe('LockedPluginView', () => {
100
101
  expect(screen.getByText('1 skill · 0 tools. Visible once you have access.')).toBeInTheDocument();
101
102
  });
102
103
 
103
- it('asks once, disables while in flight, and flips to the Requested box', async () => {
104
+ it('says "Requesting…" in the render after the click, refuses a second, and flips to the Requested box', async () => {
104
105
  let release = () => {};
105
106
  apiMock.requestPluginAccess.mockReturnValue(
106
107
  new Promise<void>((resolve) => {
@@ -110,8 +111,12 @@ describe('LockedPluginView', () => {
110
111
  const { onRequested } = renderLocked();
111
112
 
112
113
  fireEvent.click(askButton());
113
- expect(askButton()).toBeDisabled();
114
- fireEvent.click(askButton());
114
+ // The acknowledgement is the LABEL, not just the greying-out: the click
115
+ // used to leave a disabled button that still said "Subscribe", which is
116
+ // what read as a freeze for as long as the clone took.
117
+ expect(pendingButton()).toBeDisabled();
118
+ expect(screen.queryByRole('button', { name: 'Subscribe to this plugin' })).toBeNull();
119
+ fireEvent.click(pendingButton());
115
120
  expect(apiMock.requestPluginAccess).toHaveBeenCalledTimes(1);
116
121
  expect(apiMock.requestPluginAccess).toHaveBeenCalledWith('Finance');
117
122
 
@@ -120,7 +125,7 @@ describe('LockedPluginView', () => {
120
125
  await screen.findByText('Requested: Olga Ivanova decides who gets access.'),
121
126
  ).toBeInTheDocument();
122
127
  expect(
123
- screen.queryByRole('button', { name: 'Subscribe to its skills and tools' }),
128
+ screen.queryByRole('button', { name: 'Subscribe to this plugin' }),
124
129
  ).not.toBeInTheDocument();
125
130
  expect(onRequested).toHaveBeenCalledTimes(1);
126
131
  });
@@ -137,10 +142,58 @@ describe('LockedPluginView', () => {
137
142
  renderLocked(finance({ hasRequested: true }));
138
143
  expect(screen.getByText('Requested: Olga Ivanova decides who gets access.')).toBeInTheDocument();
139
144
  expect(
140
- screen.queryByRole('button', { name: 'Subscribe to its skills and tools' }),
145
+ screen.queryByRole('button', { name: 'Subscribe to this plugin' }),
141
146
  ).not.toBeInTheDocument();
142
147
  });
143
148
 
149
+ it('hands the button back with the reason when the background work failed', () => {
150
+ renderLocked(
151
+ finance({ hasRequested: false, requestFailure: 'the remote refused the push' }),
152
+ );
153
+ expect(
154
+ screen.getByText(
155
+ 'Your request to join Finance could not be sent: the remote refused the push. Try again.',
156
+ ),
157
+ ).toBeInTheDocument();
158
+ expect(askButton()).not.toBeDisabled();
159
+ expect(screen.queryByText(/^Requested/)).not.toBeInTheDocument();
160
+ });
161
+
162
+ it('names the plugin the way people read it in the failure sentence', () => {
163
+ renderLocked(
164
+ finance({ name: 'finance', displayName: 'Finance & Ops', requestFailure: 'the branch was refused' }),
165
+ );
166
+ expect(
167
+ screen.getByText(
168
+ 'Your request to join Finance & Ops could not be sent: the branch was refused. Try again.',
169
+ ),
170
+ ).toBeInTheDocument();
171
+ });
172
+
173
+ it('never shows a stale failure next to a standing request', () => {
174
+ // The two are mutually exclusive on the wire; the view does not rely on
175
+ // that, because a card saying "Requested" above a sentence saying it
176
+ // could not be sent is the one thing it must never render.
177
+ renderLocked(finance({ hasRequested: true, requestFailure: 'the remote refused the push' }));
178
+ expect(screen.getByText('Requested: Olga Ivanova decides who gets access.')).toBeInTheDocument();
179
+ expect(screen.queryByText(/could not be sent/)).toBeNull();
180
+ });
181
+
182
+ it('retrying after a failure asks again through the same endpoint', async () => {
183
+ const { onRequested } = renderLocked(
184
+ finance({ requestFailure: 'the remote refused the push' }),
185
+ );
186
+ fireEvent.click(askButton());
187
+ expect(apiMock.requestPluginAccess).toHaveBeenCalledWith('Finance');
188
+ // On the answer the card takes over — the failure sentence goes with the
189
+ // button it was explaining.
190
+ expect(
191
+ await screen.findByText('Requested: Olga Ivanova decides who gets access.'),
192
+ ).toBeInTheDocument();
193
+ expect(screen.queryByText(/could not be sent/)).toBeNull();
194
+ expect(onRequested).toHaveBeenCalledTimes(1);
195
+ });
196
+
144
197
  it('falls back to the admins, in the plural, when nobody is named', async () => {
145
198
  renderLocked(finance({ owners: { roles: [], users: [] }, writers: { roles: [], users: [] } }));
146
199
  expect(screen.getByText('Run by the workspace admins.')).toBeInTheDocument();
@@ -193,6 +246,43 @@ describe('LockedPluginView', () => {
193
246
  renderLocked();
194
247
  expect(screen.queryByRole('button', { name: 'Manage access' })).not.toBeInTheDocument();
195
248
  });
249
+
250
+ it('announces the in-flight request to a screen reader, not just on the button', async () => {
251
+ let release = () => {};
252
+ apiMock.requestPluginAccess.mockReturnValue(
253
+ new Promise<void>((resolve) => {
254
+ release = () => resolve();
255
+ }),
256
+ );
257
+ renderLocked(finance({ name: 'finance', displayName: 'Finance & Ops' }));
258
+
259
+ const live = screen.getByRole('status', { name: 'Request progress' });
260
+ expect(live).toHaveTextContent('');
261
+
262
+ fireEvent.click(askButton());
263
+ // Pressing the button disables it, and a disabled button drops focus —
264
+ // so the label change alone is never read out. The live region is what
265
+ // carries the acknowledgement this whole ticket exists to give.
266
+ expect(live).toHaveAttribute('aria-live', 'polite');
267
+ expect(live).toHaveTextContent('Requesting access to Finance & Ops…');
268
+
269
+ release();
270
+ await screen.findByText('Requested: Olga Ivanova decides who gets access.');
271
+
272
+ // AND IT STOPS. The success path never clears `requesting` — on purpose,
273
+ // so the button cannot flicker back to life between the answer and the
274
+ // Requested card — which left this region saying the request was still
275
+ // going for as long as the page stayed up. A screen-reader user reaching
276
+ // it after the card had rendered was told something untrue.
277
+ expect(screen.getByRole('status', { name: 'Request progress' })).toHaveTextContent('');
278
+ });
279
+
280
+ it('says nothing in the live region for a request that was already standing', () => {
281
+ // Arriving on a plugin already requested: there is no in-flight request
282
+ // to announce, so the region must be empty rather than describing one.
283
+ renderLocked(finance({ hasRequested: true }));
284
+ expect(screen.getByRole('status', { name: 'Request progress' })).toHaveTextContent('');
285
+ });
196
286
  });
197
287
 
198
288
  describe('name helpers', () => {
@@ -26,7 +26,7 @@ function LocationProbe() {
26
26
  return <div aria-label="pathname">{location.pathname}</div>;
27
27
  }
28
28
 
29
- function renderDialog(existing: string[] = ['GTM', 'Finance']) {
29
+ function renderDialog(existing: string[] = ['GTM', 'Finance'], parent?: string) {
30
30
  const onCreated = vi.fn();
31
31
  const onClose = vi.fn();
32
32
  render(
@@ -36,7 +36,7 @@ function renderDialog(existing: string[] = ['GTM', 'Finance']) {
36
36
  <Route
37
37
  path="*"
38
38
  element={
39
- <NewPluginDialog existing={existing} onClose={onClose} onCreated={onCreated} />
39
+ <NewPluginDialog existing={existing} parent={parent} onClose={onClose} onCreated={onCreated} />
40
40
  }
41
41
  />
42
42
  </Routes>
@@ -74,11 +74,20 @@ describe('NewPluginDialog', () => {
74
74
  fireEvent.change(field(), { target: { value: ' Design ' } });
75
75
  fireEvent.click(submit());
76
76
 
77
- // Trimmed — the endpoint owns everything after the name.
78
- await waitFor(() => expect(pluginsMock.createPlugin).toHaveBeenCalledWith('Design'));
77
+ // Trimmed — the endpoint owns everything after the name. No parent: the root.
78
+ await waitFor(() => expect(pluginsMock.createPlugin).toHaveBeenCalledWith('Design', ''));
79
79
  // The route is built from the SERVER's identity — not the typed name, not the folder.
80
80
  await waitFor(() => expect(pathname()).toBe('/skills-and-tools/plugins/design-id'));
81
81
  expect(onCreated).toHaveBeenCalledTimes(1);
82
+ expect(screen.queryByText(/This one goes in/)).toBeNull();
83
+ });
84
+
85
+ it('makes the plugin inside the folder it was opened from, and says so', async () => {
86
+ const { field, submit } = renderDialog(['GTM'], 'Teams/EU');
87
+ expect(screen.getByText(/This one goes in/)).toHaveTextContent('Teams/EU/');
88
+ fireEvent.change(field(), { target: { value: 'Design' } });
89
+ fireEvent.click(submit());
90
+ await waitFor(() => expect(pluginsMock.createPlugin).toHaveBeenCalledWith('Design', 'Teams/EU'));
82
91
  });
83
92
 
84
93
  it('refuses a name that is already taken, whoever can see it', () => {
@@ -1,6 +1,6 @@
1
1
  import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
2
2
  import { DEFAULT_BRANCH } from '@bevel-software/platform-shared';
3
- import { render, screen, fireEvent, waitFor } from '@testing-library/react';
3
+ import { render, screen, fireEvent, waitFor, within } from '@testing-library/react';
4
4
  import { MemoryRouter, Route, Routes, useLocation } from 'react-router-dom';
5
5
  import {
6
6
  WorkspaceContext,
@@ -115,7 +115,9 @@ describe('PersonalAddDialog', () => {
115
115
  const { field } = renderDialog();
116
116
  expect(field()).toBeInTheDocument();
117
117
  expect(screen.getByRole('button', { name: 'Copy prompt' })).toBeInTheDocument();
118
- expect(screen.getByText(/Yours alone until you add it to a plugin/)).toBeInTheDocument();
118
+ expect(
119
+ within(screen.getByRole('tabpanel')).getByText(/Yours alone until you add it to a plugin/),
120
+ ).toBeInTheDocument();
119
121
  });
120
122
 
121
123
  it('creates the skill as PERSONAL. Destination resolution belongs to the api layer', async () => {
@@ -171,7 +173,81 @@ describe('PersonalAddDialog', () => {
171
173
  expect(screen.queryByRole('textbox', { name: 'Skill name' })).not.toBeInTheDocument();
172
174
  expect(screen.getByRole('button', { name: 'Copy prompt' })).toBeInTheDocument();
173
175
  expect(screen.getByText(/Tell your agent what you need/)).toBeInTheDocument();
174
- expect(screen.getByText(/Yours alone until you add it to a plugin/)).toBeInTheDocument();
176
+ expect(
177
+ within(screen.getByRole('tabpanel')).getByText(/Yours alone until you add it to a plugin/),
178
+ ).toBeInTheDocument();
175
179
  expect(apiMock.createEmptySkill).not.toHaveBeenCalled();
176
180
  });
177
181
  });
182
+
183
+ // Both panels stay mounted and the inactive one is hidden, so the Skills half
184
+ // never loses a half-typed name to a tab click. Text assertions are therefore
185
+ // scoped to the visible panel — the note about landing in your own list is
186
+ // worded identically on both tabs.
187
+ describe('PersonalAddDialog: Skills and Tools tabs', () => {
188
+ const SKILL_PROMPT =
189
+ 'Help me build a new skill or tool at Bevel. Keep it to myself for now. It goes in my own list, not a plugin.';
190
+ const TOOL_PROMPT =
191
+ 'Help me build a new tool at Bevel. Keep it to myself for now. It goes in my own list, not a plugin.';
192
+ const writeText = vi.fn<(text: string) => Promise<void>>();
193
+
194
+ /** The visible tabpanel. Role queries skip the hidden one. */
195
+ const panel = () => screen.getByRole('tabpanel');
196
+
197
+ beforeEach(() => {
198
+ writeText.mockReset();
199
+ writeText.mockResolvedValue(undefined);
200
+ Object.defineProperty(navigator, 'clipboard', { value: { writeText }, configurable: true });
201
+ });
202
+
203
+ afterEach(() => {
204
+ Reflect.deleteProperty(navigator, 'clipboard');
205
+ });
206
+
207
+ it('opens on an unchanged Skills tab', () => {
208
+ renderDialog();
209
+ expect(screen.getAllByRole('tab').map((t) => t.textContent)).toEqual(['Skills', 'Tools']);
210
+ expect(screen.getByRole('tab', { name: 'Skills' })).toHaveAttribute('aria-selected', 'true');
211
+ expect(panel()).toHaveAccessibleName('Skills');
212
+ expect(within(panel()).getByText(SKILL_PROMPT)).toBeInTheDocument();
213
+ expect(screen.getByText(TOOL_PROMPT)).not.toBeVisible();
214
+ expect(screen.getByRole('heading', { name: 'Add a skill or tool' })).toBeInTheDocument();
215
+ });
216
+
217
+ it('explains tools without a form, and copies the tool prompt', async () => {
218
+ renderDialog();
219
+ fireEvent.click(screen.getByRole('tab', { name: 'Tools' }));
220
+
221
+ expect(panel()).toHaveAccessibleName('Tools');
222
+ expect(within(panel()).getByText(TOOL_PROMPT)).toBeInTheDocument();
223
+ expect(screen.getByText(SKILL_PROMPT)).not.toBeVisible();
224
+ expect(
225
+ within(panel()).getByText(/Yours alone until you add it to a plugin/),
226
+ ).toBeInTheDocument();
227
+ expect(
228
+ within(panel()).getByText(
229
+ 'To connect an MCP server, add it to the mcp.json in your own folder.',
230
+ ),
231
+ ).toBeInTheDocument();
232
+ expect(
233
+ within(panel()).getByText(
234
+ 'To call an API without an MCP server, add a .tool manual describing it under software.bevel.hexis/tools/ in your own folder.',
235
+ ),
236
+ ).toBeInTheDocument();
237
+ expect(screen.queryByRole('textbox')).not.toBeInTheDocument();
238
+
239
+ fireEvent.click(screen.getByRole('button', { name: 'Copy prompt' }));
240
+ await waitFor(() => expect(writeText).toHaveBeenCalledWith(TOOL_PROMPT));
241
+ expect(apiMock.createEmptySkill).not.toHaveBeenCalled();
242
+ });
243
+
244
+ it('keeps a typed skill name across a tab round trip', () => {
245
+ const { field } = renderDialog();
246
+ fireEvent.change(field(), { target: { value: 'scratch' } });
247
+
248
+ fireEvent.click(screen.getByRole('tab', { name: 'Tools' }));
249
+ fireEvent.click(screen.getByRole('tab', { name: 'Skills' }));
250
+
251
+ expect(field()).toHaveValue('scratch');
252
+ });
253
+ });