@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
@@ -6,7 +6,9 @@ import { cn } from '../../../lib/utils';
6
6
  import { Banner, Button, Dialog, IconButton } from '../../../shared/components';
7
7
  import { pathForPluginsIndex } from '../routes/library-paths';
8
8
  import type { LibraryItem } from '../state/library-data';
9
+ import { linkedHomeOf } from '../utils/status';
9
10
  import { removeLibraryItem } from '../services/library.api';
11
+ import { unlinkSkill } from '../services/plugins.api';
10
12
  import { LibraryCard } from './LibraryCard';
11
13
 
12
14
  /**
@@ -19,17 +21,30 @@ import { LibraryCard } from './LibraryCard';
19
21
  * promise drift the first time either is touched.
20
22
  */
21
23
 
22
- /** `All plugins › {name}` — the page's place in the Library, and the way back. */
23
- export function PluginBreadcrumb({ name }: { name: string }) {
24
+ /**
25
+ * `Everything ›` — the page's place in the Library, and the way back.
26
+ *
27
+ * It belongs ON the page's title band, as the band's leading item, and not in
28
+ * a row above it. A row above the band pushes the title bar down off the line
29
+ * the sidebar's header row holds, which is the seam `shared/theme/header`
30
+ * exists to keep — and the seam is the first thing anyone sees below the
31
+ * toolbar.
32
+ *
33
+ * The trail stops SHORT of the current page for the same reason: the `<h1>`
34
+ * standing beside it IS the current page, and a crumb repeating the heading
35
+ * it sits next to says the name twice on one line. That also makes the trail
36
+ * a fixed width, so it never competes with the title for the row's space.
37
+ */
38
+ export function PluginBreadcrumb() {
24
39
  return (
25
- <nav aria-label="Breadcrumb" className="flex items-center gap-1.5 text-detail text-ink-faint">
40
+ <nav
41
+ aria-label="Breadcrumb"
42
+ className="flex flex-none items-center gap-1.5 text-detail text-ink-faint"
43
+ >
26
44
  <Link to={pathForPluginsIndex()} className="rounded-xs hover:text-ink">
27
- All plugins
45
+ Everything
28
46
  </Link>
29
47
  <span aria-hidden="true">›</span>
30
- <span aria-current="page" className="truncate text-ink-muted">
31
- {name}
32
- </span>
33
48
  </nav>
34
49
  );
35
50
  }
@@ -110,10 +125,24 @@ export function PluginSection({
110
125
  export function CardGrid({
111
126
  items,
112
127
  onOpen,
128
+ onShare,
113
129
  onRemove,
130
+ canRemove,
131
+ linkedIn,
132
+ linkedRoots,
114
133
  }: {
115
134
  items: LibraryItem[];
116
135
  onOpen(item: LibraryItem): void;
136
+ /**
137
+ * Open Manage access on a SKILL's own folder — the skill page's `Share`,
138
+ * from the card's `…` menu. Absent: no card carries a menu.
139
+ *
140
+ * Only skills are offered it, and the card's props enforce that: access to a
141
+ * tool is decided at the plugin that carries it, so a tool has no rules of
142
+ * its own to open. A PROPOSED skill is left out too — its folder is on a
143
+ * change request's branch and does not exist on the one the dialog reads.
144
+ */
145
+ onShare?(item: LibraryItem): void;
117
146
  /**
118
147
  * The manager's "remove from this place". Present only when the caller
119
148
  * runs the page the grid is on — the pages decide that, not the grid.
@@ -121,6 +150,30 @@ export function CardGrid({
121
150
  * card is one <button>, and a button inside a button is not HTML.
122
151
  */
123
152
  onRemove?(item: LibraryItem): void;
153
+ /**
154
+ * Per item, whether the verb would succeed — a link into a plugin whose
155
+ * links live in an external format cannot be removed here. Absent: every
156
+ * item. A verb the server would refuse is not offered.
157
+ */
158
+ canRemove?(item: LibraryItem): boolean;
159
+ /**
160
+ * The plugin whose page this grid is on. With it, a card whose membership in
161
+ * that plugin is by LINK wears the Linked pill, naming on hover the folder
162
+ * the item actually lives in.
163
+ *
164
+ * Absent on every surface that is not one plugin's page: your own space has
165
+ * no manifest to link from, and a gallery card belongs to as many plugins as
166
+ * it belongs to — there is no "this plugin" for it to be linked from.
167
+ */
168
+ linkedIn?: string;
169
+ /**
170
+ * That plugin's `linkedRoots` — the folders its manifest names. The pill's
171
+ * tooltip names the root a card came in through, and only the manifest
172
+ * knows which root that is (see `linkedHomeOf`). Absent or empty when the
173
+ * summary has not arrived, which the tooltip degrades around rather than
174
+ * waiting for.
175
+ */
176
+ linkedRoots?: readonly string[];
124
177
  }) {
125
178
  return (
126
179
  <div
@@ -130,22 +183,33 @@ export function CardGrid({
130
183
  )}
131
184
  >
132
185
  {items.map((item) => {
133
- // The change-request number is part of the key, not decoration: two
134
- // people can propose a skill of the same name into different plugins,
135
- // and until one of them merges neither is in the catalog to collide
136
- // with — so the name alone is not yet unique.
137
- const key = `${item.kind}:${item.id}:${item.pending?.changeRequestNumber ?? ''}`;
186
+ // The change-request number AND the declaration's path are part of the
187
+ // key, not decoration. A released item's id is unique because the
188
+ // catalog refuses a collision; a PROPOSAL has been refused nothing yet.
189
+ // Two people can propose the same name into different plugins, and one
190
+ // request can add `weather.tool` to two plugin folders at once — same
191
+ // id, same request number, and the path is what tells them apart.
192
+ const key = item.pending
193
+ ? `${item.kind}:${item.id}:${item.pending.changeRequestNumber}:${item.path}`
194
+ : `${item.kind}:${item.id}`;
138
195
  // The flavor badge names the DECLARATION file — which file an owner
139
196
  // edits — not the transport: a `.tool` manual whose call template is
140
197
  // `type: mcp` still edits as a UTCP manual, so the path suffix is the
141
198
  // authoritative signal, not the tool's `type` metadata.
199
+ // Whether THIS card carries a `…`, which the remove overlay below has
200
+ // to know: both are corner controls on the same card, and two things
201
+ // pinned to the same corner is one thing you cannot click.
202
+ const menued = item.kind === 'skill' && !!onShare && !item.pending;
142
203
  const kindProps =
143
204
  item.kind === 'integration'
144
205
  ? ({
145
206
  kind: 'integration',
146
207
  flavor: item.path.endsWith('/mcp.json') ? 'mcp' : 'utcp',
147
208
  } as const)
148
- : ({ kind: 'skill' } as const);
209
+ : ({
210
+ kind: 'skill',
211
+ onShare: menued ? () => onShare!(item) : undefined,
212
+ } as const);
149
213
  const card = (
150
214
  <LibraryCard
151
215
  key={key}
@@ -156,6 +220,9 @@ export function CardGrid({
156
220
  owned={item.owned}
157
221
  status={item.status}
158
222
  version={item.version}
223
+ // Null (inline, or no plugin in question) has to become `undefined`
224
+ // — the prop is "there is a folder to name", and `null` is not it.
225
+ linkedHome={(linkedIn ? linkedHomeOf(item, linkedIn, linkedRoots) : null) ?? undefined}
159
226
  pending={
160
227
  item.pending && {
161
228
  authorName: item.pending.authorName,
@@ -167,7 +234,7 @@ export function CardGrid({
167
234
  );
168
235
  // A pending proposal is not IN the place yet — there is nothing to
169
236
  // remove; declining it lives with the review.
170
- if (!onRemove || item.pending) return card;
237
+ if (!onRemove || item.pending || (canRemove && !canRemove(item))) return card;
171
238
  return (
172
239
  // `grid`, not a plain block: the wrapper takes the card's place as
173
240
  // the grid item, and only a grid (or flex) container stretches its
@@ -182,8 +249,12 @@ export function CardGrid({
182
249
  title={`Remove ${item.name}`}
183
250
  onClick={() => onRemove(item)}
184
251
  className={cn(
185
- 'absolute right-1.5 top-1.5 rounded-sm border border-line bg-surface p-1 text-ink-faint',
252
+ 'absolute top-1.5 rounded-sm border border-line bg-surface p-1 text-ink-faint',
186
253
  'opacity-0 transition-opacity hover:text-danger focus-visible:opacity-100 group-hover/removable:opacity-100',
254
+ // The overflow `…` keeps the corner — that is where every menu
255
+ // in this product lives — so Remove steps left of it on a card
256
+ // that has one, and keeps the corner on a card that does not.
257
+ menued ? 'right-8' : 'right-1.5',
187
258
  )}
188
259
  >
189
260
  <Trash2 size={13} />
@@ -199,16 +270,24 @@ export function CardGrid({
199
270
  * The "are you sure" a removal deserves: deleting a skill or tool from a
200
271
  * plugin takes it from EVERYONE in the plugin, not from a personal shelf, and
201
272
  * there is no undo shortcut — the content survives only in git history.
273
+ *
274
+ * A LINKED skill is the other case: it lives elsewhere and the plugin only
275
+ * points at it, so "remove" means unlink — the manifest entry and the
276
+ * plugin's grant go, the skill stays where it is. Sending a link through the
277
+ * delete path would delete a shared skill (or be refused by its own rules).
202
278
  */
203
279
  export function RemoveLibraryItemDialog({
204
280
  item,
205
281
  place,
282
+ linked = false,
206
283
  onClose,
207
284
  onRemoved,
208
285
  }: {
209
286
  item: LibraryItem;
210
287
  /** Where it is being removed from, for the copy: a plugin name, or "your space". */
211
288
  place: string;
289
+ /** The item is in `place` by LINK — remove the link, not the item. `place` is then the plugin. */
290
+ linked?: boolean;
212
291
  onClose(): void;
213
292
  /** Fired after the delete lands; the host page reloads and says so. */
214
293
  onRemoved(): void;
@@ -221,7 +300,8 @@ export function RemoveLibraryItemDialog({
221
300
  setBusy(true);
222
301
  setError(null);
223
302
  try {
224
- await removeLibraryItem(item.path);
303
+ if (linked) await unlinkSkill(place, item.path);
304
+ else await removeLibraryItem(item.path);
225
305
  onRemoved();
226
306
  onClose();
227
307
  } catch (err) {
@@ -236,7 +316,7 @@ export function RemoveLibraryItemDialog({
236
316
  <Dialog
237
317
  open
238
318
  onClose={onClose}
239
- title={`Remove ${item.name}?`}
319
+ title={linked ? `Unlink ${item.name}?` : `Remove ${item.name}?`}
240
320
  size="md"
241
321
  busy={busy}
242
322
  footer={
@@ -245,15 +325,17 @@ export function RemoveLibraryItemDialog({
245
325
  Cancel
246
326
  </Button>
247
327
  <Button variant="danger" onClick={() => void remove()} disabled={busy}>
248
- {busy ? 'Removing…' : 'Remove'}
328
+ {busy ? (linked ? 'Unlinking…' : 'Removing…') : linked ? 'Unlink' : 'Remove'}
249
329
  </Button>
250
330
  </>
251
331
  }
252
332
  >
253
333
  <p className="text-ui text-ink-muted">
254
- {item.kind === 'skill'
255
- ? `This deletes the skill and its files from ${place}. Everyone here loses it the next time their agent connects.`
256
- : `This deletes the tool and its connection settings from ${place}. Skills here that need it will ask for setup again.`}
334
+ {linked
335
+ ? `This removes the link from ${place}. The skill itself stays where it lives; ${place}'s members stop seeing it here.`
336
+ : item.kind === 'skill'
337
+ ? `This deletes the skill and its files from ${place}. Everyone here loses it the next time their agent connects.`
338
+ : `This deletes the tool and its connection settings from ${place}. Skills here that need it will ask for setup again.`}
257
339
  </p>
258
340
  {error && (
259
341
  <Banner tone="danger" role="alert" className="mt-3">
@@ -275,18 +357,30 @@ export function PluginItemSections({
275
357
  skillItems,
276
358
  toolItems,
277
359
  onOpen,
360
+ onShare,
278
361
  onRemove,
362
+ canRemove,
279
363
  emptySkills,
280
364
  emptyTools = 'No tools yet.',
281
365
  hideEmpty = false,
282
366
  skillControls,
283
367
  skillControlsActive = false,
368
+ linkedIn,
369
+ linkedRoots,
284
370
  }: {
285
371
  skillItems: LibraryItem[];
286
372
  toolItems: LibraryItem[];
287
373
  onOpen(item: LibraryItem): void;
374
+ /** See {@link CardGrid} — the skill cards' `Share`. Tools never get one. */
375
+ onShare?(item: LibraryItem): void;
288
376
  /** See {@link CardGrid} — present only when the caller manages this place. */
289
377
  onRemove?(item: LibraryItem): void;
378
+ /** See {@link CardGrid}. */
379
+ canRemove?(item: LibraryItem): boolean;
380
+ /** See {@link CardGrid} — the plugin a card can be linked FROM. */
381
+ linkedIn?: string;
382
+ /** See {@link CardGrid} — that plugin's linked roots, for the pill's tooltip. */
383
+ linkedRoots?: readonly string[];
290
384
  /**
291
385
  * A plain sentence, or an `EmptySkillsNudge`. A string still gets the band's
292
386
  * standard paragraph; a node is trusted to bring its own — the nudge carries
@@ -329,7 +423,15 @@ export function PluginItemSections({
329
423
  emptySkills
330
424
  )
331
425
  ) : (
332
- <CardGrid items={skillItems} onOpen={onOpen} onRemove={onRemove} />
426
+ <CardGrid
427
+ items={skillItems}
428
+ onOpen={onOpen}
429
+ onShare={onShare}
430
+ onRemove={onRemove}
431
+ canRemove={canRemove}
432
+ linkedIn={linkedIn}
433
+ linkedRoots={linkedRoots}
434
+ />
333
435
  )}
334
436
  </PluginSection>
335
437
  )}
@@ -339,7 +441,14 @@ export function PluginItemSections({
339
441
  {toolItems.length === 0 ? (
340
442
  <p className="text-ui text-ink-faint">{emptyTools}</p>
341
443
  ) : (
342
- <CardGrid items={toolItems} onOpen={onOpen} onRemove={onRemove} />
444
+ <CardGrid
445
+ items={toolItems}
446
+ onOpen={onOpen}
447
+ onRemove={onRemove}
448
+ canRemove={canRemove}
449
+ linkedIn={linkedIn}
450
+ linkedRoots={linkedRoots}
451
+ />
343
452
  )}
344
453
  </PluginSection>
345
454
  )}
@@ -0,0 +1,212 @@
1
+ import { useMemo, useState } from 'react';
2
+ import { Link } from 'react-router-dom';
3
+ import { Badge, Button } from '../../../../shared/components';
4
+ import { useLibrary } from '../../state/library-data';
5
+ import { useLibraryToast } from '../../state/toast.context';
6
+ import { NeedsSkillWriteError, linkSkill, repairSkillLink, unlinkSkill } from '../../services/plugins.api';
7
+ import { requestSkillAccess, type PluginMembership } from '../../services/library.api';
8
+ import { pathForPlugin } from '../../routes/library-paths';
9
+ import { StatusDot } from '../StatusDot';
10
+ import { cn } from '../../../../lib/utils';
11
+
12
+ /**
13
+ * "In plugins" — every plugin this skill belongs to, and the two ways the
14
+ * relationship is managed from the skill's side.
15
+ *
16
+ * A row is INLINE (the skill sits in the plugin's folder) or LINKED (the
17
+ * plugin's manifest points at it). A link is healthy when the skill's own
18
+ * access rules still name the plugin's principal; when a hand edit removed
19
+ * that grant, the row shows the amber dot and — to someone who can edit the
20
+ * skill — a Repair button, because until it is back the plugin's members
21
+ * cannot read the skill. Unlink is the plugin MANAGER's verb (it edits the
22
+ * plugin's manifest), so it appears only on plugins the caller manages.
23
+ *
24
+ * "Add to plugin" links this skill into a plugin the caller manages. It
25
+ * needs write on the skill too; a refusal of that shape offers the request.
26
+ */
27
+ export function SharedViaPlugins({
28
+ skillName,
29
+ skillPath,
30
+ memberships,
31
+ canWrite,
32
+ onChanged,
33
+ }: {
34
+ skillName: string;
35
+ skillPath: string;
36
+ memberships: PluginMembership[];
37
+ /** The caller may edit the skill (its SKILL.md) — the repair verb. */
38
+ canWrite: boolean;
39
+ onChanged(): void;
40
+ }) {
41
+ const data = useLibrary();
42
+ const toast = useLibraryToast();
43
+ const [busy, setBusy] = useState<string | null>(null);
44
+ const [adding, setAdding] = useState(false);
45
+ const [needsWrite, setNeedsWrite] = useState<'ask' | 'requested' | null>(null);
46
+
47
+ // Plugins the caller manages AND whose links this platform writes: a
48
+ // plugin read from an external format has no link to add or remove here.
49
+ const managed = useMemo(
50
+ () =>
51
+ new Set(
52
+ data.pluginSummaries.filter((p) => p.canWrite && p.linksAreManaged !== false).map((p) => p.name),
53
+ ),
54
+ [data.pluginSummaries],
55
+ );
56
+ const addable = useMemo(
57
+ () => [...managed].filter((name) => !memberships.some((m) => m.name === name)).sort(),
58
+ [managed, memberships],
59
+ );
60
+
61
+ async function run(label: string, op: () => Promise<unknown>, done: string) {
62
+ setBusy(label);
63
+ try {
64
+ await op();
65
+ toast(done);
66
+ onChanged();
67
+ } catch (err) {
68
+ if (err instanceof NeedsSkillWriteError) setNeedsWrite('ask');
69
+ else toast(err instanceof Error ? err.message : `Couldn't ${label}.`, 'danger');
70
+ } finally {
71
+ setBusy(null);
72
+ }
73
+ }
74
+
75
+ if (memberships.length === 0 && addable.length === 0) return null;
76
+
77
+ return (
78
+ <section className="mt-6" data-testid="shared-via-plugins">
79
+ <h2 className="mb-2.5 text-label font-semibold uppercase text-ink-faint">In plugins</h2>
80
+ <div className="grid gap-2">
81
+ {memberships.length === 0 && (
82
+ <p className="text-detail text-ink-faint">This skill is in no plugin yet.</p>
83
+ )}
84
+ {memberships.map((m) => {
85
+ const broken = m.linked && !m.granted;
86
+ return (
87
+ <div
88
+ key={m.name}
89
+ className="flex items-center gap-3 rounded-md border border-line bg-sunken px-3 py-2"
90
+ >
91
+ <div className="min-w-0">
92
+ <div className="flex items-center gap-1.5">
93
+ <Link to={pathForPlugin(m.name)} className="truncate text-detail font-semibold text-ink underline-offset-2 hover:underline">
94
+ {m.name}
95
+ </Link>
96
+ <Badge tone="outline" size="xs" className="shrink-0 uppercase">
97
+ {m.linked ? 'Linked' : 'Inline'}
98
+ </Badge>
99
+ </div>
100
+ <small className={cn('block text-meta', broken ? 'text-urgent' : 'text-ink-faint')}>
101
+ {broken
102
+ ? canWrite
103
+ ? `Needs setup: ${m.name}'s members can't read this skill until the link is repaired.`
104
+ : `Needs setup: ${m.name}'s members can't read this skill. Ask an editor to repair the link.`
105
+ : m.linked
106
+ ? `${m.name}'s members can read it; its managers can edit it.`
107
+ : `Lives in ${m.name}'s folder.`}
108
+ </small>
109
+ </div>
110
+ <div className="ml-auto flex shrink-0 items-center gap-2">
111
+ {broken && <StatusDot state="urgent" />}
112
+ {broken && canWrite && (
113
+ <Button
114
+ variant="outline"
115
+ size="tiny"
116
+ disabled={busy !== null}
117
+ onClick={() =>
118
+ void run('repair', () => repairSkillLink(m.name, skillPath), `${m.name} can read ${skillName} again.`)
119
+ }
120
+ >
121
+ Repair
122
+ </Button>
123
+ )}
124
+ {m.linked && managed.has(m.name) && (
125
+ <Button
126
+ variant="quiet"
127
+ size="tiny"
128
+ disabled={busy !== null}
129
+ onClick={() =>
130
+ void run('unlink', () => unlinkSkill(m.name, skillPath), `${skillName} is no longer in ${m.name}.`)
131
+ }
132
+ >
133
+ Unlink
134
+ </Button>
135
+ )}
136
+ </div>
137
+ </div>
138
+ );
139
+ })}
140
+ </div>
141
+
142
+ {addable.length > 0 && (
143
+ <div className="mt-2.5">
144
+ {needsWrite === 'requested' ? (
145
+ <span className="text-detail text-ink-faint">Asked the skill's editors for write access.</span>
146
+ ) : needsWrite === 'ask' ? (
147
+ <div className="flex flex-wrap items-center gap-2">
148
+ <span className="text-detail text-wait">
149
+ {"You can't change who may read this skill yet."}
150
+ </span>
151
+ <Button
152
+ variant="outline"
153
+ size="tiny"
154
+ disabled={busy !== null}
155
+ onClick={() =>
156
+ void (async () => {
157
+ setBusy('request');
158
+ try {
159
+ await requestSkillAccess(skillName);
160
+ setNeedsWrite('requested');
161
+ } catch (err) {
162
+ toast(err instanceof Error ? err.message : "Couldn't request access.", 'danger');
163
+ } finally {
164
+ setBusy(null);
165
+ }
166
+ })()
167
+ }
168
+ >
169
+ Request write access
170
+ </Button>
171
+ </div>
172
+ ) : adding ? (
173
+ <div className="flex flex-wrap items-center gap-2">
174
+ <label className="text-detail text-ink-muted" htmlFor="add-to-plugin-select">
175
+ Add to
176
+ </label>
177
+ <select
178
+ id="add-to-plugin-select"
179
+ className="rounded-md border border-line bg-surface px-2 py-1 text-ui text-ink"
180
+ defaultValue=""
181
+ disabled={busy !== null}
182
+ onChange={(e) => {
183
+ const name = e.target.value;
184
+ if (!name) return;
185
+ void run('link', () => linkSkill(name, skillPath), `${skillName} is now in ${name}.`).then(() =>
186
+ setAdding(false),
187
+ );
188
+ }}
189
+ >
190
+ <option value="" disabled>
191
+ Choose a plugin…
192
+ </option>
193
+ {addable.map((name) => (
194
+ <option key={name} value={name}>
195
+ {name}
196
+ </option>
197
+ ))}
198
+ </select>
199
+ <Button variant="quiet" size="tiny" onClick={() => setAdding(false)}>
200
+ Cancel
201
+ </Button>
202
+ </div>
203
+ ) : (
204
+ <Button variant="outline" size="sm" onClick={() => setAdding(true)}>
205
+ Add to plugin…
206
+ </Button>
207
+ )}
208
+ </div>
209
+ )}
210
+ </section>
211
+ );
212
+ }
@@ -2,6 +2,7 @@ import type { ReactNode } from 'react';
2
2
  import '../../../change-requests/change-requests.css';
3
3
  import { FilePaneCard } from '../../../workspace/components/FilePaneCard';
4
4
  import { KbMarkdownView } from '../../../workspace/components/renderers/KbMarkdownView';
5
+ import type { KbImageResolver } from '../../../workspace/components/renderers/kbMarkdownPipeline';
5
6
  import { HtmlRenderer } from '../../../workspace/components/renderers/HtmlRenderer';
6
7
  import type { DiffLine } from '../../../change-requests/utils/diff';
7
8
 
@@ -29,6 +30,8 @@ interface SkillFilePaneProps {
29
30
  onOpenNodeId?(id: string): void;
30
31
  /** Heading deep-link builder; present ⇒ headings get the copy-anchor button. */
31
32
  headingLink?(slug: string): string;
33
+ /** Image source resolver, same contract as `KbMarkdownView`; absent ⇒ plain `<img>` tags. */
34
+ resolveImage?: KbImageResolver;
32
35
  }
33
36
 
34
37
  /**
@@ -51,6 +54,7 @@ export function SkillFilePane({
51
54
  onOpenLink,
52
55
  onOpenNodeId,
53
56
  headingLink,
57
+ resolveImage,
54
58
  }: SkillFilePaneProps) {
55
59
  return (
56
60
  <FilePaneCard file={file} actions={actions} notice={notice} className="mt-4">
@@ -69,6 +73,7 @@ export function SkillFilePane({
69
73
  onOpenFile={(href) => onOpenLink?.(href)}
70
74
  onOpenNodeId={onOpenNodeId}
71
75
  headingLink={headingLink}
76
+ resolveImage={resolveImage}
72
77
  scroll={false}
73
78
  />
74
79
  ) : /\.html?$/i.test(file) ? (