@bevel-software/platform-core-frontend 0.15.1 → 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 (346) hide show
  1. package/THIRD-PARTY-NOTICES.md +2 -2
  2. package/package.json +3 -3
  3. package/src/core/CoreAppShell.tsx +16 -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__/ConnectionKeysPage.test.tsx +266 -0
  32. package/src/modules/admin/__tests__/DirectoryGroupsPage.suggest.test.tsx +182 -0
  33. package/src/modules/admin/__tests__/DirectoryGroupsPage.test.tsx +165 -14
  34. package/src/modules/admin/__tests__/UserAccountsPage.test.tsx +401 -4
  35. package/src/modules/admin/__tests__/group-members-path.test.ts +27 -0
  36. package/src/modules/admin/components/AddMemberInput.tsx +268 -0
  37. package/src/modules/admin/components/AdminRolesPage.tsx +97 -132
  38. package/src/modules/admin/components/ConnectionKeysPage.tsx +269 -0
  39. package/src/modules/admin/components/DirectoryGroupsPage.tsx +91 -39
  40. package/src/modules/admin/components/UserAccountsPage.tsx +271 -37
  41. package/src/modules/admin/components/connection-keys-grouping.ts +43 -0
  42. package/src/modules/admin/components/group-members-path.ts +32 -0
  43. package/src/modules/admin/services/connection-keys.api.ts +47 -0
  44. package/src/modules/admin/services/roles.api.ts +12 -1
  45. package/src/modules/auth/__tests__/AccountPage.test.tsx +50 -2
  46. package/src/modules/auth/components/AccountPage.tsx +73 -54
  47. package/src/modules/auth/components/LoginScreen.tsx +1 -0
  48. package/src/modules/auth/services/account.api.ts +78 -4
  49. package/src/modules/change-requests/__tests__/ChangeRequestDialog.access-rules.test.tsx +144 -0
  50. package/src/modules/change-requests/__tests__/ChangeRequestDialog.binary.test.tsx +422 -0
  51. package/src/modules/change-requests/__tests__/ChangeRequestDialog.brings-itself-up-to-date.test.tsx +431 -0
  52. package/src/modules/change-requests/__tests__/ChangeRequestDialog.fork-point.test.tsx +193 -0
  53. package/src/modules/change-requests/__tests__/ChangeRequestDialog.initial-file.test.tsx +142 -0
  54. package/src/modules/change-requests/__tests__/ChangeRequestDialog.moved.test.tsx +202 -0
  55. package/src/modules/change-requests/__tests__/ChangeRequestDialog.test.tsx +205 -13
  56. package/src/modules/change-requests/__tests__/ChangeRequestDialog.unreadable.test.tsx +271 -0
  57. package/src/modules/change-requests/__tests__/FileChangeBoxes.test.tsx +208 -0
  58. package/src/modules/change-requests/__tests__/apply-outcome-for-every-viewer.test.tsx +286 -0
  59. package/src/modules/change-requests/__tests__/propose.concurrent.test.ts +273 -0
  60. package/src/modules/change-requests/__tests__/readFailure.test.ts +122 -0
  61. package/src/modules/change-requests/__tests__/useCrFileDiffs.test.tsx +238 -0
  62. package/src/modules/change-requests/__tests__/useFileOnBranch.test.tsx +56 -1
  63. package/src/modules/change-requests/__tests__/useForkPointFile.test.tsx +79 -0
  64. package/src/modules/change-requests/components/BranchFilePreview.tsx +357 -0
  65. package/src/modules/change-requests/components/ChangeBox.tsx +31 -2
  66. package/src/modules/change-requests/components/ChangeRequestDialog.tsx +862 -72
  67. package/src/modules/change-requests/components/CrFileTree.tsx +74 -58
  68. package/src/modules/change-requests/components/FileChangeBoxes.tsx +19 -15
  69. package/src/modules/change-requests/hooks/useApplyChangeRequest.ts +41 -7
  70. package/src/modules/change-requests/hooks/useCrFileDiffs.ts +181 -23
  71. package/src/modules/change-requests/hooks/useFileOnBranch.ts +70 -7
  72. package/src/modules/change-requests/hooks/useForkPointFile.ts +77 -0
  73. package/src/modules/change-requests/services/change-requests.api.ts +57 -1
  74. package/src/modules/change-requests/services/denied-file.api.ts +53 -0
  75. package/src/modules/change-requests/services/propose.api.ts +97 -8
  76. package/src/modules/change-requests/utils/approval.ts +15 -0
  77. package/src/modules/change-requests/utils/author.ts +32 -0
  78. package/src/modules/change-requests/utils/readFailure.ts +110 -0
  79. package/src/modules/git/__tests__/FileHistoryPanel.test.tsx +20 -0
  80. package/src/modules/git/components/FileHistoryPanel.tsx +5 -0
  81. package/src/modules/git/components/PullRequestsForMe.tsx +51 -24
  82. package/src/modules/git/services/__tests__/error-messages.test.ts +29 -0
  83. package/src/modules/git/services/error-messages.ts +12 -0
  84. package/src/modules/git/services/pr-prompts.ts +5 -5
  85. package/src/modules/layout/__tests__/HeaderAlignment.test.tsx +401 -0
  86. package/src/modules/layout/__tests__/SidebarFooterGrid.test.tsx +286 -0
  87. package/src/modules/layout/__tests__/SidebarFrameResponsive.test.tsx +61 -0
  88. package/src/modules/layout/components/AppLayout.tsx +2 -0
  89. package/src/modules/layout/components/MobileChatLayout.tsx +4 -1
  90. package/src/modules/layout/components/ResizableThreePaneLayout.tsx +4 -1
  91. package/src/modules/layout/components/SidebarFrame.tsx +108 -3
  92. package/src/modules/library/__tests__/AddToPluginDialog.test.tsx +171 -5
  93. package/src/modules/library/__tests__/DeleteToolDialog.test.tsx +356 -0
  94. package/src/modules/library/__tests__/IntegrationsSetupReminder.test.tsx +60 -0
  95. package/src/modules/library/__tests__/LibraryCard.test.tsx +91 -10
  96. package/src/modules/library/__tests__/LibraryRoutes.test.tsx +242 -107
  97. package/src/modules/library/__tests__/LibrarySidebarMenu.test.tsx +103 -98
  98. package/src/modules/library/__tests__/LinkSkillPanel.test.tsx +20 -5
  99. package/src/modules/library/__tests__/LockedPluginView.test.tsx +97 -7
  100. package/src/modules/library/__tests__/NewPluginDialog.test.tsx +13 -4
  101. package/src/modules/library/__tests__/PersonalAddDialog.test.tsx +79 -3
  102. package/src/modules/library/__tests__/PersonalPluginPage.test.tsx +201 -0
  103. package/src/modules/library/__tests__/PluginExtras.test.tsx +100 -9
  104. package/src/modules/library/__tests__/PluginJoinRequests.test.tsx +60 -1
  105. package/src/modules/library/__tests__/PluginPage.test.tsx +258 -6
  106. package/src/modules/library/__tests__/PluginsSidebar.contextmenu.test.tsx +16 -56
  107. package/src/modules/library/__tests__/PluginsSidebar.test.tsx +155 -152
  108. package/src/modules/library/__tests__/PluginsSidebarMenu.test.tsx +16 -0
  109. package/src/modules/library/__tests__/SharedViaPlugins.test.tsx +106 -0
  110. package/src/modules/library/__tests__/SkillPage.test.tsx +386 -80
  111. package/src/modules/library/__tests__/SkillsTree.test.tsx +293 -4
  112. package/src/modules/library/__tests__/ToolConnectionSection.test.tsx +582 -71
  113. package/src/modules/library/__tests__/ToolPage.test.tsx +87 -4
  114. package/src/modules/library/__tests__/WorkspaceItemRoute.test.tsx +173 -26
  115. package/src/modules/library/__tests__/auth-harness.tsx +9 -9
  116. package/src/modules/library/__tests__/card-row-menu.test.tsx +320 -0
  117. package/src/modules/library/__tests__/library-data.mapping.test.tsx +98 -0
  118. package/src/modules/library/__tests__/library-data.stale.test.tsx +121 -28
  119. package/src/modules/library/__tests__/library-data.test.ts +7 -0
  120. package/src/modules/library/__tests__/library-paths.test.ts +47 -4
  121. package/src/modules/library/__tests__/link-membership.test.ts +13 -4
  122. package/src/modules/library/__tests__/name-with-badges.test.tsx +273 -0
  123. package/src/modules/library/__tests__/newSkillMarkdown.test.ts +30 -0
  124. package/src/modules/library/__tests__/owner-pill.test.tsx +357 -0
  125. package/src/modules/library/__tests__/pending-tools.test.tsx +400 -0
  126. package/src/modules/library/__tests__/plugin-entries.test.ts +122 -0
  127. package/src/modules/library/__tests__/plugin-summary.test.ts +36 -1
  128. package/src/modules/library/__tests__/status.test.ts +82 -2
  129. package/src/modules/library/__tests__/tools.api.test.ts +44 -1
  130. package/src/modules/library/components/AccessRequestsBanner.tsx +85 -47
  131. package/src/modules/library/components/AddDialogTabs.tsx +103 -0
  132. package/src/modules/library/components/AddToPluginDialog.tsx +74 -18
  133. package/src/modules/library/components/IntegrationsSetupReminder.tsx +59 -0
  134. package/src/modules/library/components/ItemActionsMenu.tsx +288 -0
  135. package/src/modules/library/components/LibraryCard.tsx +146 -45
  136. package/src/modules/library/components/LibraryLayout.tsx +119 -256
  137. package/src/modules/library/components/LibraryPage.tsx +172 -39
  138. package/src/modules/library/components/LinkSkillPanel.tsx +1 -3
  139. package/src/modules/library/components/LockedPluginView.tsx +62 -34
  140. package/src/modules/library/components/NameWithBadges.tsx +164 -0
  141. package/src/modules/library/components/NewPluginDialog.tsx +16 -2
  142. package/src/modules/library/components/PageActions.tsx +11 -9
  143. package/src/modules/library/components/{PendingSkillReview.tsx → PendingItemReview.tsx} +14 -7
  144. package/src/modules/library/components/PersonalAddDialog.tsx +68 -18
  145. package/src/modules/library/components/PersonalPluginPage.tsx +121 -22
  146. package/src/modules/library/components/PluginExtras.tsx +140 -17
  147. package/src/modules/library/components/PluginIndexRow.tsx +47 -12
  148. package/src/modules/library/components/PluginPage.tsx +157 -41
  149. package/src/modules/library/components/PluginRows.tsx +286 -0
  150. package/src/modules/library/components/PluginsSidebar.tsx +239 -263
  151. package/src/modules/library/components/PluginsSidebarMenu.tsx +26 -1
  152. package/src/modules/library/components/ShareButton.tsx +17 -0
  153. package/src/modules/library/components/SkillsTree.tsx +141 -28
  154. package/src/modules/library/components/TeamRoute.tsx +15 -0
  155. package/src/modules/library/components/__tests__/upload-notices-once-per-page.test.tsx +144 -0
  156. package/src/modules/library/components/plugin-page-parts.tsx +103 -17
  157. package/src/modules/library/components/skill-page/SharedViaPlugins.tsx +6 -12
  158. package/src/modules/library/components/skill-page/SkillFilePane.tsx +5 -0
  159. package/src/modules/library/components/skill-page/SkillPage.tsx +274 -122
  160. package/src/modules/library/components/tool-page/DeleteToolDialog.tsx +218 -0
  161. package/src/modules/library/components/tool-page/ToolConnectionSection.tsx +79 -178
  162. package/src/modules/library/components/tool-page/ToolPage.tsx +106 -16
  163. package/src/modules/library/components/tool-page/ToolVarRow.tsx +42 -41
  164. package/src/modules/library/hooks/__tests__/useLibraryData.test.ts +98 -0
  165. package/src/modules/library/hooks/useLibraryData.ts +92 -19
  166. package/src/modules/library/routes/LibraryRoutes.tsx +14 -11
  167. package/src/modules/library/routes/WorkspaceItemRoute.tsx +77 -27
  168. package/src/modules/library/routes/library-paths.ts +26 -28
  169. package/src/modules/library/services/library.api.ts +38 -20
  170. package/src/modules/library/services/plugins.api.ts +69 -8
  171. package/src/modules/library/services/teams.api.ts +15 -0
  172. package/src/modules/library/services/tools.api.ts +78 -0
  173. package/src/modules/library/state/library-data.tsx +170 -32
  174. package/src/modules/library/utils/personal-plugin.ts +13 -15
  175. package/src/modules/library/utils/plugin-entries.ts +134 -0
  176. package/src/modules/library/utils/plugin-summary.ts +75 -9
  177. package/src/modules/library/utils/status.ts +135 -33
  178. package/src/modules/onboarding/__tests__/creator-welcome.test.tsx +8 -1
  179. package/src/modules/onboarding/__tests__/onboarding.test.tsx +853 -760
  180. package/src/modules/onboarding/agent-clients.ts +55 -23
  181. package/src/modules/onboarding/components/ConnectAgentPill.tsx +5 -1
  182. package/src/modules/onboarding/components/WelcomePage.tsx +98 -62
  183. package/src/modules/pr/services/pr-merge.api.ts +2 -1
  184. package/src/modules/review/components/MarkdownDiffViewer.tsx +53 -8
  185. package/src/modules/review/components/ReviewPanel.tsx +15 -17
  186. package/src/modules/review/components/__tests__/MarkdownDiffViewer.test.tsx +64 -0
  187. package/src/modules/review/components/__tests__/ReviewPanel.test.tsx +25 -1
  188. package/src/modules/secrets-vault/components/ConnectToolsPage.tsx +454 -117
  189. package/src/modules/secrets-vault/components/SecretsPage.tsx +48 -7
  190. package/src/modules/secrets-vault/components/ToolSecretsPanel.tsx +84 -5
  191. package/src/modules/secrets-vault/components/__tests__/ConnectToolsPage.test.tsx +425 -0
  192. package/src/modules/secrets-vault/components/__tests__/SecretsPage.test.tsx +417 -82
  193. package/src/modules/secrets-vault/components/__tests__/ToolSecretsPanel.test.tsx +105 -0
  194. package/src/modules/secrets-vault/components/__tests__/connect-lists-what-the-banner-counted.test.tsx +407 -0
  195. package/src/modules/secrets-vault/probe/SavedKeyProbeResult.tsx +98 -0
  196. package/src/modules/secrets-vault/probe/__tests__/probe-verdict.test.ts +160 -0
  197. package/src/modules/secrets-vault/probe/probe-verdict.ts +108 -0
  198. package/src/modules/secrets-vault/probe/useSavedKeyProbe.ts +228 -0
  199. package/src/modules/secrets-vault/services/connect.api.ts +36 -5
  200. package/src/modules/secrets-vault/utils/connect-status.ts +98 -0
  201. package/src/modules/settings/components/ClaudeConnectionCard.tsx +9 -24
  202. package/src/modules/settings/components/ClaudeConnectionFields.tsx +23 -0
  203. package/src/modules/settings/components/DeploymentPage.tsx +10 -30
  204. package/src/modules/settings/components/MarketplaceSection.tsx +152 -0
  205. package/src/modules/settings/components/__tests__/DeploymentPage.test.tsx +67 -4
  206. package/src/modules/settings/components/__tests__/MarketplaceSection.test.tsx +325 -0
  207. package/src/modules/settings/components/__tests__/SettingsLayout.test.tsx +5 -5
  208. package/src/modules/settings/services/github-facade.api.ts +23 -0
  209. package/src/modules/settings/settings-nav-items.tsx +10 -2
  210. package/src/modules/setup/__tests__/setup.oidc.test.tsx +172 -0
  211. package/src/modules/setup/__tests__/setup.probe-refusal.test.tsx +123 -0
  212. package/src/modules/setup/__tests__/setup.test.tsx +497 -4
  213. package/src/modules/setup/__tests__/useSetupStatus.test.tsx +130 -0
  214. package/src/modules/setup/components/SetupGate.tsx +16 -16
  215. package/src/modules/setup/components/SetupScreen.tsx +521 -43
  216. package/src/modules/setup/hooks/useSetupStatus.ts +93 -0
  217. package/src/modules/setup/services/setup.api.ts +140 -3
  218. package/src/modules/setup/utils/__tests__/root-folders.test.ts +72 -0
  219. package/src/modules/setup/utils/root-folders.ts +46 -0
  220. package/src/modules/toolbar/assets/claude-setup/01-add-manually.webp +0 -0
  221. package/src/modules/toolbar/assets/claude-setup/02-add-configuration.webp +0 -0
  222. package/src/modules/toolbar/assets/claude-setup/03-connect-account.webp +0 -0
  223. package/src/modules/toolbar/assets/claude-setup/04-pick-instance.webp +0 -0
  224. package/src/modules/toolbar/assets/claude-setup/05-plugins-add.webp +0 -0
  225. package/src/modules/toolbar/assets/claude-setup/06-add-marketplace.webp +0 -0
  226. package/src/modules/toolbar/assets/claude-setup/07-paste-url-sync.webp +0 -0
  227. package/src/modules/toolbar/assets/claude-setup/08-install-plugins.webp +0 -0
  228. package/src/modules/toolbar/assets/claude-setup/09-select-repository.webp +0 -0
  229. package/src/modules/toolbar/assets/claude-setup/10-connector-not-added.webp +0 -0
  230. package/src/modules/toolbar/assets/claude-setup/11-add-custom-connector.webp +0 -0
  231. package/src/modules/toolbar/assets/claude-setup/README.md +68 -0
  232. package/src/modules/toolbar/components/AgentInstructionsCard.tsx +296 -0
  233. package/src/modules/toolbar/components/ClaudeMarketplaceCarousel.tsx +107 -0
  234. package/src/modules/toolbar/components/ClaudeRegistrationSteps.tsx +127 -0
  235. package/src/modules/toolbar/components/CoworkSetupSteps.tsx +100 -0
  236. package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +177 -118
  237. package/src/modules/toolbar/components/ScreenshotStep.tsx +77 -0
  238. package/src/modules/toolbar/components/SetupCarousel.tsx +177 -0
  239. package/src/modules/toolbar/components/__tests__/AgentInstructionsCard.test.tsx +370 -0
  240. package/src/modules/toolbar/components/__tests__/ExternalAgentAccessPage.test.tsx +542 -42
  241. package/src/modules/toolbar/components/__tests__/Toolbar.test.tsx +2 -2
  242. package/src/modules/toolbar/components/__tests__/claude-setup-shots.test.ts +104 -0
  243. package/src/modules/toolbar/components/claude-connector-slide.tsx +38 -0
  244. package/src/modules/toolbar/components/claude-setup-shots.ts +167 -0
  245. package/src/modules/toolbar/components/deployment-address.ts +29 -0
  246. package/src/modules/toolbar/components/setup-step-parts.tsx +35 -0
  247. package/src/modules/toolbar/services/__tests__/agent-instructions.api.test.ts +89 -0
  248. package/src/modules/toolbar/services/agent-instructions.api.ts +167 -0
  249. package/src/modules/toolbar/services/external-api-keys.api.ts +6 -0
  250. package/src/modules/workflow/state/ChangeRequestStaleBinder.tsx +43 -0
  251. package/src/modules/workflow/state/EventBusProvider.tsx +122 -11
  252. package/src/modules/workflow/state/__tests__/EventBusProvider.storage.test.tsx +87 -0
  253. package/src/modules/workflow/state/__tests__/EventBusProvider.watch.test.tsx +223 -0
  254. package/src/modules/workflow/state/event-bus.context.ts +10 -0
  255. package/src/modules/workspace/__tests__/testFixtures.ts +5 -3
  256. package/src/modules/workspace/components/FileExplorer.tsx +1295 -191
  257. package/src/modules/workspace/components/FileRoute.tsx +353 -36
  258. package/src/modules/workspace/components/FileViewer.tsx +166 -45
  259. package/src/modules/workspace/components/KbDocumentShell.tsx +50 -6
  260. package/src/modules/workspace/components/KbPageHeader.tsx +120 -55
  261. package/src/modules/workspace/components/TreeActionConfirm.tsx +350 -0
  262. package/src/modules/workspace/components/__tests__/FileExplorer.test.tsx +2473 -129
  263. package/src/modules/workspace/components/__tests__/FileRoute.test.tsx +731 -18
  264. package/src/modules/workspace/components/__tests__/FileViewer.test.tsx +331 -12
  265. package/src/modules/workspace/components/__tests__/KbDocumentShell.test.tsx +39 -0
  266. package/src/modules/workspace/components/__tests__/KbPageHeader.test.tsx +33 -20
  267. package/src/modules/workspace/components/renderers/DocxRenderer.tsx +4 -5
  268. package/src/modules/workspace/components/renderers/DownloadFileButton.tsx +13 -4
  269. package/src/modules/workspace/components/renderers/EmailRenderer.tsx +4 -3
  270. package/src/modules/workspace/components/renderers/HtmlRenderer.tsx +8 -14
  271. package/src/modules/workspace/components/renderers/ImageRenderer.tsx +75 -16
  272. package/src/modules/workspace/components/renderers/KbImage.tsx +180 -0
  273. package/src/modules/workspace/components/renderers/KbMarkdownView.tsx +22 -6
  274. package/src/modules/workspace/components/renderers/MarkdownRenderer.tsx +48 -22
  275. package/src/modules/workspace/components/renderers/PdfRenderer.tsx +4 -5
  276. package/src/modules/workspace/components/renderers/PptxRenderer.tsx +4 -3
  277. package/src/modules/workspace/components/renderers/XlsxRenderer.tsx +4 -3
  278. package/src/modules/workspace/components/renderers/__tests__/DocxRenderer.test.tsx +12 -0
  279. package/src/modules/workspace/components/renderers/__tests__/DownloadFileButton.test.tsx +57 -9
  280. package/src/modules/workspace/components/renderers/__tests__/EmailRenderer.test.tsx +13 -1
  281. package/src/modules/workspace/components/renderers/__tests__/ImageRenderer.test.tsx +163 -0
  282. package/src/modules/workspace/components/renderers/__tests__/KbMarkdownView.test.tsx +237 -0
  283. package/src/modules/workspace/components/renderers/__tests__/MarkdownRenderer.test.tsx +108 -14
  284. package/src/modules/workspace/components/renderers/__tests__/PptxRenderer.test.tsx +14 -1
  285. package/src/modules/workspace/components/renderers/__tests__/XlsxRenderer.test.tsx +16 -1
  286. package/src/modules/workspace/components/renderers/__tests__/rendererSelection.test.tsx +66 -1
  287. package/src/modules/workspace/components/renderers/index.ts +53 -2
  288. package/src/modules/workspace/components/renderers/kbMarkdownPipeline.tsx +25 -4
  289. package/src/modules/workspace/components/renderers/rendererWorkspace.ts +40 -0
  290. package/src/modules/workspace/hooks/__tests__/useImageRevision.test.tsx +174 -0
  291. package/src/modules/workspace/hooks/__tests__/useOpenChangeRequests.test.tsx +179 -1
  292. package/src/modules/workspace/hooks/__tests__/useWorkspaceImageResolver.test.tsx +122 -0
  293. package/src/modules/workspace/hooks/__tests__/useWorkspaceState.test.tsx +892 -7
  294. package/src/modules/workspace/hooks/useImageRevision.ts +101 -0
  295. package/src/modules/workspace/hooks/useMergedWorkspaceTree.ts +22 -3
  296. package/src/modules/workspace/hooks/useWorkspaceImageResolver.ts +55 -0
  297. package/src/modules/workspace/hooks/useWorkspaceState.ts +424 -66
  298. package/src/modules/workspace/routing/__tests__/kb-routes.test.tsx +279 -3
  299. package/src/modules/workspace/routing/kb-routes.ts +206 -29
  300. package/src/modules/workspace/services/__tests__/workspace.api.test.ts +57 -1
  301. package/src/modules/workspace/services/workspace.api.ts +57 -4
  302. package/src/modules/workspace/state/__tests__/applied-request-clears-pending.test.tsx +343 -0
  303. package/src/modules/workspace/state/__tests__/upload-lands-where-it-was-dropped.test.tsx +158 -0
  304. package/src/modules/workspace/state/open-change-requests.tsx +100 -12
  305. package/src/modules/workspace/state/workspace.context.ts +125 -19
  306. package/src/modules/workspace/utils/__tests__/file-trace.test.ts +73 -0
  307. package/src/modules/workspace/utils/__tests__/fileTree.test.ts +220 -6
  308. package/src/modules/workspace/utils/__tests__/pasteLink.test.ts +76 -0
  309. package/src/modules/workspace/utils/__tests__/treeConfirm.test.ts +364 -0
  310. package/src/modules/workspace/utils/__tests__/uploadError.test.ts +35 -0
  311. package/src/modules/workspace/utils/file-trace.ts +50 -0
  312. package/src/modules/workspace/utils/fileTree.ts +112 -36
  313. package/src/modules/workspace/utils/frontmatter.ts +8 -4
  314. package/src/modules/workspace/utils/pasteLink.ts +90 -0
  315. package/src/modules/workspace/utils/treeConfirm.ts +338 -0
  316. package/src/modules/workspace/utils/uploadError.ts +29 -0
  317. package/src/shared/__tests__/marketplace-url.test.ts +6 -1
  318. package/src/shared/components/Button.tsx +16 -2
  319. package/src/shared/components/Dialog.tsx +27 -11
  320. package/src/shared/components/Menu.tsx +13 -1
  321. package/src/shared/components/PageShell.tsx +13 -8
  322. package/src/shared/components/__tests__/primitives.test.tsx +116 -2
  323. package/src/shared/components/__tests__/useFocusHandoff.test.tsx +192 -0
  324. package/src/shared/components/index.ts +2 -0
  325. package/src/shared/components/useDismissableMenu.ts +32 -10
  326. package/src/shared/components/useFocusHandoff.ts +51 -0
  327. package/src/shared/components/useLatestRef.ts +28 -0
  328. package/src/shared/markdown/Markdown.tsx +12 -3
  329. package/src/shared/markdown/__tests__/escapeSpacesInLinkDestinations.test.ts +39 -0
  330. package/src/shared/markdown/hrefs.ts +50 -0
  331. package/src/shared/marketplace-url.ts +33 -5
  332. package/src/shared/mcp/ChatGptInstallLink.tsx +3 -3
  333. package/src/shared/mcp/ConnectionInstructions.tsx +38 -27
  334. package/src/shared/mcp/__tests__/connect-snippets.test.ts +3 -3
  335. package/src/shared/mcp/connect-snippets.ts +14 -9
  336. package/src/shared/mcp/index.ts +1 -1
  337. package/src/shared/theme/__tests__/header-band.test.ts +197 -0
  338. package/src/shared/theme/header.ts +75 -0
  339. package/src/shared/theme/measure.ts +7 -4
  340. package/src/shared/theme/tokens.css +25 -0
  341. package/src/modules/library/__tests__/PluginsIndexPage.test.tsx +0 -363
  342. package/src/modules/library/__tests__/PluginsSidebar.locked.test.tsx +0 -97
  343. package/src/modules/library/components/PluginsIndexPage.tsx +0 -270
  344. package/src/modules/update-check/__tests__/UpdateBanner.test.tsx +0 -126
  345. package/src/modules/update-check/components/UpdateBanner.tsx +0 -92
  346. package/src/modules/update-check/services/update-check.api.ts +0 -24
@@ -0,0 +1,288 @@
1
+ import {
2
+ Fragment,
3
+ useEffect,
4
+ useRef,
5
+ useState,
6
+ type KeyboardEvent as ReactKeyboardEvent,
7
+ type MouseEvent as ReactMouseEvent,
8
+ type ReactNode,
9
+ type RefObject,
10
+ } from 'react';
11
+ import { MoreHorizontal } from 'lucide-react';
12
+ import { cn } from '../../../lib/utils';
13
+ import {
14
+ IconButton,
15
+ MenuItem,
16
+ MenuPanel,
17
+ useDismissableMenu,
18
+ usePointerMenuPosition,
19
+ } from '../../../shared/components';
20
+
21
+ /**
22
+ * One verb in a card's or a row's own menu.
23
+ *
24
+ * `label` is the word AND the item's accessible name, so the two can never
25
+ * disagree — the icon beside it is decoration and carries no name of its own.
26
+ */
27
+ export interface ItemAction {
28
+ label: string;
29
+ icon: ReactNode;
30
+ /** What the item does. Absent on an item that states a fact (see `disabled`). */
31
+ onSelect?(): void;
32
+ /**
33
+ * Draw the file tree's rule above this item. Access sits below it there and
34
+ * in the Library nav's menu, because it changes who else can be here rather
35
+ * than what is here — so `Share` carries it on a card too.
36
+ */
37
+ separated?: boolean;
38
+ /**
39
+ * The verb is not available and saying why is the point — "Requested" on a
40
+ * plugin the caller has already asked to join, which is exactly what the
41
+ * locked page shows in place of its button. Skipped by the arrow keys,
42
+ * because focus on a disabled control is a dead end.
43
+ */
44
+ disabled?: boolean;
45
+ }
46
+
47
+ /** How far below the "…" button the menu opens, matching the file tree's gap. */
48
+ const MENU_GAP = 4;
49
+
50
+ /**
51
+ * Every item the arrows may land on, in order. A DISABLED item is not a stop:
52
+ * focus on a control that cannot act is a dead end the arrows cannot leave.
53
+ * Filtered in JavaScript rather than with `:disabled` in the selector, which
54
+ * the test DOM does not implement.
55
+ */
56
+ function menuItemsOf(panel: HTMLElement | null): HTMLButtonElement[] {
57
+ return Array.from(panel?.querySelectorAll<HTMLButtonElement>('[role="menuitem"]') ?? []).filter(
58
+ (el) => !el.disabled,
59
+ );
60
+ }
61
+
62
+ /**
63
+ * A card or a row, plus the menu it carries.
64
+ *
65
+ * The frame exists because of one HTML fact: a card IS a `<button>` and a row
66
+ * IS a `<button>`, so the menu's trigger cannot live inside either — a button
67
+ * in a button is not markup. Same split `CardGrid` already makes for its
68
+ * remove overlay: a wrapper takes the grid slot, the target keeps the whole
69
+ * surface, and the second control is an absolutely-placed SIBLING of it.
70
+ *
71
+ * The trigger is quiet until it is wanted (`opacity`, so nothing shifts under
72
+ * the cursor as the card lights up) and `focus-within` is what keeps that
73
+ * honest for anyone who never hovers — the button is a real tab stop right
74
+ * after the card whether or not it can be seen. A right-click anywhere on the
75
+ * frame opens the same menu at the pointer, so the gesture people already use
76
+ * in the file tree and the Library nav works here too.
77
+ *
78
+ * An EMPTY `actions` still gets the frame, and that is deliberate. What a row
79
+ * can offer depends on answers that land after the first paint — the plugin
80
+ * index, the workspace's KB directory — and a frame that appeared only once
81
+ * they had would change the tree's shape under React, remounting the card or
82
+ * row itself: anyone who had focused or was mid-click on it would lose it the
83
+ * moment the catalog settled. So the wrapper is constant and only its contents
84
+ * are conditional; with nothing to offer it carries no role, no label and no
85
+ * button, and is a bare `<div>` around the thing it wraps.
86
+ */
87
+ export function ItemMenuFrame({
88
+ label,
89
+ actions,
90
+ className,
91
+ buttonClassName,
92
+ children,
93
+ }: {
94
+ /** What was clicked, by name — the group's and the menu's accessible name. */
95
+ label: string;
96
+ actions: ItemAction[];
97
+ /** The frame takes the wrapped element's place in its grid or list. */
98
+ className?: string;
99
+ /** Where the "…" sits: a card puts it in the corner, a row on the mid-line. */
100
+ buttonClassName?: string;
101
+ children: ReactNode;
102
+ }) {
103
+ const triggerRef = useRef<HTMLButtonElement>(null);
104
+ /** Where the menu is open, in viewport coordinates. `null` is closed. */
105
+ const [at, setAt] = useState<{ x: number; y: number } | null>(null);
106
+ const offered = actions.length > 0;
107
+
108
+ function toggleFromButton() {
109
+ // A trigger toggles. `useDismissableMenu` deliberately ignores clicks on
110
+ // the control it was given, so closing on a second click is ours.
111
+ if (at) {
112
+ setAt(null);
113
+ return;
114
+ }
115
+ const r = triggerRef.current?.getBoundingClientRect();
116
+ setAt({ x: r?.left ?? 0, y: (r?.bottom ?? 0) + MENU_GAP });
117
+ }
118
+
119
+ return (
120
+ <div
121
+ role={offered ? 'group' : undefined}
122
+ aria-label={offered ? label : undefined}
123
+ // `grid-cols-[minmax(0,1fr)]`, and `min-w-0` is not enough on its own.
124
+ // `min-w-0` bounds the grid BOX; the implicit column it lays out is
125
+ // still `auto`, whose minimum is the content's min-content — and the
126
+ // min-content of a row holding a `whitespace-nowrap` name is that name
127
+ // at full length. So a plugin row wearing a 60-character name laid
128
+ // itself out 605px wide inside a 200px column and simply hung out of it,
129
+ // whatever the window did. Naming the track with a floor of 0 is what
130
+ // makes the row the width of the column it is in — which is also what
131
+ // gives `NameWithBadges` a shortfall to react to: a row that is never
132
+ // short has no reason to move its badges to a second line.
133
+ //
134
+ // Cards are unaffected, measured: `CardGrid`'s track already carries an
135
+ // explicit minimum (`minmax(min(236px,100%),1fr)`), so a card was never
136
+ // sized by its own min-content in the first place.
137
+ className={cn('group/itemmenu relative grid min-w-0 grid-cols-[minmax(0,1fr)]', className)}
138
+ onContextMenu={
139
+ offered
140
+ ? (e: ReactMouseEvent) => {
141
+ e.preventDefault();
142
+ setAt({ x: e.clientX, y: e.clientY });
143
+ }
144
+ : undefined
145
+ }
146
+ >
147
+ {children}
148
+ {offered && (
149
+ <IconButton
150
+ ref={triggerRef}
151
+ size={22}
152
+ aria-label={`Actions for ${label}`}
153
+ title={`Actions for ${label}`}
154
+ aria-haspopup="menu"
155
+ aria-expanded={at !== null}
156
+ active={at !== null}
157
+ className={cn(
158
+ // `bg-surface`, because it floats over the card's own text.
159
+ 'absolute right-1.5 top-1.5 bg-surface opacity-0 transition-opacity',
160
+ 'group-hover/itemmenu:opacity-100 group-focus-within/itemmenu:opacity-100',
161
+ at !== null && 'opacity-100',
162
+ buttonClassName,
163
+ )}
164
+ onClick={toggleFromButton}
165
+ >
166
+ <MoreHorizontal size={14} />
167
+ </IconButton>
168
+ )}
169
+ {at && offered && (
170
+ <ItemActionsMenu
171
+ x={at.x}
172
+ y={at.y}
173
+ label={label}
174
+ actions={actions}
175
+ onClose={() => setAt(null)}
176
+ returnFocusTo={triggerRef}
177
+ />
178
+ )}
179
+ </div>
180
+ );
181
+ }
182
+
183
+ /**
184
+ * The panel itself — the Library nav's menu (`PluginsSidebarMenu`) with the
185
+ * items handed in rather than named inline, because a card, a row and a locked
186
+ * row are three item lists and not three menus.
187
+ *
188
+ * Dismissal is `useDismissableMenu`'s, unchanged: outside click closes, Escape
189
+ * closes and hands focus back to the "…" it came from. What this adds is the
190
+ * INSIDE of the menu, which no menu in the app owned yet: opening moves focus
191
+ * to the first verb, and the arrows (plus Home/End) walk the list, so the menu
192
+ * can be driven without a pointer at all.
193
+ *
194
+ * Every other way out of the menu hands focus back the same way Escape does,
195
+ * because all three end with the focused node gone: PICKING a verb (the menu
196
+ * unmounts under the finger — an action that opens a dialog mounts it after
197
+ * this and takes focus from there, which is what should happen), and TAB,
198
+ * which the menu pattern treats as "close and carry on" — focus goes to the
199
+ * "…" first so the browser's own Tab continues one step past it rather than
200
+ * from the top of the document, where a removed node strands it.
201
+ */
202
+ function ItemActionsMenu({
203
+ x,
204
+ y,
205
+ label,
206
+ actions,
207
+ onClose,
208
+ returnFocusTo,
209
+ }: {
210
+ x: number;
211
+ y: number;
212
+ label: string;
213
+ actions: ItemAction[];
214
+ onClose(): void;
215
+ returnFocusTo: RefObject<HTMLElement | null>;
216
+ }) {
217
+ const ref = useDismissableMenu<HTMLDivElement>({ open: true, onClose, returnFocusTo });
218
+ const pos = usePointerMenuPosition(ref, x, y);
219
+
220
+ // Focus enters the menu with it. Without this the menu opens behind the
221
+ // keyboard: Escape would work (the document listener sees it) but nothing
222
+ // else would, and Tab would walk on to the next card.
223
+ // `ref` is a stable `useRef` box, so this runs once per open.
224
+ useEffect(() => {
225
+ menuItemsOf(ref.current)[0]?.focus();
226
+ }, [ref]);
227
+
228
+ /** Close, and put focus back where the menu came from. See the docstring. */
229
+ function closeAndReturn() {
230
+ onClose();
231
+ returnFocusTo.current?.focus();
232
+ }
233
+
234
+ function onKeyDown(e: ReactKeyboardEvent<HTMLDivElement>) {
235
+ // Tab leaves the menu, so the menu goes — and deliberately WITHOUT
236
+ // `preventDefault`: the browser reads the focused element after this
237
+ // handler, so moving focus to the trigger here makes its own Tab land on
238
+ // whatever follows the trigger, which is the next thing in the page.
239
+ if (e.key === 'Tab') {
240
+ closeAndReturn();
241
+ return;
242
+ }
243
+ const items = menuItemsOf(ref.current);
244
+ if (items.length === 0) return;
245
+ const at = items.indexOf(document.activeElement as HTMLButtonElement);
246
+ let next: number;
247
+ if (e.key === 'ArrowDown') next = (at + 1) % items.length;
248
+ else if (e.key === 'ArrowUp') next = (at - 1 + items.length) % items.length;
249
+ else if (e.key === 'Home') next = 0;
250
+ else if (e.key === 'End') next = items.length - 1;
251
+ else return;
252
+ e.preventDefault();
253
+ items[next]?.focus();
254
+ }
255
+
256
+ return (
257
+ // Positioning stays with the caller — `MenuPanel` is presentation only, so
258
+ // the fixed wrapper is ours, exactly as in the nav's menu and the tree's.
259
+ <div
260
+ ref={ref}
261
+ className="fixed z-50"
262
+ style={{ left: pos.left, top: pos.top }}
263
+ onMouseDown={(e) => e.stopPropagation()}
264
+ onKeyDown={onKeyDown}
265
+ >
266
+ <MenuPanel role="menu" aria-label={`Actions for ${label}`} className="min-w-[180px]">
267
+ {actions.map((action) => (
268
+ <Fragment key={action.label}>
269
+ {action.separated && <div className="my-1 border-t border-line" />}
270
+ <MenuItem
271
+ role="menuitem"
272
+ disabled={action.disabled}
273
+ onClick={() => {
274
+ action.onSelect?.();
275
+ closeAndReturn();
276
+ }}
277
+ >
278
+ <span className="flex items-center gap-2">
279
+ {action.icon}
280
+ {action.label}
281
+ </span>
282
+ </MenuItem>
283
+ </Fragment>
284
+ ))}
285
+ </MenuPanel>
286
+ </div>
287
+ );
288
+ }
@@ -1,5 +1,8 @@
1
+ import { ExternalLink, Users } from 'lucide-react';
1
2
  import { Badge, Surface } from '../../../shared/components';
2
3
  import { cn } from '../../../lib/utils';
4
+ import { ItemMenuFrame } from './ItemActionsMenu';
5
+ import { NameWithBadges } from './NameWithBadges';
3
6
  import { StatusDot } from './StatusDot';
4
7
  import { ToolLogo } from './ToolLogo';
5
8
  import type { AttentionStatus, GemState } from '../utils/status';
@@ -11,15 +14,39 @@ import type { AttentionStatus, GemState } from '../utils/status';
11
14
  */
12
15
  export type LibraryCardProps = LibraryCardCommonProps &
13
16
  (
14
- | { kind: 'skill'; flavor?: never }
17
+ | {
18
+ kind: 'skill';
19
+ flavor?: never;
20
+ /**
21
+ * Open Manage access on the skill's own folder — the skill page's
22
+ * `Share`, offered from the card. Absent when the surface the card is
23
+ * on cannot address that folder (the KB directory has not resolved) or
24
+ * the skill has none yet (a proposal lives on a branch), and the card
25
+ * then carries no menu at all.
26
+ */
27
+ onShare?(): void;
28
+ }
15
29
  | {
16
30
  kind: 'integration';
17
31
  /**
18
32
  * How the integration is declared: an `mcp.json` server or a `.tool`
19
33
  * UTCP manual. Two different files to edit and two different
20
34
  * capability sets, so the card says which one this is.
35
+ *
36
+ * Mandatory, and `NameWithBadges` leans on that: a tool card carries a
37
+ * mark, and a mark earns the name no floor of its own, so the floor has
38
+ * to come from a badge that is always there. A PROPOSED tool says it
39
+ * too — an approver is deciding on a file, and which file it is belongs
40
+ * on the card beside `In review`.
21
41
  */
22
42
  flavor: 'mcp' | 'utcp';
43
+ /**
44
+ * Never. Access to a tool is decided at the plugin that carries it, so
45
+ * a tool card has nothing of its own to share. Stated in the type, so a
46
+ * caller that tries is a compile error rather than a card that grew a
47
+ * menu nobody meant it to have.
48
+ */
49
+ onShare?: never;
23
50
  }
24
51
  );
25
52
 
@@ -36,19 +63,27 @@ export interface LibraryCardCommonProps {
36
63
  */
37
64
  version?: string;
38
65
  /**
39
- * Set only on a skill that does not exist yet — it is on an open change
66
+ * Set only on an item that does not exist yet — it is on an open change
40
67
  * request, waiting to be approved. `mine` distinguishes the two readers this
41
68
  * card has: the person who proposed it (waiting on someone else) and the
42
69
  * person who has to decide (being waited on).
70
+ *
71
+ * A TOOL carries this as readily as a skill: a `.tool` manual or an
72
+ * `mcp.json` server proposed on a change request gets the same dashed
73
+ * border, the same badge and the same foot, because it is the same fact —
74
+ * this is not here yet, and here is who it is between.
43
75
  */
44
76
  pending?: { authorName: string; mine: boolean };
45
77
  /**
46
- * A skill's governance lifecycle (`metadata.lifecycle`). Only the two states
47
- * that need a reader's attention are shown — `deprecated` (still works,
48
- * find the replacement) and `retired` (kept for its owners, never
49
- * distributed); `active` and absence render nothing.
78
+ * Where the item LIVES, when it reaches the page showing this card through
79
+ * a link rather than by sitting in its folder — `Skills/Testing`. Draws the
80
+ * Linked pill, with that folder in its tooltip.
81
+ *
82
+ * Set only on a plugin's page, and only for a linked card: a gallery card
83
+ * is in as many plugins as it is in, and "linked" there would name no
84
+ * plugin to be linked from. Absent ⇒ no pill, which is every inline card.
50
85
  */
51
- lifecycle?: string;
86
+ linkedHome?: string;
52
87
  /** Open the item. The whole card is the target. */
53
88
  onOpen(): void;
54
89
  }
@@ -63,11 +98,16 @@ const STATUS_INK: Record<GemState, string> = {
63
98
  /**
64
99
  * One gallery card — the prototype's `.card` (line 158).
65
100
  *
66
- * The whole card is one `<button>` that opens the item, which is why there is
67
- * no ⓘ affordance any more: it used to exist because the card body was spent
68
- * on toggling loadout membership, so opening needed its own target. With the
69
- * loadout gone the card has a single action, and a card with a single action
70
- * should not have two controls.
101
+ * The whole card BODY is one `<button>` that opens the item — the ⓘ affordance
102
+ * that used to sit beside it is gone, because it only existed while the body
103
+ * was spent on toggling loadout membership and opening needed its own target.
104
+ *
105
+ * The one control that did earn a place back is the `…` menu, and only on a
106
+ * card that has a second verb to offer: Share is a decision about who else can
107
+ * see the skill, and the index is where a reader is looking at the skill they
108
+ * want to share. It is a SIBLING of the card button, never a child — a button
109
+ * inside a button is not markup — which is what `ItemMenuFrame` exists to
110
+ * arrange. A card with no `onShare` is the card this file has always rendered.
71
111
  *
72
112
  * The two-line clamp on the description is load-bearing, not cosmetic. Skill
73
113
  * descriptions run to full paragraphs, so without it a card grows to whatever
@@ -83,8 +123,9 @@ export function LibraryCard({
83
123
  status,
84
124
  version,
85
125
  pending,
86
- lifecycle,
126
+ linkedHome,
87
127
  onOpen,
128
+ onShare,
88
129
  flavor,
89
130
  }: LibraryCardProps) {
90
131
  /**
@@ -98,10 +139,11 @@ export function LibraryCard({
98
139
  * its own to report; a green "Ready" on every skill in the grid is a row of
99
140
  * noise that says nothing, and it buries the two cards that DO need you.
100
141
  *
101
- * A PROPOSED skill overrides both, because the one thing to know about it is
102
- * that it is not usable yet — and by whose hand it got here. The status it
103
- * carries is about integrations and has nothing to say about a file nobody
104
- * has approved.
142
+ * A PROPOSAL overrides both, tool as much as skill, because the one thing to
143
+ * know about it is that it is not usable yet — and by whose hand it got
144
+ * here. A tool's connection line is the loudest thing this rule silences:
145
+ * "Needs setup" on something that does not exist would send the reader off
146
+ * to fill in a credential for a file nobody has approved.
105
147
  */
106
148
  const footNote = pending
107
149
  ? null
@@ -109,7 +151,54 @@ export function LibraryCard({
109
151
  ? status
110
152
  : null;
111
153
 
112
- return (
154
+ /**
155
+ * The chips that qualify the name — as an ARRAY, not a fragment.
156
+ *
157
+ * `NameWithBadges` gives the name its minimum width only while something is
158
+ * actually competing with it for the row, and a fragment of four falsy
159
+ * branches is indistinguishable from a fragment of four pills. An array can
160
+ * be counted. Which badges appear is untouched: these are the same four
161
+ * conditions, in the same order, that this row has always rendered.
162
+ */
163
+ const badges = [
164
+ kind === 'integration' && flavor ? (
165
+ <Badge key="flavor" tone="outline" size="xs" className="shrink-0 uppercase">
166
+ {flavor === 'mcp' ? 'MCP server' : 'UTCP manual'}
167
+ </Badge>
168
+ ) : null,
169
+ pending ? (
170
+ <Badge key="pending" tone="wait" size="xs" className="shrink-0 uppercase">
171
+ In review
172
+ </Badge>
173
+ ) : null,
174
+ owned && !pending ? (
175
+ <Badge key="owner" tone="outline" size="xs" className="shrink-0 uppercase">
176
+ Owner
177
+ </Badge>
178
+ ) : null,
179
+ /* The card is on a plugin's page and the item lives somewhere else. The
180
+ Owner pill's exact dress, because it makes the same kind of statement —
181
+ a fact about the item's standing, not a problem — and the skill's own
182
+ page already spells LINKED this way.
183
+
184
+ The pill alone would say "not here" without saying where, and "where" is
185
+ the whole reason the reader is puzzled: the Advanced tree shows the disk,
186
+ so a linked skill is not under the plugin's folder there, and the tooltip
187
+ is what reconciles the two views. */
188
+ linkedHome ? (
189
+ <Badge
190
+ key="linked"
191
+ tone="outline"
192
+ size="xs"
193
+ className="shrink-0 uppercase"
194
+ title={`Lives in ${linkedHome}; linked from this plugin's manifest`}
195
+ >
196
+ Linked
197
+ </Badge>
198
+ ) : null,
199
+ ].filter((badge) => badge !== null);
200
+
201
+ const card = (
113
202
  <Surface
114
203
  as="button"
115
204
  type="button"
@@ -130,33 +219,20 @@ export function LibraryCard({
130
219
  )}
131
220
  onClick={onOpen}
132
221
  >
133
- <span className="flex items-center gap-2">
134
- {/* Only tools carry a mark. A skill has no brand to recognise — its
135
- name IS the thing — and a monogram beside every skill would add a
136
- column of coloured squares that distinguish nothing. */}
137
- {kind === 'integration' && <ToolLogo slug={id} name={name} />}
138
- <span className="truncate text-lede font-semibold text-ink">{name}</span>
139
- {kind === 'integration' && flavor && (
140
- <Badge tone="outline" size="xs" className="shrink-0 uppercase">
141
- {flavor === 'mcp' ? 'MCP server' : 'UTCP manual'}
142
- </Badge>
143
- )}
144
- {pending && (
145
- <Badge tone="wait" size="xs" className="shrink-0 uppercase">
146
- In review
147
- </Badge>
148
- )}
149
- {owned && !pending && (
150
- <Badge tone="outline" size="xs" className="shrink-0 uppercase">
151
- Owner
152
- </Badge>
153
- )}
154
- {(lifecycle === 'deprecated' || lifecycle === 'retired') && (
155
- <Badge tone="wait" size="xs" className="shrink-0 uppercase">
156
- {lifecycle === 'retired' ? 'Retired' : 'Deprecated'}
157
- </Badge>
158
- )}
159
- </span>
222
+ {/* Only tools carry a mark. A skill has no brand to recognise — its
223
+ name IS the thing — and a monogram beside every skill would add a
224
+ column of coloured squares that distinguish nothing. It goes in as
225
+ the row's `leading` so it stays on the name's line when the badges
226
+ leave for the one below — a logo stranded above its own name is
227
+ worse than no logo. A tool card is never without badges anyway: the
228
+ union makes `flavor` mandatory, so the floor is always in force
229
+ wherever a mark is. */}
230
+ <NameWithBadges
231
+ leading={kind === 'integration' && <ToolLogo slug={id} name={name} />}
232
+ name={name}
233
+ nameClassName="text-lede font-semibold text-ink"
234
+ badges={badges.length > 0 ? badges : undefined}
235
+ />
160
236
 
161
237
  {description && (
162
238
  <span className="line-clamp-2 text-detail text-ink-muted">{description}</span>
@@ -199,4 +275,29 @@ export function LibraryCard({
199
275
  )}
200
276
  </Surface>
201
277
  );
278
+
279
+ // A TOOL card is the card this file has always rendered, frame and all: what
280
+ // a tool shares is decided at the plugin that carries it, so there is no
281
+ // second verb here and never will be. Deciding on `kind` rather than on
282
+ // whether a Share happens to have arrived yet is what keeps the markup of a
283
+ // card stable across the loads beneath it — see `ItemMenuFrame`.
284
+ if (kind === 'integration') return card;
285
+
286
+ return (
287
+ <ItemMenuFrame
288
+ label={name}
289
+ actions={
290
+ onShare
291
+ ? [
292
+ { label: 'Open', icon: <ExternalLink size={14} />, onSelect: onOpen },
293
+ // Below the rule, as access is in the file tree's menu and the
294
+ // nav's: it changes who else can be here, not what is here.
295
+ { label: 'Share', icon: <Users size={14} />, onSelect: onShare, separated: true },
296
+ ]
297
+ : []
298
+ }
299
+ >
300
+ {card}
301
+ </ItemMenuFrame>
302
+ );
202
303
  }