@bevel-software/platform-core-frontend 0.14.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (360) hide show
  1. package/THIRD-PARTY-NOTICES.md +2 -2
  2. package/package.json +3 -3
  3. package/src/core/CoreAppShell.tsx +34 -26
  4. package/src/core/__tests__/AppChrome.test.tsx +0 -3
  5. package/src/core/__tests__/bootstrap.test.ts +33 -1
  6. package/src/core/__tests__/events.test.ts +43 -0
  7. package/src/core/bootstrap.ts +38 -1
  8. package/src/core/events.ts +85 -3
  9. package/src/core/registry.ts +1 -1
  10. package/src/lib/__tests__/api.test.ts +38 -0
  11. package/src/lib/__tests__/email.test.ts +44 -0
  12. package/src/lib/api.ts +19 -2
  13. package/src/lib/email.ts +37 -1
  14. package/src/lib/utils.ts +2 -0
  15. package/src/modules/access/__tests__/ManageAccessDialog.add-row-picking.test.tsx +141 -0
  16. package/src/modules/access/__tests__/ManageAccessDialog.chip-truncation.test.tsx +204 -0
  17. package/src/modules/access/__tests__/ManageAccessDialog.download-read.test.tsx +234 -0
  18. package/src/modules/access/__tests__/ManageAccessDialog.edited-row-visible.test.tsx +160 -0
  19. package/src/modules/access/__tests__/ManageAccessDialog.placement.test.tsx +2 -2
  20. package/src/modules/access/__tests__/ManageAccessDialog.proposal.test.tsx +166 -0
  21. package/src/modules/access/__tests__/ManageAccessDialog.restrict.test.tsx +510 -0
  22. package/src/modules/access/__tests__/ManageAccessDialog.row-menu-axes.test.tsx +299 -0
  23. package/src/modules/access/__tests__/ManageAccessDialog.row-menu-width.test.tsx +226 -0
  24. package/src/modules/access/__tests__/ManageAccessDialog.test.tsx +781 -76
  25. package/src/modules/access/__tests__/ManageAccessDialog.unknown-email.test.tsx +314 -0
  26. package/src/modules/access/__tests__/manage-access-affordance.test.ts +14 -0
  27. package/src/modules/access/__tests__/plugin-token.test.ts +21 -0
  28. package/src/modules/access/__tests__/tailwindDeclarations.ts +210 -0
  29. package/src/modules/access/api.ts +192 -10
  30. package/src/modules/access/components/ManageAccessDialog.tsx +1337 -570
  31. package/src/modules/access/manage-access-affordance.ts +17 -0
  32. package/src/modules/admin/__tests__/AddMemberInput.test.tsx +297 -0
  33. package/src/modules/admin/__tests__/AdminRolesPage.capabilities.test.tsx +2 -2
  34. package/src/modules/admin/__tests__/AdminRolesPage.fixed-admin.test.tsx +189 -0
  35. package/src/modules/admin/__tests__/AdminRolesPage.suggest.test.tsx +1 -1
  36. package/src/modules/admin/__tests__/ConnectionKeysPage.test.tsx +266 -0
  37. package/src/modules/admin/__tests__/DirectoryGroupsPage.suggest.test.tsx +182 -0
  38. package/src/modules/admin/__tests__/DirectoryGroupsPage.test.tsx +165 -14
  39. package/src/modules/admin/__tests__/UserAccountsPage.test.tsx +401 -4
  40. package/src/modules/admin/__tests__/group-members-path.test.ts +27 -0
  41. package/src/modules/admin/components/AddMemberInput.tsx +268 -0
  42. package/src/modules/admin/components/AdminRolesPage.tsx +97 -132
  43. package/src/modules/admin/components/ConnectionKeysPage.tsx +269 -0
  44. package/src/modules/admin/components/DirectoryGroupsPage.tsx +91 -39
  45. package/src/modules/admin/components/UserAccountsPage.tsx +271 -37
  46. package/src/modules/admin/components/connection-keys-grouping.ts +43 -0
  47. package/src/modules/admin/components/group-members-path.ts +32 -0
  48. package/src/modules/admin/services/connection-keys.api.ts +47 -0
  49. package/src/modules/admin/services/roles.api.ts +12 -1
  50. package/src/modules/auth/__tests__/AccountPage.test.tsx +50 -2
  51. package/src/modules/auth/components/AccountPage.tsx +73 -54
  52. package/src/modules/auth/components/LoginScreen.tsx +1 -0
  53. package/src/modules/auth/services/account.api.ts +78 -4
  54. package/src/modules/change-requests/__tests__/ChangeRequestDialog.access-rules.test.tsx +144 -0
  55. package/src/modules/change-requests/__tests__/ChangeRequestDialog.binary.test.tsx +422 -0
  56. package/src/modules/change-requests/__tests__/ChangeRequestDialog.brings-itself-up-to-date.test.tsx +431 -0
  57. package/src/modules/change-requests/__tests__/ChangeRequestDialog.fork-point.test.tsx +193 -0
  58. package/src/modules/change-requests/__tests__/ChangeRequestDialog.initial-file.test.tsx +142 -0
  59. package/src/modules/change-requests/__tests__/ChangeRequestDialog.moved.test.tsx +202 -0
  60. package/src/modules/change-requests/__tests__/ChangeRequestDialog.test.tsx +205 -13
  61. package/src/modules/change-requests/__tests__/ChangeRequestDialog.unreadable.test.tsx +271 -0
  62. package/src/modules/change-requests/__tests__/FileChangeBoxes.test.tsx +208 -0
  63. package/src/modules/change-requests/__tests__/apply-outcome-for-every-viewer.test.tsx +286 -0
  64. package/src/modules/change-requests/__tests__/propose.concurrent.test.ts +273 -0
  65. package/src/modules/change-requests/__tests__/readFailure.test.ts +122 -0
  66. package/src/modules/change-requests/__tests__/useCrFileDiffs.test.tsx +238 -0
  67. package/src/modules/change-requests/__tests__/useFileOnBranch.test.tsx +56 -1
  68. package/src/modules/change-requests/__tests__/useForkPointFile.test.tsx +79 -0
  69. package/src/modules/change-requests/components/BranchFilePreview.tsx +357 -0
  70. package/src/modules/change-requests/components/ChangeBox.tsx +31 -2
  71. package/src/modules/change-requests/components/ChangeRequestDialog.tsx +862 -72
  72. package/src/modules/change-requests/components/CrFileTree.tsx +74 -58
  73. package/src/modules/change-requests/components/FileChangeBoxes.tsx +19 -15
  74. package/src/modules/change-requests/hooks/useApplyChangeRequest.ts +41 -7
  75. package/src/modules/change-requests/hooks/useCrFileDiffs.ts +181 -23
  76. package/src/modules/change-requests/hooks/useFileOnBranch.ts +70 -7
  77. package/src/modules/change-requests/hooks/useForkPointFile.ts +77 -0
  78. package/src/modules/change-requests/services/change-requests.api.ts +57 -1
  79. package/src/modules/change-requests/services/denied-file.api.ts +53 -0
  80. package/src/modules/change-requests/services/propose.api.ts +97 -8
  81. package/src/modules/change-requests/utils/approval.ts +15 -0
  82. package/src/modules/change-requests/utils/author.ts +32 -0
  83. package/src/modules/change-requests/utils/readFailure.ts +110 -0
  84. package/src/modules/git/__tests__/FileHistoryPanel.test.tsx +20 -0
  85. package/src/modules/git/__tests__/GitSyncFailedBanner.test.tsx +65 -1
  86. package/src/modules/git/components/FileHistoryPanel.tsx +5 -0
  87. package/src/modules/git/components/GitSyncFailedBanner.tsx +68 -5
  88. package/src/modules/git/components/PullRequestsForMe.tsx +51 -24
  89. package/src/modules/git/services/__tests__/error-messages.test.ts +29 -0
  90. package/src/modules/git/services/error-messages.ts +12 -0
  91. package/src/modules/git/services/pr-prompts.ts +5 -5
  92. package/src/modules/layout/__tests__/HeaderAlignment.test.tsx +401 -0
  93. package/src/modules/layout/__tests__/SidebarFooterGrid.test.tsx +286 -0
  94. package/src/modules/layout/__tests__/SidebarFrameResponsive.test.tsx +61 -0
  95. package/src/modules/layout/components/AppLayout.tsx +2 -0
  96. package/src/modules/layout/components/MobileChatLayout.tsx +4 -1
  97. package/src/modules/layout/components/ResizableThreePaneLayout.tsx +4 -1
  98. package/src/modules/layout/components/SidebarFrame.tsx +109 -4
  99. package/src/modules/library/__tests__/AddToPluginDialog.test.tsx +171 -5
  100. package/src/modules/library/__tests__/DeleteToolDialog.test.tsx +356 -0
  101. package/src/modules/library/__tests__/IntegrationsSetupReminder.test.tsx +60 -0
  102. package/src/modules/library/__tests__/LibraryCard.test.tsx +91 -10
  103. package/src/modules/library/__tests__/LibraryRoutes.test.tsx +242 -107
  104. package/src/modules/library/__tests__/LibrarySidebarMenu.test.tsx +104 -99
  105. package/src/modules/library/__tests__/LinkSkillPanel.test.tsx +136 -0
  106. package/src/modules/library/__tests__/LockedPluginView.test.tsx +103 -7
  107. package/src/modules/library/__tests__/NewPluginDialog.test.tsx +18 -8
  108. package/src/modules/library/__tests__/PersonalAddDialog.test.tsx +79 -3
  109. package/src/modules/library/__tests__/PersonalPluginPage.test.tsx +201 -0
  110. package/src/modules/library/__tests__/PluginExtras.test.tsx +115 -9
  111. package/src/modules/library/__tests__/PluginJoinRequests.test.tsx +60 -1
  112. package/src/modules/library/__tests__/PluginPage.test.tsx +453 -7
  113. package/src/modules/library/__tests__/PluginsSidebar.contextmenu.test.tsx +17 -57
  114. package/src/modules/library/__tests__/PluginsSidebar.test.tsx +161 -97
  115. package/src/modules/library/__tests__/PluginsSidebarMenu.test.tsx +16 -0
  116. package/src/modules/library/__tests__/SharedViaPlugins.test.tsx +106 -0
  117. package/src/modules/library/__tests__/SkillPage.test.tsx +391 -78
  118. package/src/modules/library/__tests__/SkillsTree.test.tsx +461 -0
  119. package/src/modules/library/__tests__/ToolConnectionSection.test.tsx +582 -71
  120. package/src/modules/library/__tests__/ToolPage.test.tsx +94 -4
  121. package/src/modules/library/__tests__/WorkspaceItemRoute.test.tsx +279 -21
  122. package/src/modules/library/__tests__/auth-harness.tsx +9 -9
  123. package/src/modules/library/__tests__/card-row-menu.test.tsx +320 -0
  124. package/src/modules/library/__tests__/library-data.mapping.test.tsx +98 -0
  125. package/src/modules/library/__tests__/library-data.stale.test.tsx +183 -0
  126. package/src/modules/library/__tests__/library-data.test.ts +7 -0
  127. package/src/modules/library/__tests__/library-paths.test.ts +75 -0
  128. package/src/modules/library/__tests__/link-membership.test.ts +129 -0
  129. package/src/modules/library/__tests__/name-with-badges.test.tsx +273 -0
  130. package/src/modules/library/__tests__/newSkillMarkdown.test.ts +30 -0
  131. package/src/modules/library/__tests__/owner-pill.test.tsx +357 -0
  132. package/src/modules/library/__tests__/pending-tools.test.tsx +400 -0
  133. package/src/modules/library/__tests__/plugin-entries.test.ts +122 -0
  134. package/src/modules/library/__tests__/plugin-summary.test.ts +67 -0
  135. package/src/modules/library/__tests__/status.test.ts +82 -2
  136. package/src/modules/library/__tests__/tools.api.test.ts +44 -1
  137. package/src/modules/library/__tests__/useJoinRequests.test.tsx +46 -0
  138. package/src/modules/library/components/AccessRequestsBanner.tsx +85 -47
  139. package/src/modules/library/components/AddDialogTabs.tsx +103 -0
  140. package/src/modules/library/components/AddToPluginDialog.tsx +107 -18
  141. package/src/modules/library/components/IntegrationsSetupReminder.tsx +59 -0
  142. package/src/modules/library/components/ItemActionsMenu.tsx +288 -0
  143. package/src/modules/library/components/LibraryCard.tsx +149 -34
  144. package/src/modules/library/components/LibraryLayout.tsx +120 -247
  145. package/src/modules/library/components/LibraryPage.tsx +172 -39
  146. package/src/modules/library/components/LinkSkillPanel.tsx +169 -0
  147. package/src/modules/library/components/LockedPluginView.tsx +63 -35
  148. package/src/modules/library/components/NameWithBadges.tsx +164 -0
  149. package/src/modules/library/components/NewPluginDialog.tsx +19 -5
  150. package/src/modules/library/components/PageActions.tsx +31 -9
  151. package/src/modules/library/components/{PendingSkillReview.tsx → PendingItemReview.tsx} +14 -7
  152. package/src/modules/library/components/PersonalAddDialog.tsx +68 -18
  153. package/src/modules/library/components/PersonalPluginPage.tsx +123 -23
  154. package/src/modules/library/components/PluginExtras.tsx +143 -18
  155. package/src/modules/library/components/PluginIndexRow.tsx +47 -12
  156. package/src/modules/library/components/PluginPage.tsx +234 -38
  157. package/src/modules/library/components/PluginRows.tsx +286 -0
  158. package/src/modules/library/components/PluginsSidebar.tsx +271 -238
  159. package/src/modules/library/components/PluginsSidebarMenu.tsx +26 -1
  160. package/src/modules/library/components/RenamePluginDialog.tsx +136 -0
  161. package/src/modules/library/components/ShareButton.tsx +17 -0
  162. package/src/modules/library/components/SkillsTree.tsx +204 -0
  163. package/src/modules/library/components/StatusDot.tsx +1 -0
  164. package/src/modules/library/components/TeamRoute.tsx +15 -0
  165. package/src/modules/library/components/__tests__/upload-notices-once-per-page.test.tsx +144 -0
  166. package/src/modules/library/components/plugin-page-parts.tsx +132 -23
  167. package/src/modules/library/components/skill-page/SharedViaPlugins.tsx +212 -0
  168. package/src/modules/library/components/skill-page/SkillFilePane.tsx +5 -0
  169. package/src/modules/library/components/skill-page/SkillPage.tsx +337 -121
  170. package/src/modules/library/components/tool-page/DeleteToolDialog.tsx +218 -0
  171. package/src/modules/library/components/tool-page/ToolConnectionSection.tsx +79 -178
  172. package/src/modules/library/components/tool-page/ToolPage.tsx +116 -17
  173. package/src/modules/library/components/tool-page/ToolVarRow.tsx +42 -41
  174. package/src/modules/library/hooks/__tests__/useLibraryData.test.ts +98 -0
  175. package/src/modules/library/hooks/useJoinRequests.ts +48 -18
  176. package/src/modules/library/hooks/useLibraryData.ts +92 -19
  177. package/src/modules/library/routes/LibraryRoutes.tsx +14 -11
  178. package/src/modules/library/routes/WorkspaceItemRoute.tsx +229 -82
  179. package/src/modules/library/routes/library-paths.ts +46 -35
  180. package/src/modules/library/services/library.api.ts +89 -17
  181. package/src/modules/library/services/plugins.api.ts +161 -9
  182. package/src/modules/library/services/teams.api.ts +15 -0
  183. package/src/modules/library/services/tools.api.ts +78 -0
  184. package/src/modules/library/state/library-data.tsx +268 -37
  185. package/src/modules/library/utils/personal-plugin.ts +13 -15
  186. package/src/modules/library/utils/plugin-entries.ts +134 -0
  187. package/src/modules/library/utils/plugin-summary.ts +102 -0
  188. package/src/modules/library/utils/status.ts +204 -35
  189. package/src/modules/onboarding/__tests__/creator-welcome.test.tsx +11 -3
  190. package/src/modules/onboarding/__tests__/onboarding.test.tsx +853 -760
  191. package/src/modules/onboarding/agent-clients.ts +55 -23
  192. package/src/modules/onboarding/components/ConnectAgentPill.tsx +5 -1
  193. package/src/modules/onboarding/components/WelcomePage.tsx +98 -62
  194. package/src/modules/pr/services/pr-merge.api.ts +2 -1
  195. package/src/modules/review/components/MarkdownDiffViewer.tsx +53 -8
  196. package/src/modules/review/components/ReviewPanel.tsx +15 -17
  197. package/src/modules/review/components/__tests__/MarkdownDiffViewer.test.tsx +64 -0
  198. package/src/modules/review/components/__tests__/ReviewPanel.test.tsx +25 -1
  199. package/src/modules/secrets-vault/components/ConnectToolsPage.tsx +454 -117
  200. package/src/modules/secrets-vault/components/SecretsPage.tsx +48 -7
  201. package/src/modules/secrets-vault/components/ToolSecretsPanel.tsx +84 -5
  202. package/src/modules/secrets-vault/components/__tests__/ConnectToolsPage.test.tsx +425 -0
  203. package/src/modules/secrets-vault/components/__tests__/SecretsPage.test.tsx +417 -82
  204. package/src/modules/secrets-vault/components/__tests__/ToolSecretsPanel.test.tsx +105 -0
  205. package/src/modules/secrets-vault/components/__tests__/connect-lists-what-the-banner-counted.test.tsx +407 -0
  206. package/src/modules/secrets-vault/probe/SavedKeyProbeResult.tsx +98 -0
  207. package/src/modules/secrets-vault/probe/__tests__/probe-verdict.test.ts +160 -0
  208. package/src/modules/secrets-vault/probe/probe-verdict.ts +108 -0
  209. package/src/modules/secrets-vault/probe/useSavedKeyProbe.ts +228 -0
  210. package/src/modules/secrets-vault/services/connect.api.ts +36 -5
  211. package/src/modules/secrets-vault/utils/connect-status.ts +98 -0
  212. package/src/modules/settings/components/ClaudeConnectionCard.tsx +154 -0
  213. package/src/modules/settings/components/ClaudeConnectionFields.tsx +23 -0
  214. package/src/modules/settings/components/DeploymentPage.tsx +16 -22
  215. package/src/modules/settings/components/MarketplaceSection.tsx +152 -0
  216. package/src/modules/settings/components/__tests__/ClaudeConnectionCard.test.tsx +63 -0
  217. package/src/modules/settings/components/__tests__/DeploymentPage.test.tsx +74 -1
  218. package/src/modules/settings/components/__tests__/MarketplaceSection.test.tsx +325 -0
  219. package/src/modules/settings/components/__tests__/SettingsLayout.test.tsx +5 -5
  220. package/src/modules/settings/services/github-facade.api.ts +66 -0
  221. package/src/modules/settings/settings-nav-items.tsx +10 -2
  222. package/src/modules/setup/__tests__/setup.oidc.test.tsx +172 -0
  223. package/src/modules/setup/__tests__/setup.probe-refusal.test.tsx +123 -0
  224. package/src/modules/setup/__tests__/setup.test.tsx +615 -4
  225. package/src/modules/setup/__tests__/useSetupStatus.test.tsx +130 -0
  226. package/src/modules/setup/components/SetupGate.tsx +16 -16
  227. package/src/modules/setup/components/SetupScreen.tsx +711 -40
  228. package/src/modules/setup/hooks/useSetupStatus.ts +93 -0
  229. package/src/modules/setup/services/setup.api.ts +218 -3
  230. package/src/modules/setup/utils/__tests__/root-folders.test.ts +72 -0
  231. package/src/modules/setup/utils/root-folders.ts +46 -0
  232. package/src/modules/toolbar/assets/claude-setup/01-add-manually.webp +0 -0
  233. package/src/modules/toolbar/assets/claude-setup/02-add-configuration.webp +0 -0
  234. package/src/modules/toolbar/assets/claude-setup/03-connect-account.webp +0 -0
  235. package/src/modules/toolbar/assets/claude-setup/04-pick-instance.webp +0 -0
  236. package/src/modules/toolbar/assets/claude-setup/05-plugins-add.webp +0 -0
  237. package/src/modules/toolbar/assets/claude-setup/06-add-marketplace.webp +0 -0
  238. package/src/modules/toolbar/assets/claude-setup/07-paste-url-sync.webp +0 -0
  239. package/src/modules/toolbar/assets/claude-setup/08-install-plugins.webp +0 -0
  240. package/src/modules/toolbar/assets/claude-setup/09-select-repository.webp +0 -0
  241. package/src/modules/toolbar/assets/claude-setup/10-connector-not-added.webp +0 -0
  242. package/src/modules/toolbar/assets/claude-setup/11-add-custom-connector.webp +0 -0
  243. package/src/modules/toolbar/assets/claude-setup/README.md +68 -0
  244. package/src/modules/toolbar/components/AgentInstructionsCard.tsx +296 -0
  245. package/src/modules/toolbar/components/ClaudeMarketplaceCarousel.tsx +107 -0
  246. package/src/modules/toolbar/components/ClaudeRegistrationSteps.tsx +127 -0
  247. package/src/modules/toolbar/components/CoworkSetupSteps.tsx +100 -0
  248. package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +395 -124
  249. package/src/modules/toolbar/components/ScreenshotStep.tsx +77 -0
  250. package/src/modules/toolbar/components/SetupCarousel.tsx +177 -0
  251. package/src/modules/toolbar/components/__tests__/AgentInstructionsCard.test.tsx +370 -0
  252. package/src/modules/toolbar/components/__tests__/ExternalAgentAccessPage.test.tsx +659 -36
  253. package/src/modules/toolbar/components/__tests__/Toolbar.test.tsx +2 -2
  254. package/src/modules/toolbar/components/__tests__/claude-setup-shots.test.ts +104 -0
  255. package/src/modules/toolbar/components/claude-connector-slide.tsx +38 -0
  256. package/src/modules/toolbar/components/claude-setup-shots.ts +167 -0
  257. package/src/modules/toolbar/components/deployment-address.ts +29 -0
  258. package/src/modules/toolbar/components/setup-step-parts.tsx +35 -0
  259. package/src/modules/toolbar/services/__tests__/agent-instructions.api.test.ts +89 -0
  260. package/src/modules/toolbar/services/agent-instructions.api.ts +167 -0
  261. package/src/modules/toolbar/services/external-api-keys.api.ts +8 -0
  262. package/src/modules/workflow/state/ChangeRequestStaleBinder.tsx +43 -0
  263. package/src/modules/workflow/state/EventBusProvider.tsx +122 -11
  264. package/src/modules/workflow/state/__tests__/EventBusProvider.storage.test.tsx +87 -0
  265. package/src/modules/workflow/state/__tests__/EventBusProvider.watch.test.tsx +223 -0
  266. package/src/modules/workflow/state/event-bus.context.ts +10 -0
  267. package/src/modules/workspace/__tests__/testFixtures.ts +6 -3
  268. package/src/modules/workspace/components/FileExplorer.tsx +1527 -367
  269. package/src/modules/workspace/components/FileRoute.tsx +376 -22
  270. package/src/modules/workspace/components/FileViewer.tsx +166 -45
  271. package/src/modules/workspace/components/KbDocumentShell.tsx +50 -6
  272. package/src/modules/workspace/components/KbPageHeader.tsx +120 -55
  273. package/src/modules/workspace/components/TreeActionConfirm.tsx +350 -0
  274. package/src/modules/workspace/components/__tests__/FileExplorer.test.tsx +2473 -129
  275. package/src/modules/workspace/components/__tests__/FileRoute.test.tsx +768 -16
  276. package/src/modules/workspace/components/__tests__/FileViewer.test.tsx +332 -12
  277. package/src/modules/workspace/components/__tests__/KbDocumentShell.test.tsx +39 -0
  278. package/src/modules/workspace/components/__tests__/KbPageHeader.test.tsx +33 -20
  279. package/src/modules/workspace/components/renderers/DocxRenderer.tsx +4 -5
  280. package/src/modules/workspace/components/renderers/DownloadFileButton.tsx +13 -4
  281. package/src/modules/workspace/components/renderers/EmailRenderer.tsx +4 -3
  282. package/src/modules/workspace/components/renderers/HtmlRenderer.tsx +8 -14
  283. package/src/modules/workspace/components/renderers/ImageRenderer.tsx +75 -16
  284. package/src/modules/workspace/components/renderers/KbImage.tsx +180 -0
  285. package/src/modules/workspace/components/renderers/KbMarkdownView.tsx +22 -6
  286. package/src/modules/workspace/components/renderers/MarkdownRenderer.tsx +48 -22
  287. package/src/modules/workspace/components/renderers/PdfRenderer.tsx +4 -5
  288. package/src/modules/workspace/components/renderers/PptxRenderer.tsx +4 -3
  289. package/src/modules/workspace/components/renderers/XlsxRenderer.tsx +4 -3
  290. package/src/modules/workspace/components/renderers/__tests__/DocxRenderer.test.tsx +12 -0
  291. package/src/modules/workspace/components/renderers/__tests__/DownloadFileButton.test.tsx +57 -9
  292. package/src/modules/workspace/components/renderers/__tests__/EmailRenderer.test.tsx +13 -1
  293. package/src/modules/workspace/components/renderers/__tests__/ImageRenderer.test.tsx +163 -0
  294. package/src/modules/workspace/components/renderers/__tests__/KbMarkdownView.test.tsx +237 -0
  295. package/src/modules/workspace/components/renderers/__tests__/MarkdownRenderer.test.tsx +108 -14
  296. package/src/modules/workspace/components/renderers/__tests__/PptxRenderer.test.tsx +14 -1
  297. package/src/modules/workspace/components/renderers/__tests__/XlsxRenderer.test.tsx +16 -1
  298. package/src/modules/workspace/components/renderers/__tests__/rendererSelection.test.tsx +66 -1
  299. package/src/modules/workspace/components/renderers/index.ts +53 -2
  300. package/src/modules/workspace/components/renderers/kbMarkdownPipeline.tsx +25 -4
  301. package/src/modules/workspace/components/renderers/rendererWorkspace.ts +40 -0
  302. package/src/modules/workspace/hooks/__tests__/useImageRevision.test.tsx +174 -0
  303. package/src/modules/workspace/hooks/__tests__/useOpenChangeRequests.test.tsx +179 -1
  304. package/src/modules/workspace/hooks/__tests__/useWorkspaceImageResolver.test.tsx +122 -0
  305. package/src/modules/workspace/hooks/__tests__/useWorkspaceState.test.tsx +892 -7
  306. package/src/modules/workspace/hooks/useImageRevision.ts +101 -0
  307. package/src/modules/workspace/hooks/useMergedWorkspaceTree.ts +89 -0
  308. package/src/modules/workspace/hooks/useWorkspaceImageResolver.ts +55 -0
  309. package/src/modules/workspace/hooks/useWorkspaceState.ts +438 -66
  310. package/src/modules/workspace/routing/__tests__/kb-routes.test.tsx +279 -3
  311. package/src/modules/workspace/routing/kb-routes.ts +207 -30
  312. package/src/modules/workspace/services/__tests__/workspace.api.test.ts +57 -1
  313. package/src/modules/workspace/services/workspace.api.ts +57 -4
  314. package/src/modules/workspace/state/__tests__/applied-request-clears-pending.test.tsx +343 -0
  315. package/src/modules/workspace/state/__tests__/upload-lands-where-it-was-dropped.test.tsx +158 -0
  316. package/src/modules/workspace/state/open-change-requests.tsx +100 -12
  317. package/src/modules/workspace/state/workspace.context.ts +130 -16
  318. package/src/modules/workspace/utils/__tests__/file-trace.test.ts +73 -0
  319. package/src/modules/workspace/utils/__tests__/fileTree.test.ts +234 -5
  320. package/src/modules/workspace/utils/__tests__/pasteLink.test.ts +76 -0
  321. package/src/modules/workspace/utils/__tests__/treeConfirm.test.ts +364 -0
  322. package/src/modules/workspace/utils/__tests__/uploadError.test.ts +35 -0
  323. package/src/modules/workspace/utils/file-trace.ts +50 -0
  324. package/src/modules/workspace/utils/fileTree.ts +126 -52
  325. package/src/modules/workspace/utils/frontmatter.ts +8 -4
  326. package/src/modules/workspace/utils/pasteLink.ts +90 -0
  327. package/src/modules/workspace/utils/treeConfirm.ts +338 -0
  328. package/src/modules/workspace/utils/uploadError.ts +29 -0
  329. package/src/shared/__tests__/marketplace-url.test.ts +59 -0
  330. package/src/shared/components/Badge.tsx +3 -1
  331. package/src/shared/components/Banner.tsx +5 -1
  332. package/src/shared/components/Button.tsx +16 -2
  333. package/src/shared/components/Dialog.tsx +27 -11
  334. package/src/shared/components/Menu.tsx +13 -1
  335. package/src/shared/components/PageShell.tsx +13 -8
  336. package/src/shared/components/__tests__/primitives.test.tsx +116 -2
  337. package/src/shared/components/__tests__/useFocusHandoff.test.tsx +192 -0
  338. package/src/shared/components/index.ts +2 -0
  339. package/src/shared/components/useDismissableMenu.ts +32 -10
  340. package/src/shared/components/useFocusHandoff.ts +51 -0
  341. package/src/shared/components/useLatestRef.ts +28 -0
  342. package/src/shared/markdown/Markdown.tsx +12 -3
  343. package/src/shared/markdown/__tests__/escapeSpacesInLinkDestinations.test.ts +39 -0
  344. package/src/shared/markdown/hrefs.ts +50 -0
  345. package/src/shared/marketplace-url.ts +118 -0
  346. package/src/shared/mcp/ChatGptInstallLink.tsx +3 -3
  347. package/src/shared/mcp/ConnectionInstructions.tsx +38 -27
  348. package/src/shared/mcp/__tests__/connect-snippets.test.ts +3 -3
  349. package/src/shared/mcp/connect-snippets.ts +14 -9
  350. package/src/shared/mcp/index.ts +1 -1
  351. package/src/shared/theme/__tests__/header-band.test.ts +197 -0
  352. package/src/shared/theme/header.ts +75 -0
  353. package/src/shared/theme/measure.ts +7 -4
  354. package/src/shared/theme/tokens.css +34 -0
  355. package/src/modules/library/__tests__/PluginsIndexPage.test.tsx +0 -363
  356. package/src/modules/library/__tests__/PluginsSidebar.locked.test.tsx +0 -97
  357. package/src/modules/library/components/PluginsIndexPage.tsx +0 -265
  358. package/src/modules/update-check/__tests__/UpdateBanner.test.tsx +0 -126
  359. package/src/modules/update-check/components/UpdateBanner.tsx +0 -92
  360. package/src/modules/update-check/services/update-check.api.ts +0 -24
@@ -0,0 +1,59 @@
1
+ import { cn } from '../../../lib/utils';
2
+ import { SIDEBAR_ROW_INSET } from '../../layout/components/SidebarFrame';
3
+
4
+ /**
5
+ * "2 integrations need setup. Finish now" — the Library's footer reminder.
6
+ *
7
+ * It used to be the last thing `PluginsSidebar` rendered, below its own
8
+ * `</nav>`, carrying a margin and a hairline of its own. That made it the
9
+ * nav's business where the bottom of the sidebar sits, and it disagreed with
10
+ * the change-request dock underneath it about the answer: two insets, two
11
+ * hairlines, no gap. It is a FOOTER ROW now — the layout passes it into
12
+ * `SidebarFrame`'s `footer` slot beside the dock, and the frame spaces the
13
+ * two of them (see `SIDEBAR_FOOTER_SLOT`). All this row owns is the sidebar's
14
+ * row inset and what it says.
15
+ *
16
+ * Renders nothing when nothing needs setup: a reminder with a zero in it is
17
+ * a row of chrome telling you about work that does not exist.
18
+ */
19
+ export function IntegrationsSetupReminder({
20
+ count,
21
+ onFinishSetup,
22
+ }: {
23
+ /** Integrations across the catalog that need setup — the amber count. */
24
+ count: number;
25
+ /** Send the user to the Connect page to finish them. */
26
+ onFinishSetup(): void;
27
+ }) {
28
+ if (count <= 0) return null;
29
+
30
+ const said = `${count} ${count === 1 ? 'integration needs' : 'integrations need'} setup.`;
31
+
32
+ return (
33
+ <button
34
+ type="button"
35
+ onClick={onFinishSetup}
36
+ // The whole line, including the tail the ellipsis is about to eat. A
37
+ // sidebar dragged down to 180px cannot hold this sentence, and
38
+ // `truncate` cuts from the END — the count leads the line and survives;
39
+ // "setup." is what goes. The tooltip is where the sentence is still
40
+ // readable whole at that width.
41
+ title={`${said} Finish now`}
42
+ className={cn(
43
+ 'flex items-center gap-1 rounded-sm py-1.5 text-left text-meta text-ink-faint transition-colors hover:text-ink',
44
+ SIDEBAR_ROW_INSET,
45
+ )}
46
+ >
47
+ {/* The ellipsis goes on the TEXT, and only on the text: the row is a
48
+ flex container, which clips its children without ever drawing one.
49
+ `min-w-0` is what lets this half shrink at all — a flex item's
50
+ automatic minimum is its content, so without it the sentence pushes
51
+ the link off the row instead of truncating. */}
52
+ <span className="min-w-0 truncate">{said}</span>
53
+ {/* Never truncated. The count is the detail; "Finish now" is the way
54
+ out of the situation it describes, and a reminder that ellipses away
55
+ its own call to action is a row that does nothing. */}
56
+ <span className="flex-none underline underline-offset-2">Finish now</span>
57
+ </button>
58
+ );
59
+ }
@@ -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,12 +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 };
77
+ /**
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.
85
+ */
86
+ linkedHome?: string;
45
87
  /** Open the item. The whole card is the target. */
46
88
  onOpen(): void;
47
89
  }
@@ -49,17 +91,23 @@ export interface LibraryCardCommonProps {
49
91
  const STATUS_INK: Record<GemState, string> = {
50
92
  ok: 'text-ok',
51
93
  warn: 'text-wait',
94
+ urgent: 'text-urgent',
52
95
  err: 'text-danger',
53
96
  };
54
97
 
55
98
  /**
56
99
  * One gallery card — the prototype's `.card` (line 158).
57
100
  *
58
- * The whole card is one `<button>` that opens the item, which is why there is
59
- * no ⓘ affordance any more: it used to exist because the card body was spent
60
- * on toggling loadout membership, so opening needed its own target. With the
61
- * loadout gone the card has a single action, and a card with a single action
62
- * 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.
63
111
  *
64
112
  * The two-line clamp on the description is load-bearing, not cosmetic. Skill
65
113
  * descriptions run to full paragraphs, so without it a card grows to whatever
@@ -75,7 +123,9 @@ export function LibraryCard({
75
123
  status,
76
124
  version,
77
125
  pending,
126
+ linkedHome,
78
127
  onOpen,
128
+ onShare,
79
129
  flavor,
80
130
  }: LibraryCardProps) {
81
131
  /**
@@ -89,10 +139,11 @@ export function LibraryCard({
89
139
  * its own to report; a green "Ready" on every skill in the grid is a row of
90
140
  * noise that says nothing, and it buries the two cards that DO need you.
91
141
  *
92
- * A PROPOSED skill overrides both, because the one thing to know about it is
93
- * that it is not usable yet — and by whose hand it got here. The status it
94
- * carries is about integrations and has nothing to say about a file nobody
95
- * 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.
96
147
  */
97
148
  const footNote = pending
98
149
  ? null
@@ -100,7 +151,54 @@ export function LibraryCard({
100
151
  ? status
101
152
  : null;
102
153
 
103
- 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 = (
104
202
  <Surface
105
203
  as="button"
106
204
  type="button"
@@ -121,28 +219,20 @@ export function LibraryCard({
121
219
  )}
122
220
  onClick={onOpen}
123
221
  >
124
- <span className="flex items-center gap-2">
125
- {/* Only tools carry a mark. A skill has no brand to recognise — its
126
- name IS the thing — and a monogram beside every skill would add a
127
- column of coloured squares that distinguish nothing. */}
128
- {kind === 'integration' && <ToolLogo slug={id} name={name} />}
129
- <span className="truncate text-lede font-semibold text-ink">{name}</span>
130
- {kind === 'integration' && flavor && (
131
- <Badge tone="outline" size="xs" className="shrink-0 uppercase">
132
- {flavor === 'mcp' ? 'MCP server' : 'UTCP manual'}
133
- </Badge>
134
- )}
135
- {pending && (
136
- <Badge tone="wait" size="xs" className="shrink-0 uppercase">
137
- In review
138
- </Badge>
139
- )}
140
- {owned && !pending && (
141
- <Badge tone="outline" size="xs" className="shrink-0 uppercase">
142
- Owner
143
- </Badge>
144
- )}
145
- </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
+ />
146
236
 
147
237
  {description && (
148
238
  <span className="line-clamp-2 text-detail text-ink-muted">{description}</span>
@@ -185,4 +275,29 @@ export function LibraryCard({
185
275
  )}
186
276
  </Surface>
187
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
+ );
188
303
  }