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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (360) hide show
  1. package/THIRD-PARTY-NOTICES.md +2 -2
  2. package/package.json +3 -3
  3. package/src/core/CoreAppShell.tsx +34 -26
  4. package/src/core/__tests__/AppChrome.test.tsx +0 -3
  5. package/src/core/__tests__/bootstrap.test.ts +33 -1
  6. package/src/core/__tests__/events.test.ts +43 -0
  7. package/src/core/bootstrap.ts +38 -1
  8. package/src/core/events.ts +85 -3
  9. package/src/core/registry.ts +1 -1
  10. package/src/lib/__tests__/api.test.ts +38 -0
  11. package/src/lib/__tests__/email.test.ts +44 -0
  12. package/src/lib/api.ts +19 -2
  13. package/src/lib/email.ts +37 -1
  14. package/src/lib/utils.ts +2 -0
  15. package/src/modules/access/__tests__/ManageAccessDialog.add-row-picking.test.tsx +141 -0
  16. package/src/modules/access/__tests__/ManageAccessDialog.chip-truncation.test.tsx +204 -0
  17. package/src/modules/access/__tests__/ManageAccessDialog.download-read.test.tsx +234 -0
  18. package/src/modules/access/__tests__/ManageAccessDialog.edited-row-visible.test.tsx +160 -0
  19. package/src/modules/access/__tests__/ManageAccessDialog.placement.test.tsx +2 -2
  20. package/src/modules/access/__tests__/ManageAccessDialog.proposal.test.tsx +166 -0
  21. package/src/modules/access/__tests__/ManageAccessDialog.restrict.test.tsx +510 -0
  22. package/src/modules/access/__tests__/ManageAccessDialog.row-menu-axes.test.tsx +299 -0
  23. package/src/modules/access/__tests__/ManageAccessDialog.row-menu-width.test.tsx +226 -0
  24. package/src/modules/access/__tests__/ManageAccessDialog.test.tsx +781 -76
  25. package/src/modules/access/__tests__/ManageAccessDialog.unknown-email.test.tsx +314 -0
  26. package/src/modules/access/__tests__/manage-access-affordance.test.ts +14 -0
  27. package/src/modules/access/__tests__/plugin-token.test.ts +21 -0
  28. package/src/modules/access/__tests__/tailwindDeclarations.ts +210 -0
  29. package/src/modules/access/api.ts +192 -10
  30. package/src/modules/access/components/ManageAccessDialog.tsx +1337 -570
  31. package/src/modules/access/manage-access-affordance.ts +17 -0
  32. package/src/modules/admin/__tests__/AddMemberInput.test.tsx +297 -0
  33. package/src/modules/admin/__tests__/AdminRolesPage.capabilities.test.tsx +2 -2
  34. package/src/modules/admin/__tests__/AdminRolesPage.fixed-admin.test.tsx +189 -0
  35. package/src/modules/admin/__tests__/AdminRolesPage.suggest.test.tsx +1 -1
  36. package/src/modules/admin/__tests__/ConnectionKeysPage.test.tsx +266 -0
  37. package/src/modules/admin/__tests__/DirectoryGroupsPage.suggest.test.tsx +182 -0
  38. package/src/modules/admin/__tests__/DirectoryGroupsPage.test.tsx +165 -14
  39. package/src/modules/admin/__tests__/UserAccountsPage.test.tsx +401 -4
  40. package/src/modules/admin/__tests__/group-members-path.test.ts +27 -0
  41. package/src/modules/admin/components/AddMemberInput.tsx +268 -0
  42. package/src/modules/admin/components/AdminRolesPage.tsx +97 -132
  43. package/src/modules/admin/components/ConnectionKeysPage.tsx +269 -0
  44. package/src/modules/admin/components/DirectoryGroupsPage.tsx +91 -39
  45. package/src/modules/admin/components/UserAccountsPage.tsx +271 -37
  46. package/src/modules/admin/components/connection-keys-grouping.ts +43 -0
  47. package/src/modules/admin/components/group-members-path.ts +32 -0
  48. package/src/modules/admin/services/connection-keys.api.ts +47 -0
  49. package/src/modules/admin/services/roles.api.ts +12 -1
  50. package/src/modules/auth/__tests__/AccountPage.test.tsx +50 -2
  51. package/src/modules/auth/components/AccountPage.tsx +73 -54
  52. package/src/modules/auth/components/LoginScreen.tsx +1 -0
  53. package/src/modules/auth/services/account.api.ts +78 -4
  54. package/src/modules/change-requests/__tests__/ChangeRequestDialog.access-rules.test.tsx +144 -0
  55. package/src/modules/change-requests/__tests__/ChangeRequestDialog.binary.test.tsx +422 -0
  56. package/src/modules/change-requests/__tests__/ChangeRequestDialog.brings-itself-up-to-date.test.tsx +431 -0
  57. package/src/modules/change-requests/__tests__/ChangeRequestDialog.fork-point.test.tsx +193 -0
  58. package/src/modules/change-requests/__tests__/ChangeRequestDialog.initial-file.test.tsx +142 -0
  59. package/src/modules/change-requests/__tests__/ChangeRequestDialog.moved.test.tsx +202 -0
  60. package/src/modules/change-requests/__tests__/ChangeRequestDialog.test.tsx +205 -13
  61. package/src/modules/change-requests/__tests__/ChangeRequestDialog.unreadable.test.tsx +271 -0
  62. package/src/modules/change-requests/__tests__/FileChangeBoxes.test.tsx +208 -0
  63. package/src/modules/change-requests/__tests__/apply-outcome-for-every-viewer.test.tsx +286 -0
  64. package/src/modules/change-requests/__tests__/propose.concurrent.test.ts +273 -0
  65. package/src/modules/change-requests/__tests__/readFailure.test.ts +122 -0
  66. package/src/modules/change-requests/__tests__/useCrFileDiffs.test.tsx +238 -0
  67. package/src/modules/change-requests/__tests__/useFileOnBranch.test.tsx +56 -1
  68. package/src/modules/change-requests/__tests__/useForkPointFile.test.tsx +79 -0
  69. package/src/modules/change-requests/components/BranchFilePreview.tsx +357 -0
  70. package/src/modules/change-requests/components/ChangeBox.tsx +31 -2
  71. package/src/modules/change-requests/components/ChangeRequestDialog.tsx +862 -72
  72. package/src/modules/change-requests/components/CrFileTree.tsx +74 -58
  73. package/src/modules/change-requests/components/FileChangeBoxes.tsx +19 -15
  74. package/src/modules/change-requests/hooks/useApplyChangeRequest.ts +41 -7
  75. package/src/modules/change-requests/hooks/useCrFileDiffs.ts +181 -23
  76. package/src/modules/change-requests/hooks/useFileOnBranch.ts +70 -7
  77. package/src/modules/change-requests/hooks/useForkPointFile.ts +77 -0
  78. package/src/modules/change-requests/services/change-requests.api.ts +57 -1
  79. package/src/modules/change-requests/services/denied-file.api.ts +53 -0
  80. package/src/modules/change-requests/services/propose.api.ts +97 -8
  81. package/src/modules/change-requests/utils/approval.ts +15 -0
  82. package/src/modules/change-requests/utils/author.ts +32 -0
  83. package/src/modules/change-requests/utils/readFailure.ts +110 -0
  84. package/src/modules/git/__tests__/FileHistoryPanel.test.tsx +20 -0
  85. package/src/modules/git/__tests__/GitSyncFailedBanner.test.tsx +65 -1
  86. package/src/modules/git/components/FileHistoryPanel.tsx +5 -0
  87. package/src/modules/git/components/GitSyncFailedBanner.tsx +68 -5
  88. package/src/modules/git/components/PullRequestsForMe.tsx +51 -24
  89. package/src/modules/git/services/__tests__/error-messages.test.ts +29 -0
  90. package/src/modules/git/services/error-messages.ts +12 -0
  91. package/src/modules/git/services/pr-prompts.ts +5 -5
  92. package/src/modules/layout/__tests__/HeaderAlignment.test.tsx +401 -0
  93. package/src/modules/layout/__tests__/SidebarFooterGrid.test.tsx +286 -0
  94. package/src/modules/layout/__tests__/SidebarFrameResponsive.test.tsx +61 -0
  95. package/src/modules/layout/components/AppLayout.tsx +2 -0
  96. package/src/modules/layout/components/MobileChatLayout.tsx +4 -1
  97. package/src/modules/layout/components/ResizableThreePaneLayout.tsx +4 -1
  98. package/src/modules/layout/components/SidebarFrame.tsx +109 -4
  99. package/src/modules/library/__tests__/AddToPluginDialog.test.tsx +171 -5
  100. package/src/modules/library/__tests__/DeleteToolDialog.test.tsx +356 -0
  101. package/src/modules/library/__tests__/IntegrationsSetupReminder.test.tsx +60 -0
  102. package/src/modules/library/__tests__/LibraryCard.test.tsx +91 -10
  103. package/src/modules/library/__tests__/LibraryRoutes.test.tsx +242 -107
  104. package/src/modules/library/__tests__/LibrarySidebarMenu.test.tsx +104 -99
  105. package/src/modules/library/__tests__/LinkSkillPanel.test.tsx +136 -0
  106. package/src/modules/library/__tests__/LockedPluginView.test.tsx +103 -7
  107. package/src/modules/library/__tests__/NewPluginDialog.test.tsx +18 -8
  108. package/src/modules/library/__tests__/PersonalAddDialog.test.tsx +79 -3
  109. package/src/modules/library/__tests__/PersonalPluginPage.test.tsx +201 -0
  110. package/src/modules/library/__tests__/PluginExtras.test.tsx +115 -9
  111. package/src/modules/library/__tests__/PluginJoinRequests.test.tsx +60 -1
  112. package/src/modules/library/__tests__/PluginPage.test.tsx +453 -7
  113. package/src/modules/library/__tests__/PluginsSidebar.contextmenu.test.tsx +17 -57
  114. package/src/modules/library/__tests__/PluginsSidebar.test.tsx +161 -97
  115. package/src/modules/library/__tests__/PluginsSidebarMenu.test.tsx +16 -0
  116. package/src/modules/library/__tests__/SharedViaPlugins.test.tsx +106 -0
  117. package/src/modules/library/__tests__/SkillPage.test.tsx +391 -78
  118. package/src/modules/library/__tests__/SkillsTree.test.tsx +461 -0
  119. package/src/modules/library/__tests__/ToolConnectionSection.test.tsx +582 -71
  120. package/src/modules/library/__tests__/ToolPage.test.tsx +94 -4
  121. package/src/modules/library/__tests__/WorkspaceItemRoute.test.tsx +279 -21
  122. package/src/modules/library/__tests__/auth-harness.tsx +9 -9
  123. package/src/modules/library/__tests__/card-row-menu.test.tsx +320 -0
  124. package/src/modules/library/__tests__/library-data.mapping.test.tsx +98 -0
  125. package/src/modules/library/__tests__/library-data.stale.test.tsx +183 -0
  126. package/src/modules/library/__tests__/library-data.test.ts +7 -0
  127. package/src/modules/library/__tests__/library-paths.test.ts +75 -0
  128. package/src/modules/library/__tests__/link-membership.test.ts +129 -0
  129. package/src/modules/library/__tests__/name-with-badges.test.tsx +273 -0
  130. package/src/modules/library/__tests__/newSkillMarkdown.test.ts +30 -0
  131. package/src/modules/library/__tests__/owner-pill.test.tsx +357 -0
  132. package/src/modules/library/__tests__/pending-tools.test.tsx +400 -0
  133. package/src/modules/library/__tests__/plugin-entries.test.ts +122 -0
  134. package/src/modules/library/__tests__/plugin-summary.test.ts +67 -0
  135. package/src/modules/library/__tests__/status.test.ts +82 -2
  136. package/src/modules/library/__tests__/tools.api.test.ts +44 -1
  137. package/src/modules/library/__tests__/useJoinRequests.test.tsx +46 -0
  138. package/src/modules/library/components/AccessRequestsBanner.tsx +85 -47
  139. package/src/modules/library/components/AddDialogTabs.tsx +103 -0
  140. package/src/modules/library/components/AddToPluginDialog.tsx +107 -18
  141. package/src/modules/library/components/IntegrationsSetupReminder.tsx +59 -0
  142. package/src/modules/library/components/ItemActionsMenu.tsx +288 -0
  143. package/src/modules/library/components/LibraryCard.tsx +149 -34
  144. package/src/modules/library/components/LibraryLayout.tsx +120 -247
  145. package/src/modules/library/components/LibraryPage.tsx +172 -39
  146. package/src/modules/library/components/LinkSkillPanel.tsx +169 -0
  147. package/src/modules/library/components/LockedPluginView.tsx +63 -35
  148. package/src/modules/library/components/NameWithBadges.tsx +164 -0
  149. package/src/modules/library/components/NewPluginDialog.tsx +19 -5
  150. package/src/modules/library/components/PageActions.tsx +31 -9
  151. package/src/modules/library/components/{PendingSkillReview.tsx → PendingItemReview.tsx} +14 -7
  152. package/src/modules/library/components/PersonalAddDialog.tsx +68 -18
  153. package/src/modules/library/components/PersonalPluginPage.tsx +123 -23
  154. package/src/modules/library/components/PluginExtras.tsx +143 -18
  155. package/src/modules/library/components/PluginIndexRow.tsx +47 -12
  156. package/src/modules/library/components/PluginPage.tsx +234 -38
  157. package/src/modules/library/components/PluginRows.tsx +286 -0
  158. package/src/modules/library/components/PluginsSidebar.tsx +271 -238
  159. package/src/modules/library/components/PluginsSidebarMenu.tsx +26 -1
  160. package/src/modules/library/components/RenamePluginDialog.tsx +136 -0
  161. package/src/modules/library/components/ShareButton.tsx +17 -0
  162. package/src/modules/library/components/SkillsTree.tsx +204 -0
  163. package/src/modules/library/components/StatusDot.tsx +1 -0
  164. package/src/modules/library/components/TeamRoute.tsx +15 -0
  165. package/src/modules/library/components/__tests__/upload-notices-once-per-page.test.tsx +144 -0
  166. package/src/modules/library/components/plugin-page-parts.tsx +132 -23
  167. package/src/modules/library/components/skill-page/SharedViaPlugins.tsx +212 -0
  168. package/src/modules/library/components/skill-page/SkillFilePane.tsx +5 -0
  169. package/src/modules/library/components/skill-page/SkillPage.tsx +337 -121
  170. package/src/modules/library/components/tool-page/DeleteToolDialog.tsx +218 -0
  171. package/src/modules/library/components/tool-page/ToolConnectionSection.tsx +79 -178
  172. package/src/modules/library/components/tool-page/ToolPage.tsx +116 -17
  173. package/src/modules/library/components/tool-page/ToolVarRow.tsx +42 -41
  174. package/src/modules/library/hooks/__tests__/useLibraryData.test.ts +98 -0
  175. package/src/modules/library/hooks/useJoinRequests.ts +48 -18
  176. package/src/modules/library/hooks/useLibraryData.ts +92 -19
  177. package/src/modules/library/routes/LibraryRoutes.tsx +14 -11
  178. package/src/modules/library/routes/WorkspaceItemRoute.tsx +229 -82
  179. package/src/modules/library/routes/library-paths.ts +46 -35
  180. package/src/modules/library/services/library.api.ts +89 -17
  181. package/src/modules/library/services/plugins.api.ts +161 -9
  182. package/src/modules/library/services/teams.api.ts +15 -0
  183. package/src/modules/library/services/tools.api.ts +78 -0
  184. package/src/modules/library/state/library-data.tsx +268 -37
  185. package/src/modules/library/utils/personal-plugin.ts +13 -15
  186. package/src/modules/library/utils/plugin-entries.ts +134 -0
  187. package/src/modules/library/utils/plugin-summary.ts +102 -0
  188. package/src/modules/library/utils/status.ts +204 -35
  189. package/src/modules/onboarding/__tests__/creator-welcome.test.tsx +11 -3
  190. package/src/modules/onboarding/__tests__/onboarding.test.tsx +853 -760
  191. package/src/modules/onboarding/agent-clients.ts +55 -23
  192. package/src/modules/onboarding/components/ConnectAgentPill.tsx +5 -1
  193. package/src/modules/onboarding/components/WelcomePage.tsx +98 -62
  194. package/src/modules/pr/services/pr-merge.api.ts +2 -1
  195. package/src/modules/review/components/MarkdownDiffViewer.tsx +53 -8
  196. package/src/modules/review/components/ReviewPanel.tsx +15 -17
  197. package/src/modules/review/components/__tests__/MarkdownDiffViewer.test.tsx +64 -0
  198. package/src/modules/review/components/__tests__/ReviewPanel.test.tsx +25 -1
  199. package/src/modules/secrets-vault/components/ConnectToolsPage.tsx +454 -117
  200. package/src/modules/secrets-vault/components/SecretsPage.tsx +48 -7
  201. package/src/modules/secrets-vault/components/ToolSecretsPanel.tsx +84 -5
  202. package/src/modules/secrets-vault/components/__tests__/ConnectToolsPage.test.tsx +425 -0
  203. package/src/modules/secrets-vault/components/__tests__/SecretsPage.test.tsx +417 -82
  204. package/src/modules/secrets-vault/components/__tests__/ToolSecretsPanel.test.tsx +105 -0
  205. package/src/modules/secrets-vault/components/__tests__/connect-lists-what-the-banner-counted.test.tsx +407 -0
  206. package/src/modules/secrets-vault/probe/SavedKeyProbeResult.tsx +98 -0
  207. package/src/modules/secrets-vault/probe/__tests__/probe-verdict.test.ts +160 -0
  208. package/src/modules/secrets-vault/probe/probe-verdict.ts +108 -0
  209. package/src/modules/secrets-vault/probe/useSavedKeyProbe.ts +228 -0
  210. package/src/modules/secrets-vault/services/connect.api.ts +36 -5
  211. package/src/modules/secrets-vault/utils/connect-status.ts +98 -0
  212. package/src/modules/settings/components/ClaudeConnectionCard.tsx +154 -0
  213. package/src/modules/settings/components/ClaudeConnectionFields.tsx +23 -0
  214. package/src/modules/settings/components/DeploymentPage.tsx +16 -22
  215. package/src/modules/settings/components/MarketplaceSection.tsx +152 -0
  216. package/src/modules/settings/components/__tests__/ClaudeConnectionCard.test.tsx +63 -0
  217. package/src/modules/settings/components/__tests__/DeploymentPage.test.tsx +74 -1
  218. package/src/modules/settings/components/__tests__/MarketplaceSection.test.tsx +325 -0
  219. package/src/modules/settings/components/__tests__/SettingsLayout.test.tsx +5 -5
  220. package/src/modules/settings/services/github-facade.api.ts +66 -0
  221. package/src/modules/settings/settings-nav-items.tsx +10 -2
  222. package/src/modules/setup/__tests__/setup.oidc.test.tsx +172 -0
  223. package/src/modules/setup/__tests__/setup.probe-refusal.test.tsx +123 -0
  224. package/src/modules/setup/__tests__/setup.test.tsx +615 -4
  225. package/src/modules/setup/__tests__/useSetupStatus.test.tsx +130 -0
  226. package/src/modules/setup/components/SetupGate.tsx +16 -16
  227. package/src/modules/setup/components/SetupScreen.tsx +711 -40
  228. package/src/modules/setup/hooks/useSetupStatus.ts +93 -0
  229. package/src/modules/setup/services/setup.api.ts +218 -3
  230. package/src/modules/setup/utils/__tests__/root-folders.test.ts +72 -0
  231. package/src/modules/setup/utils/root-folders.ts +46 -0
  232. package/src/modules/toolbar/assets/claude-setup/01-add-manually.webp +0 -0
  233. package/src/modules/toolbar/assets/claude-setup/02-add-configuration.webp +0 -0
  234. package/src/modules/toolbar/assets/claude-setup/03-connect-account.webp +0 -0
  235. package/src/modules/toolbar/assets/claude-setup/04-pick-instance.webp +0 -0
  236. package/src/modules/toolbar/assets/claude-setup/05-plugins-add.webp +0 -0
  237. package/src/modules/toolbar/assets/claude-setup/06-add-marketplace.webp +0 -0
  238. package/src/modules/toolbar/assets/claude-setup/07-paste-url-sync.webp +0 -0
  239. package/src/modules/toolbar/assets/claude-setup/08-install-plugins.webp +0 -0
  240. package/src/modules/toolbar/assets/claude-setup/09-select-repository.webp +0 -0
  241. package/src/modules/toolbar/assets/claude-setup/10-connector-not-added.webp +0 -0
  242. package/src/modules/toolbar/assets/claude-setup/11-add-custom-connector.webp +0 -0
  243. package/src/modules/toolbar/assets/claude-setup/README.md +68 -0
  244. package/src/modules/toolbar/components/AgentInstructionsCard.tsx +296 -0
  245. package/src/modules/toolbar/components/ClaudeMarketplaceCarousel.tsx +107 -0
  246. package/src/modules/toolbar/components/ClaudeRegistrationSteps.tsx +127 -0
  247. package/src/modules/toolbar/components/CoworkSetupSteps.tsx +100 -0
  248. package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +395 -124
  249. package/src/modules/toolbar/components/ScreenshotStep.tsx +77 -0
  250. package/src/modules/toolbar/components/SetupCarousel.tsx +177 -0
  251. package/src/modules/toolbar/components/__tests__/AgentInstructionsCard.test.tsx +370 -0
  252. package/src/modules/toolbar/components/__tests__/ExternalAgentAccessPage.test.tsx +659 -36
  253. package/src/modules/toolbar/components/__tests__/Toolbar.test.tsx +2 -2
  254. package/src/modules/toolbar/components/__tests__/claude-setup-shots.test.ts +104 -0
  255. package/src/modules/toolbar/components/claude-connector-slide.tsx +38 -0
  256. package/src/modules/toolbar/components/claude-setup-shots.ts +167 -0
  257. package/src/modules/toolbar/components/deployment-address.ts +29 -0
  258. package/src/modules/toolbar/components/setup-step-parts.tsx +35 -0
  259. package/src/modules/toolbar/services/__tests__/agent-instructions.api.test.ts +89 -0
  260. package/src/modules/toolbar/services/agent-instructions.api.ts +167 -0
  261. package/src/modules/toolbar/services/external-api-keys.api.ts +8 -0
  262. package/src/modules/workflow/state/ChangeRequestStaleBinder.tsx +43 -0
  263. package/src/modules/workflow/state/EventBusProvider.tsx +122 -11
  264. package/src/modules/workflow/state/__tests__/EventBusProvider.storage.test.tsx +87 -0
  265. package/src/modules/workflow/state/__tests__/EventBusProvider.watch.test.tsx +223 -0
  266. package/src/modules/workflow/state/event-bus.context.ts +10 -0
  267. package/src/modules/workspace/__tests__/testFixtures.ts +6 -3
  268. package/src/modules/workspace/components/FileExplorer.tsx +1527 -367
  269. package/src/modules/workspace/components/FileRoute.tsx +376 -22
  270. package/src/modules/workspace/components/FileViewer.tsx +166 -45
  271. package/src/modules/workspace/components/KbDocumentShell.tsx +50 -6
  272. package/src/modules/workspace/components/KbPageHeader.tsx +120 -55
  273. package/src/modules/workspace/components/TreeActionConfirm.tsx +350 -0
  274. package/src/modules/workspace/components/__tests__/FileExplorer.test.tsx +2473 -129
  275. package/src/modules/workspace/components/__tests__/FileRoute.test.tsx +768 -16
  276. package/src/modules/workspace/components/__tests__/FileViewer.test.tsx +332 -12
  277. package/src/modules/workspace/components/__tests__/KbDocumentShell.test.tsx +39 -0
  278. package/src/modules/workspace/components/__tests__/KbPageHeader.test.tsx +33 -20
  279. package/src/modules/workspace/components/renderers/DocxRenderer.tsx +4 -5
  280. package/src/modules/workspace/components/renderers/DownloadFileButton.tsx +13 -4
  281. package/src/modules/workspace/components/renderers/EmailRenderer.tsx +4 -3
  282. package/src/modules/workspace/components/renderers/HtmlRenderer.tsx +8 -14
  283. package/src/modules/workspace/components/renderers/ImageRenderer.tsx +75 -16
  284. package/src/modules/workspace/components/renderers/KbImage.tsx +180 -0
  285. package/src/modules/workspace/components/renderers/KbMarkdownView.tsx +22 -6
  286. package/src/modules/workspace/components/renderers/MarkdownRenderer.tsx +48 -22
  287. package/src/modules/workspace/components/renderers/PdfRenderer.tsx +4 -5
  288. package/src/modules/workspace/components/renderers/PptxRenderer.tsx +4 -3
  289. package/src/modules/workspace/components/renderers/XlsxRenderer.tsx +4 -3
  290. package/src/modules/workspace/components/renderers/__tests__/DocxRenderer.test.tsx +12 -0
  291. package/src/modules/workspace/components/renderers/__tests__/DownloadFileButton.test.tsx +57 -9
  292. package/src/modules/workspace/components/renderers/__tests__/EmailRenderer.test.tsx +13 -1
  293. package/src/modules/workspace/components/renderers/__tests__/ImageRenderer.test.tsx +163 -0
  294. package/src/modules/workspace/components/renderers/__tests__/KbMarkdownView.test.tsx +237 -0
  295. package/src/modules/workspace/components/renderers/__tests__/MarkdownRenderer.test.tsx +108 -14
  296. package/src/modules/workspace/components/renderers/__tests__/PptxRenderer.test.tsx +14 -1
  297. package/src/modules/workspace/components/renderers/__tests__/XlsxRenderer.test.tsx +16 -1
  298. package/src/modules/workspace/components/renderers/__tests__/rendererSelection.test.tsx +66 -1
  299. package/src/modules/workspace/components/renderers/index.ts +53 -2
  300. package/src/modules/workspace/components/renderers/kbMarkdownPipeline.tsx +25 -4
  301. package/src/modules/workspace/components/renderers/rendererWorkspace.ts +40 -0
  302. package/src/modules/workspace/hooks/__tests__/useImageRevision.test.tsx +174 -0
  303. package/src/modules/workspace/hooks/__tests__/useOpenChangeRequests.test.tsx +179 -1
  304. package/src/modules/workspace/hooks/__tests__/useWorkspaceImageResolver.test.tsx +122 -0
  305. package/src/modules/workspace/hooks/__tests__/useWorkspaceState.test.tsx +892 -7
  306. package/src/modules/workspace/hooks/useImageRevision.ts +101 -0
  307. package/src/modules/workspace/hooks/useMergedWorkspaceTree.ts +89 -0
  308. package/src/modules/workspace/hooks/useWorkspaceImageResolver.ts +55 -0
  309. package/src/modules/workspace/hooks/useWorkspaceState.ts +438 -66
  310. package/src/modules/workspace/routing/__tests__/kb-routes.test.tsx +279 -3
  311. package/src/modules/workspace/routing/kb-routes.ts +207 -30
  312. package/src/modules/workspace/services/__tests__/workspace.api.test.ts +57 -1
  313. package/src/modules/workspace/services/workspace.api.ts +57 -4
  314. package/src/modules/workspace/state/__tests__/applied-request-clears-pending.test.tsx +343 -0
  315. package/src/modules/workspace/state/__tests__/upload-lands-where-it-was-dropped.test.tsx +158 -0
  316. package/src/modules/workspace/state/open-change-requests.tsx +100 -12
  317. package/src/modules/workspace/state/workspace.context.ts +130 -16
  318. package/src/modules/workspace/utils/__tests__/file-trace.test.ts +73 -0
  319. package/src/modules/workspace/utils/__tests__/fileTree.test.ts +234 -5
  320. package/src/modules/workspace/utils/__tests__/pasteLink.test.ts +76 -0
  321. package/src/modules/workspace/utils/__tests__/treeConfirm.test.ts +364 -0
  322. package/src/modules/workspace/utils/__tests__/uploadError.test.ts +35 -0
  323. package/src/modules/workspace/utils/file-trace.ts +50 -0
  324. package/src/modules/workspace/utils/fileTree.ts +126 -52
  325. package/src/modules/workspace/utils/frontmatter.ts +8 -4
  326. package/src/modules/workspace/utils/pasteLink.ts +90 -0
  327. package/src/modules/workspace/utils/treeConfirm.ts +338 -0
  328. package/src/modules/workspace/utils/uploadError.ts +29 -0
  329. package/src/shared/__tests__/marketplace-url.test.ts +59 -0
  330. package/src/shared/components/Badge.tsx +3 -1
  331. package/src/shared/components/Banner.tsx +5 -1
  332. package/src/shared/components/Button.tsx +16 -2
  333. package/src/shared/components/Dialog.tsx +27 -11
  334. package/src/shared/components/Menu.tsx +13 -1
  335. package/src/shared/components/PageShell.tsx +13 -8
  336. package/src/shared/components/__tests__/primitives.test.tsx +116 -2
  337. package/src/shared/components/__tests__/useFocusHandoff.test.tsx +192 -0
  338. package/src/shared/components/index.ts +2 -0
  339. package/src/shared/components/useDismissableMenu.ts +32 -10
  340. package/src/shared/components/useFocusHandoff.ts +51 -0
  341. package/src/shared/components/useLatestRef.ts +28 -0
  342. package/src/shared/markdown/Markdown.tsx +12 -3
  343. package/src/shared/markdown/__tests__/escapeSpacesInLinkDestinations.test.ts +39 -0
  344. package/src/shared/markdown/hrefs.ts +50 -0
  345. package/src/shared/marketplace-url.ts +118 -0
  346. package/src/shared/mcp/ChatGptInstallLink.tsx +3 -3
  347. package/src/shared/mcp/ConnectionInstructions.tsx +38 -27
  348. package/src/shared/mcp/__tests__/connect-snippets.test.ts +3 -3
  349. package/src/shared/mcp/connect-snippets.ts +14 -9
  350. package/src/shared/mcp/index.ts +1 -1
  351. package/src/shared/theme/__tests__/header-band.test.ts +197 -0
  352. package/src/shared/theme/header.ts +75 -0
  353. package/src/shared/theme/measure.ts +7 -4
  354. package/src/shared/theme/tokens.css +34 -0
  355. package/src/modules/library/__tests__/PluginsIndexPage.test.tsx +0 -363
  356. package/src/modules/library/__tests__/PluginsSidebar.locked.test.tsx +0 -97
  357. package/src/modules/library/components/PluginsIndexPage.tsx +0 -265
  358. package/src/modules/update-check/__tests__/UpdateBanner.test.tsx +0 -126
  359. package/src/modules/update-check/components/UpdateBanner.tsx +0 -92
  360. package/src/modules/update-check/services/update-check.api.ts +0 -24
@@ -1,41 +1,62 @@
1
1
  import { useCallback, useEffect, useId, useMemo, useRef, useState, type ReactNode } from 'react';
2
2
  import { useLocation, useNavigate, useParams } from 'react-router-dom';
3
+ import { cn } from '../../../../lib/utils';
4
+ import { HEADER_BAND, HEADER_BAND_LEAD, PAGE_HEADER_TESTID } from '../../../../shared/theme/header';
3
5
  import { ArrowLeft, History } from 'lucide-react';
4
6
  import {
5
7
  DEFAULT_BRANCH,
6
- pluginOfPath,
8
+ type FileTreeEntry,
7
9
  type PullRequestSummary,
8
10
  } from '@bevel-software/platform-shared';
9
11
  import '../../library.css';
10
12
  import {
11
13
  Badge,
14
+ Banner,
12
15
  Button,
13
16
  IconButton,
14
- MenuItem,
15
- MenuPanel,
16
17
  Surface,
17
- useDismissableMenu,
18
+ useFocusHandoff,
18
19
  } from '../../../../shared/components';
19
20
  import { useAuth } from '../../../auth/state/auth.context';
20
21
  import { useWorkspace } from '../../../workspace/state/workspace.context';
21
22
  import { useGit } from '../../../git/state/git.context';
22
23
  import { FileHistoryPanel } from '../../../git/components/FileHistoryPanel';
23
- import { kbFileUrl, resolveRelativePath, useNodeIdNav } from '../../../workspace/routing/kb-routes';
24
+ import {
25
+ kbFileUrl,
26
+ openExternalHref,
27
+ resolveKbHref,
28
+ useNodeIdNav,
29
+ } from '../../../workspace/routing/kb-routes';
30
+ import { useWorkspaceImageResolver } from '../../../workspace/hooks/useWorkspaceImageResolver';
24
31
  import { cancelPullRequest } from '../../../pr/services/pr-cancel.api';
25
32
  import { useFileAccess } from '../../../access/hooks/useFileAccess';
26
33
  import { proposeChange, suggestionBranchFor } from '../../services/library.api';
27
- import { getOrCreateWorkspace, writeFile } from '../../../workspace/services/workspace.api';
34
+ import {
35
+ getOrCreateWorkspace,
36
+ writeFile,
37
+ type SkillToolWarning,
38
+ } from '../../../workspace/services/workspace.api';
28
39
  import { useSkillDetail } from '../../hooks/useSkillDetail';
29
- import { useApplyChangeRequest } from '../../../change-requests/hooks/useApplyChangeRequest';
40
+ import {
41
+ refusalLine,
42
+ useApplyChangeRequest,
43
+ } from '../../../change-requests/hooks/useApplyChangeRequest';
30
44
  import { useCrFileDiffs } from '../../../change-requests/hooks/useCrFileDiffs';
31
45
  import { useDefaultBranchFile, useFileOnBranch } from '../../../change-requests/hooks/useFileOnBranch';
32
46
  import { useLibrary } from '../../state/library-data';
33
47
  import { useLibraryToast } from '../../state/toast.context';
34
48
  import { libraryHomeForItemPath, urlForSkillFile } from '../../routes/library-paths';
35
49
  import { changeAuthorName, formatWhen } from '../../../change-requests/utils/author';
36
- import { ownersTextOf } from '../../utils/plugin-summary';
50
+ import { ownersTextOf, pluginLabel } from '../../utils/plugin-summary';
37
51
  import { neededToolsFor, toolStatus } from '../../utils/status';
38
52
  import { StatusDot } from '../StatusDot';
53
+ import { SharedViaPlugins } from './SharedViaPlugins';
54
+ import { AccessRequestsBanner } from '../AccessRequestsBanner';
55
+ import { useJoinRequests, type JoinRequestsApi } from '../../hooks/useJoinRequests';
56
+ import { listSkillAccessRequests, reconcileSkillAccessRequest } from '../../services/library.api';
57
+ import { ManageAccessDialog } from '../../../access/components/ManageAccessDialog';
58
+ import { offersManageAccess } from '../../../access/manage-access-affordance';
59
+ import { ShareButton } from '../ShareButton';
39
60
  import { ChangeRequestDock } from '../ChangeRequestDock';
40
61
  import { ChangeRequestDialog } from '../../../change-requests/components/ChangeRequestDialog';
41
62
  import { SkillFileTabs } from './SkillFileTabs';
@@ -103,7 +124,7 @@ export function SkillPage({
103
124
  const selected = activeFile ?? selectedState;
104
125
  const [compareCr, setCompareCr] = useState<PullRequestSummary | null>(null);
105
126
  /**
106
- * The `⋯` menu's one destination: the git log for the file on screen,
127
+ * The clock-arrow's destination: the git log for the file on screen,
107
128
  * rendered in place of the reading pane. Local state rather than a URL,
108
129
  * matching the Knowledge viewer's `activeTab` — a skill's canonical address
109
130
  * names the FILE, and history is a lens on it, not a different file.
@@ -112,41 +133,74 @@ export function SkillPage({
112
133
  * matter of taste.
113
134
  */
114
135
  const [historyOpen, setHistoryOpen] = useState(false);
115
- const [menuOpen, setMenuOpen] = useState(false);
116
- const menuTriggerRef = useRef<HTMLButtonElement>(null);
117
- const closeMenu = useCallback(() => setMenuOpen(false), []);
118
- const menuRef = useDismissableMenu<HTMLDivElement>({
119
- open: menuOpen,
120
- onClose: closeMenu,
121
- returnFocusTo: menuTriggerRef,
122
- });
123
136
  /** Ties the tabs to the panel they control; unique per mounted page. */
124
137
  const tabsId = useId();
125
138
  const git = useGit();
126
139
 
127
- // Ownership is a property of the CATALOG entry, not of the skill document —
128
- // it comes from the per-file ACL the provider already resolved, so the page
129
- // reads it rather than asking again.
130
- const owned = useMemo(
131
- () => data.items.some((i) => i.kind === 'skill' && i.id === name && i.owned),
140
+ // Ownership and write are properties of the CATALOG entry, not of the skill
141
+ // document — the provider already resolved both, so the page reads them
142
+ // rather than asking again. `owned` is the pill alone; every editor-side
143
+ // affordance goes by `canWrite`, which a writer holds without owning.
144
+ const entry = useMemo(
145
+ () => data.items.find((i) => i.kind === 'skill' && i.id === name),
132
146
  [data.items, name],
133
147
  );
148
+ const owned = entry?.owned === true;
149
+ const canWrite = entry?.canWrite === true;
134
150
 
135
151
  const skill = detail.skill;
136
152
  const skillPath = skill?.path ?? '';
137
153
  const prefix = `${skillPath}/`;
138
154
 
155
+ /** Every plugin holding this skill, from the catalog's decoration. */
156
+ const memberships = useMemo(
157
+ () => data.items.find((i) => i.kind === 'skill' && i.id === name)?.plugins ?? [],
158
+ [data.items, name],
159
+ );
160
+ /**
161
+ * Write-access requests on this skill, for its editors. The endpoint answers
162
+ * `[]` to everyone else, so the fetch is unconditional and the banner hides
163
+ * itself; `owned` only spares a pointless call.
164
+ */
165
+ const skillRequestsApi = useMemo<JoinRequestsApi>(
166
+ () => ({ list: listSkillAccessRequests, reconcile: reconcileSkillAccessRequest }),
167
+ [],
168
+ );
169
+ const accessRequests = useJoinRequests(name, skillPath || null, skillRequestsApi);
170
+ /**
171
+ * The skill FOLDER as the access dialog addresses it — the same entry the
172
+ * explorer's right-click hands over for a folder. Null until both the KB dir
173
+ * and the skill have resolved: a half-built path would manage the wrong
174
+ * folder, or the KB root.
175
+ */
176
+ const skillFolderEntry = useMemo<FileTreeEntry | null>(
177
+ () =>
178
+ kbDirName && skillPath
179
+ ? { name, relativePath: `${kbDirName}/${skillPath}`, type: 'directory' }
180
+ : null,
181
+ [kbDirName, skillPath, name],
182
+ );
183
+ /**
184
+ * What the ONE access dialog is open on. Share and the access-requests
185
+ * banner both set it to the skill folder; the dialog's own "Manage <Folder>"
186
+ * link retargets it at an ancestor (the plugin), as it does in the explorer.
187
+ */
188
+ const [manageTarget, setManageTarget] = useState<FileTreeEntry | null>(null);
189
+
139
190
  /**
140
191
  * Who has to say yes. A skill has no owner of its own — it inherits its plugin
141
192
  * folder's `access.md` — so the people who review a change to it are the
142
193
  * plugin's owners. Naming the wrong reviewer is worse than naming none, hence
143
194
  * the neutral fallback when the plugin index hasn't resolved.
144
195
  */
196
+ const itemPlugin = useMemo(
197
+ () => data.items.find((i) => i.kind === 'skill' && i.id === name)?.plugin ?? null,
198
+ [data.items, name],
199
+ );
145
200
  const ownerName = useMemo(() => {
146
- const plugin = skill ? pluginOfPath(skill.path) : null;
147
- const summary = plugin ? data.pluginSummaries.find((g) => g.name === plugin) : undefined;
201
+ const summary = itemPlugin ? data.pluginSummaries.find((g) => g.name === itemPlugin) : undefined;
148
202
  return summary ? ownersTextOf(summary) : 'the owner';
149
- }, [skill, data.pluginSummaries]);
203
+ }, [itemPlugin, data.pluginSummaries]);
150
204
 
151
205
  const files = useMemo(
152
206
  () => ['SKILL.md', ...(skill?.files ?? []).map((f) => f.slice(prefix.length))],
@@ -240,7 +294,28 @@ export function SkillPage({
240
294
  Boolean((location.state as { startEditing?: boolean } | null)?.startEditing),
241
295
  );
242
296
  const [busyCr, setBusyCr] = useState<number | null>(null);
297
+ /**
298
+ * What the last save on this page said about the skill's `allowed-tools`
299
+ * (entries that look like platform tools but name none the saver can see),
300
+ * or `null` while nothing has been saved here — then the banner speaks from
301
+ * the loaded skill's own `warnings`, so a skill left pointing at a manual
302
+ * that was since retired says so on open. Advisory either way: a save has
303
+ * already landed. A save's answer wins over the load's because a proposal's
304
+ * content lives on another branch than the skill on screen; an approval
305
+ * rewrites the skill underneath (see `onApplied`) and hands the word back to
306
+ * the reload. Per-page state, and the route mounts this component with
307
+ * `key={name}`, so moving to another skill starts from that skill's own.
308
+ */
309
+ const [savedWarnings, setSavedWarnings] = useState<SkillToolWarning[] | null>(null);
310
+ const toolWarnings = savedWarnings ?? skill?.warnings ?? [];
243
311
 
312
+ /**
313
+ * The file on screen as a workspace path, `<kbDirName>/<skill>/<file>`: the
314
+ * base every relative link and image in it resolves against, and the path
315
+ * the history panel reads. Null until the workspace and the skill have both
316
+ * resolved.
317
+ */
318
+ const fileWorkspacePath = kbDirName && skillPath ? `${kbDirName}/${fileRepoPath}` : null;
244
319
  /**
245
320
  * The workspace-relative path `FileHistoryPanel` reads the git log for — the
246
321
  * same string the Knowledge viewer hands it, so a skill file's history is
@@ -249,7 +324,7 @@ export function SkillPage({
249
324
  * asks immediately, so handing it a half-built one would ask about
250
325
  * `undefined/SKILL.md`.
251
326
  */
252
- const historyPath = kbDirName && skillPath ? `${kbDirName}/${fileRepoPath}` : null;
327
+ const historyPath = fileWorkspacePath;
253
328
  /**
254
329
  * Whether `⋯` has anything behind it. Git not ready means there is no log to
255
330
  * show, and an overflow that opens onto an empty panel is worse than no
@@ -284,20 +359,42 @@ export function SkillPage({
284
359
  // log back over the file minutes after the reader returned to reading. Once
285
360
  // it is gone they ask for it again, which is one click.
286
361
  //
287
- // BOTH flags, for one reason: the trigger and its panel live behind
288
- // `historyAvailable` together, so an open menu unmounts with them and its
289
- // flag is left set behind an element nobody can see. Closing only the log
290
- // fixed the panel and left the menu to spring open by itself on the next
291
- // good poll.
292
- //
293
- // `editing` is the second door into the same state, and it is reachable
294
- // without a mouse: `useDismissableMenu` dismisses on outside POINTERDOWN, so
295
- // tabbing from the open menu to Edit and pressing Enter never dismisses it.
296
- // The editor then withdraws `historyAvailable`, and Cancel used to hand the
297
- // menu back open.
362
+ // `editing` is the second door into the same state: the editor withdraws
363
+ // `historyAvailable` (its draft would be discarded under the panel), and
364
+ // Cancel must not hand the log back open over the file.
298
365
  if (historyOpen && !historyAvailable) setHistoryOpen(false);
299
- if (menuOpen && !historyAvailable) setMenuOpen(false);
300
366
  const viewingHistory = historyAvailable && historyOpen;
367
+ /**
368
+ * The clock that opens the log sits in the file bar, and the bar unmounts
369
+ * with the file; the pressed clock that closes it sits in the history row,
370
+ * which unmounts with the log. Either way the control a keyboard user just
371
+ * activated is gone from the DOM, so the two clocks hand focus to each
372
+ * other (`useFocusHandoff`): opening lands on the pressed clock, closing
373
+ * lands on the bar's. Only for a swap the USER made; the log closing
374
+ * because git stopped answering names no target and moves nothing.
375
+ *
376
+ * The bar's clock is not guaranteed to come back: `historyAvailable`
377
+ * withdraws it, and a failed status poll can land in the same commit as the
378
+ * click. The page's own title is named last for that, since it is on screen
379
+ * in every state and names the skill the user came back to.
380
+ *
381
+ * Knowledge states the same rule with its document title, where the case is
382
+ * routine rather than a race: a comparison outlives `historyAvailable` on
383
+ * purpose, so leaving one while git is silent finds no clock at all. See
384
+ * `FileViewer.backToDocument` and the test beside it.
385
+ */
386
+ const paneClockRef = useRef<HTMLButtonElement>(null);
387
+ const pressedClockRef = useRef<HTMLButtonElement>(null);
388
+ const titleRef = useRef<HTMLHeadingElement>(null);
389
+ const handoff = useFocusHandoff(viewingHistory);
390
+ const openHistory = () => {
391
+ handoff(true, pressedClockRef);
392
+ setHistoryOpen(true);
393
+ };
394
+ const closeHistory = () => {
395
+ handoff(false, paneClockRef, titleRef);
396
+ setHistoryOpen(false);
397
+ };
301
398
  /**
302
399
  * Change requests a merge attempt has REFUSED as unmergeable. Git is the only
303
400
  * thing that can answer "does this still apply?", and it answers when asked
@@ -317,6 +414,10 @@ export function SkillPage({
317
414
  onApplied() {
318
415
  toast('Approved: the skill now reads with that change.');
319
416
  setRevision((r) => r + 1);
417
+ // The merge just rewrote the skill, `allowed-tools` included, so the
418
+ // advisory from this page's last save is about text that is no longer
419
+ // there. The reload below answers for the merged skill instead.
420
+ setSavedWarnings(null);
320
421
  data.reload();
321
422
  // The pane renders `skill.body`, which this hook holds and the merge just
322
423
  // changed. Without re-reading it the page keeps showing the pre-merge
@@ -355,7 +456,7 @@ export function SkillPage({
355
456
  const raw = active === 'SKILL.md' ? rawOnMain : detail.fileContent(active);
356
457
 
357
458
  /** Every open change request's version of the file on screen. */
358
- const crDiffs = useCrFileDiffs(skillCrs, fileRepoPath, rawOnMain, revision);
459
+ const crDiffs = useCrFileDiffs(skillCrs, fileRepoPath, revision);
359
460
 
360
461
  /** The change requests with something to say about THIS file. */
361
462
  const boxes = useMemo(
@@ -387,11 +488,39 @@ export function SkillPage({
387
488
  // reads it. Only the propose flow stacks on the caller's own branch copy.
388
489
  const editorBase = !canEditDirectly && ownCr ? ownBranchBase : rawOnMain;
389
490
 
390
- const openInEditor = useCallback(
391
- (wsRelative: string) => navigate(kbFileUrl(DEFAULT_BRANCH, wsRelative)),
392
- [navigate],
491
+ /**
492
+ * Follow a link out of the rendered file. The same grammar as the Knowledge
493
+ * view (`resolveKbHref`): the destination is decoded, so a link to
494
+ * `Some File.md` opens `Some File.md` and not `Some%20File.md`; an absolute
495
+ * app URL keeps its own branch; anything else opens on the default branch,
496
+ * where skills live.
497
+ */
498
+ const openLinkInEditor = useCallback(
499
+ (href: string) => {
500
+ if (!fileWorkspacePath) return;
501
+ const target = resolveKbHref(href, { basePath: fileWorkspacePath, kbDirName });
502
+ // Same rule as `openLink`: the anchor's default was cancelled to get
503
+ // here, so an external destination has nobody left to open it.
504
+ if (target?.kind === 'external') {
505
+ openExternalHref(href);
506
+ return;
507
+ }
508
+ if (target?.kind !== 'workspace') return;
509
+ navigate(kbFileUrl(target.branch ?? DEFAULT_BRANCH, target.path) + target.hash);
510
+ },
511
+ [fileWorkspacePath, kbDirName, navigate],
393
512
  );
394
513
 
514
+ /**
515
+ * Images in the file, served from the DEFAULT branch's workspace: that is
516
+ * the tree this pane renders (`rawOnMain`), and where `headingLink` and the
517
+ * link handler above point. The checked-out branch may be somebody's draft
518
+ * with another copy of the picture, or none. The revision keeps an open page
519
+ * current when a teammate replaces a screenshot under the same name.
520
+ */
521
+ const skillWorkspaceId = encodeURIComponent(DEFAULT_BRANCH);
522
+ const resolveImage = useWorkspaceImageResolver(skillWorkspaceId, fileWorkspacePath);
523
+
395
524
  /**
396
525
  * A heading's citation deep-link — the file's KNOWLEDGE URL plus `#slug`,
397
526
  * because that is the surface that scrolls to a heading fragment. Same
@@ -415,7 +544,10 @@ export function SkillPage({
415
544
  */
416
545
  async function saveDirect(content: string) {
417
546
  const { workspace } = await getOrCreateWorkspace(DEFAULT_BRANCH);
418
- await writeFile(workspace.id, `${workspace.kbDirName}/${fileRepoPath}`, content);
547
+ const saved = await writeFile(workspace.id, `${workspace.kbDirName}/${fileRepoPath}`, content);
548
+ // Only a SKILL.md save has a say: a bundled file's answer carries no
549
+ // warnings, and taking it as "none" would hide the loaded skill's.
550
+ if (active === 'SKILL.md') setSavedWarnings(saved?.warnings ?? []);
419
551
  setEditing(false);
420
552
  setRevision((r) => r + 1);
421
553
  toast('Saved: the skill now reads with your change.');
@@ -424,7 +556,7 @@ export function SkillPage({
424
556
 
425
557
  async function submitProposal(content: string) {
426
558
  if (!user) throw new Error('Sign in to propose a change.');
427
- await proposeChange({
559
+ const proposed = await proposeChange({
428
560
  skillName: name,
429
561
  repoRelativePath: fileRepoPath,
430
562
  content,
@@ -432,6 +564,7 @@ export function SkillPage({
432
564
  userName: user.name,
433
565
  existingCr: ownCr,
434
566
  });
567
+ if (active === 'SKILL.md') setSavedWarnings(proposed?.warnings ?? []);
435
568
  setEditing(false);
436
569
  setRevision((r) => r + 1);
437
570
  toast(`Sent to ${ownerName}: nothing changes until they approve it.`);
@@ -467,7 +600,7 @@ export function SkillPage({
467
600
  // The page the skill lives on, not the Library root: "back" from a skill
468
601
  // you opened off its plugin page must land on that plugin page. Derived from
469
602
  // the path, so a deep link gets the same honest destination as a click.
470
- const home = libraryHomeForItemPath(skillPath);
603
+ const home = libraryHomeForItemPath(skillPath, itemPlugin, (n) => pluginLabel(n, data.pluginSummaries));
471
604
  const backLink = (
472
605
  <Button variant="quiet" size="sm" onClick={() => navigate(home.path)}>
473
606
  {`‹ ${home.label}`}
@@ -524,60 +657,44 @@ export function SkillPage({
524
657
  // second layout when the detail request settles.
525
658
  return (
526
659
  <Article>
527
- {backLink}
528
-
529
- <header className="mt-4">
530
- <div className="flex items-center gap-3">
531
- <h1 className="min-w-0 text-display font-semibold text-ink">{skill?.name ?? name}</h1>
660
+ <header>
661
+ {/* The shared header band — one height for this title bar and the
662
+ sidebar's header row beside it, so a skill page opens on the same
663
+ line a file page and the Library's own pages do. The way back
664
+ rides ON the band, as its leading item: a back link in a row above
665
+ would push this row down off that line, which is the whole seam.
666
+ (The error and not-found returns above still lead with it on its
667
+ own row — they have no title bar to hold a line with.) */}
668
+ <div data-testid={PAGE_HEADER_TESTID} className={cn(HEADER_BAND, 'gap-3')}>
669
+ <div className={HEADER_BAND_LEAD}>{backLink}</div>
670
+ {/* `tabIndex={-1}` keeps the heading out of the tab order while
671
+ letting `.focus()` land on it — where focus goes when closing
672
+ the log finds no clock to hand back to. No focus ring: it is a
673
+ programmatic landing after the user's own click. */}
674
+ <h1
675
+ ref={titleRef}
676
+ tabIndex={-1}
677
+ // `title` because `truncate` hides the rest of a long skill name,
678
+ // and a heading you cannot finish reading needs somewhere to say it.
679
+ title={skill?.name ?? name}
680
+ className="min-w-0 truncate text-display font-semibold text-ink focus:outline-none"
681
+ >
682
+ {skill?.name ?? name}
683
+ </h1>
532
684
  {skill && owned && (
533
685
  <Badge tone="outline" size="xs" className="shrink-0 uppercase">
534
686
  Owner
535
687
  </Badge>
536
688
  )}
537
-
538
- {/* The same overflow a Knowledge page carries, for the same reason:
539
- a skill is a file in the repository, and "who changed this, when"
540
- is answerable about it exactly as it is about any other file. It
541
- was unanswerable HERE and nowhere else, because this page is the
542
- only surface a `Plugins/` file has — the shell routes those URLs
543
- to the Library (`isLibraryLocation`) and the Knowledge tree does
544
- not list `Plugins/` at all, so there was no viewer to fall back
545
- to and no row to right-click.
546
-
547
- Version history is the whole menu, so the trigger goes where the
548
- menu goes — see `historyAvailable`. */}
549
- {historyAvailable && (
550
- <div className="relative ml-auto flex-none">
551
- <IconButton
552
- ref={menuTriggerRef}
553
- aria-label="More actions"
554
- aria-haspopup="menu"
555
- aria-expanded={menuOpen}
556
- active={menuOpen}
557
- onClick={() => setMenuOpen((v) => !v)}
558
- >
559
- <span aria-hidden className="text-strong leading-none">
560
- ⋯
561
- </span>
562
- </IconButton>
563
- {menuOpen && (
564
- <div ref={menuRef} className="absolute right-0 top-[calc(100%+5px)] z-40">
565
- <MenuPanel role="menu" aria-label="More actions" className="min-w-[212px]">
566
- <MenuItem
567
- role="menuitem"
568
- onClick={() => {
569
- closeMenu();
570
- setHistoryOpen(true);
571
- }}
572
- >
573
- <span className="flex items-center gap-2.5">
574
- <History size={14} />
575
- Version history
576
- </span>
577
- </MenuItem>
578
- </MenuPanel>
579
- </div>
580
- )}
689
+ {/* Share IS the manage-access dialog, on the skill's own folder —
690
+ standalone or inside a plugin. A rule written here sits beside
691
+ the plugin's, and the resolver reads both at their depths. Shown
692
+ wherever the explorer would offer `Manage access` on the same
693
+ folder; for someone who cannot change the rules the dialog
694
+ renders read-only, and the grant route refuses regardless. */}
695
+ {skillFolderEntry && offersManageAccess(skillFolderEntry) && (
696
+ <div className="ml-auto flex flex-none items-center gap-1.5">
697
+ <ShareButton onClick={() => setManageTarget(skillFolderEntry)} />
581
698
  </div>
582
699
  )}
583
700
  </div>
@@ -585,13 +702,56 @@ export function SkillPage({
585
702
  and its frontmatter panel already says what the skill is for.
586
703
  Repeating it above the pane said the same sentence twice on the
587
704
  first screenful. */}
588
- {/* No `Manage access` here, deliberately — a skill inherits its plugin
589
- folder's `access.md`, and the plugin's Share panel is the one place
590
- those rules are decided. Same call the tool page made. */}
591
705
  </header>
592
706
 
707
+ <ToolWarningsBanner warnings={toolWarnings} />
708
+
709
+ {/* Not before the folder is known: Accept grants ON the folder and
710
+ Manage access opens it, and both are no-ops against ''. */}
711
+ {canWrite && skillFolderEntry && (
712
+ <AccessRequestsBanner
713
+ plugin={name}
714
+ folders={[skillPath]}
715
+ requests={accessRequests.requests}
716
+ onManage={() => setManageTarget(skillFolderEntry)}
717
+ onAccept={(r, p) => void accessRequests.accept(r, p)}
718
+ onDecline={(r) => void accessRequests.decline(r)}
719
+ />
720
+ )}
721
+ {manageTarget && (
722
+ <ManageAccessDialog
723
+ // Keyed on the path, so retargeting at an ancestor remounts it
724
+ // against that folder — the explorer's arrangement exactly.
725
+ key={manageTarget.relativePath}
726
+ // The Library speaks the DEFAULT branch: a skill's rules are edited
727
+ // where the catalog reads them, whatever branch the ambient
728
+ // workspace happens to be on.
729
+ workspaceId={encodeURIComponent(DEFAULT_BRANCH)}
730
+ entry={manageTarget}
731
+ onManageAncestor={setManageTarget}
732
+ onClose={() => {
733
+ setManageTarget(null);
734
+ accessRequests.reload();
735
+ data.reload();
736
+ }}
737
+ />
738
+ )}
739
+
593
740
  <IntegrationsSection needed={needed} onConnect={() => navigate('/connect')} />
594
741
 
742
+ {skill && (
743
+ <SharedViaPlugins
744
+ skillName={name}
745
+ skillPath={skillPath}
746
+ memberships={memberships}
747
+ canWrite={canWrite}
748
+ onChanged={() => {
749
+ data.reload();
750
+ data.reloadPlugins();
751
+ }}
752
+ />
753
+ )}
754
+
595
755
  <SkillFileTabs
596
756
  files={files}
597
757
  selected={active}
@@ -623,17 +783,33 @@ export function SkillPage({
623
783
  {viewingHistory && historyPath !== null ? (
624
784
  <>
625
785
  {/* An explicit way back. Without it the only route to the file would
626
- be reopening it, since history is not in the URL. */}
786
+ be reopening it, since history is not in the URL. The clock that
787
+ opened the log sits in the file bar, and the bar leaves with the
788
+ file, so the same clock is drawn here PRESSED: the control that
789
+ opened the view stays on screen showing that it is open, and a
790
+ second click on it is the other way back. Same shape as the
791
+ Knowledge header while its log is open. */}
627
792
  <div className="mb-3 mt-4 flex items-center gap-2">
628
793
  <Button
629
794
  variant="quiet"
630
795
  size="sm"
631
796
  leadingIcon={<ArrowLeft size={13} />}
632
- onClick={() => setHistoryOpen(false)}
797
+ onClick={closeHistory}
633
798
  >
634
799
  Back to the file
635
800
  </Button>
636
801
  <span className="text-detail text-ink-faint">{`Version history: ${active}`}</span>
802
+ <IconButton
803
+ ref={pressedClockRef}
804
+ aria-label="Version history"
805
+ aria-pressed
806
+ title="Back to the file"
807
+ active
808
+ className="ml-auto"
809
+ onClick={closeHistory}
810
+ >
811
+ <History size={14} />
812
+ </IconButton>
637
813
  </div>
638
814
  {/* A DEFINITE height, and a flex column to hold it. The panel is
639
815
  built for the Knowledge viewer's full-height pane: its list and
@@ -671,12 +847,12 @@ export function SkillPage({
671
847
  file={active}
672
848
  raw={raw}
673
849
  suggestion={null}
674
- onOpenLink={(href) => {
675
- if (!kbDirName) return;
676
- openInEditor(resolveRelativePath(`${kbDirName}/${skillPath}/${active}`, href));
677
- }}
850
+ onOpenLink={openLinkInEditor}
678
851
  onOpenNodeId={openNodeId}
679
852
  headingLink={headingLink}
853
+ // No workspace yet means no base to resolve against: images render
854
+ // as plain tags, exactly as before the resolver existed.
855
+ resolveImage={fileWorkspacePath ? resolveImage : undefined}
680
856
  /*
681
857
  * ONE action, decided by the ACL. An `Edit` used to sit beside
682
858
  * `Propose changes` for EVERYONE and jump to the Knowledge editor —
@@ -699,11 +875,32 @@ export function SkillPage({
699
875
  * fork, never a silent restart from the published text.
700
876
  */
701
877
  actions={
702
- // Only a RESOLVED verdict earns a button: `null` (lookup in
703
- // flight) briefly shows no action rather than an Edit that might
704
- // open the wrong mode — a writer's text must never ride the
705
- // proposal path just because they clicked before the ACL answered.
706
- fileAccess.canWrite === true
878
+ <>
879
+ {/* "Who changed this, when" — the clock-arrow beside Edit, where
880
+ Google Docs keeps it. This page is the only surface a
881
+ `Plugins/` file has: the shell routes those URLs here
882
+ (`isLibraryLocation`) and the Knowledge tree does not list
883
+ `Plugins/`, so this button is the deployment's one way into a
884
+ skill's git log. It used to be the lone item behind a ⋯ in
885
+ the page header — two clicks and a menu for a question people
886
+ ask often. Withdrawn with `historyAvailable`: git not
887
+ answering, or no path to ask about. */}
888
+ {historyAvailable && (
889
+ <IconButton
890
+ ref={paneClockRef}
891
+ aria-label="Version history"
892
+ title="Version history"
893
+ onClick={openHistory}
894
+ >
895
+ <History size={14} />
896
+ </IconButton>
897
+ )}
898
+ {/* Only a RESOLVED verdict earns a write button: `null` (lookup
899
+ in flight) briefly shows none rather than an Edit that might
900
+ open the wrong mode — a writer's text must never ride the
901
+ proposal path just because they clicked before the ACL
902
+ answered. */}
903
+ {fileAccess.canWrite === true
707
904
  ? rawOnMain !== null && (
708
905
  <Button
709
906
  variant="outline"
@@ -727,7 +924,8 @@ export function SkillPage({
727
924
  >
728
925
  Propose changes
729
926
  </Button>
730
- )
927
+ )}
928
+ </>
731
929
  }
732
930
  />
733
931
  )}
@@ -744,7 +942,8 @@ export function SkillPage({
744
942
  // `[]` is the hook's "overtaken" answer — the proposal and the file
745
943
  // now say the same thing — and is distinct from `null`, which only
746
944
  // means a side has not arrived yet.
747
- const fileDiff = crDiffs.get(cr.number) ?? null;
945
+ const read = crDiffs.get(cr.number) ?? null;
946
+ const fileDiff = read === 'unreadable' ? null : read;
748
947
  return (
749
948
  <ChangeBox
750
949
  key={cr.number}
@@ -752,26 +951,21 @@ export function SkillPage({
752
951
  author={changeAuthorName(cr)}
753
952
  when={formatWhen(cr.createdAt)}
754
953
  mine={mine}
755
- canDecide={owned && !mine}
954
+ canDecide={canWrite && !mine}
756
955
  diff={fileDiff}
757
956
  binary={isBinaryFile(active)}
957
+ unreadable={read === 'unreadable'}
758
958
  upToDate={fileDiff !== null && fileDiff.length === 0}
759
959
  blocked={blockedCrs.has(cr.number)}
760
960
  conflictPrompt={conflictResolutionPrompt(cr)}
761
- // A conflict already speaks through `blocked`; repeating it as a
762
- // refusal line would say the same thing twice in one box.
763
- refusal={
764
- applying.refusals.get(cr.number)?.conflicts === false
765
- ? (applying.refusals.get(cr.number)?.reason ?? null)
766
- : null
767
- }
961
+ refusal={refusalLine(cr, applying.refusals)}
768
962
  owner={ownerName}
769
963
  busy={busyCr === cr.number || applying.activeCr === cr.number}
770
964
  phase={applying.activeCr === cr.number ? applying.phase : 'idle'}
771
965
  onApprove={() => applying.apply(cr)}
772
966
  onDecline={() => void decline(cr)}
773
967
  onWithdraw={() => void withdraw(cr)}
774
- onOpenFull={owned ? () => setCompareCr(cr) : undefined}
968
+ onOpenFull={canWrite ? () => setCompareCr(cr) : undefined}
775
969
  />
776
970
  );
777
971
  })}
@@ -780,8 +974,10 @@ export function SkillPage({
780
974
  {/* Outside the panel: the dock lists change requests touching ANY file of
781
975
  the skill, so it is not about the selected tab. The boxes above only
782
976
  cover the file on screen, and without this a proposal to a file you
783
- are not looking at has no way to reach you. */}
784
- {skill && owned && <ChangeRequestDock crs={skillCrs} onSelect={setCompareCr} />}
977
+ are not looking at has no way to reach you. Gated by write, not
978
+ ownership, like Approve itself: the server takes an approval from
979
+ anyone who can write the file, so a writer reviews the whole change. */}
980
+ {skill && canWrite && <ChangeRequestDock crs={skillCrs} onSelect={setCompareCr} />}
785
981
  </Article>
786
982
  );
787
983
  }
@@ -856,6 +1052,26 @@ function IntegrationsSection({
856
1052
  );
857
1053
  }
858
1054
 
1055
+ /**
1056
+ * The skill page's status line for `allowed-tools` entries the platform could
1057
+ * not resolve. A warning, never a block: the list also names the client's own
1058
+ * tools, which the server cannot know, so it only speaks about names that look
1059
+ * like its own.
1060
+ */
1061
+ function ToolWarningsBanner({ warnings }: { warnings: SkillToolWarning[] }) {
1062
+ if (warnings.length === 0) return null;
1063
+ return (
1064
+ <Banner tone="wait" role="status" className="mt-4">
1065
+ <p className="font-semibold">Some tools this skill lists are not available</p>
1066
+ <ul className="mt-1 list-disc pl-5">
1067
+ {warnings.map((w) => (
1068
+ <li key={w.entry}>{w.message}</li>
1069
+ ))}
1070
+ </ul>
1071
+ </Banner>
1072
+ );
1073
+ }
1074
+
859
1075
  /** A malformed escape is a bad link, not a crash — fall back to the raw segment. */
860
1076
  function safeDecode(raw: string): string {
861
1077
  try {