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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (346) hide show
  1. package/THIRD-PARTY-NOTICES.md +2 -2
  2. package/package.json +3 -3
  3. package/src/core/CoreAppShell.tsx +16 -9
  4. package/src/core/__tests__/AppChrome.test.tsx +0 -3
  5. package/src/core/__tests__/events.test.ts +43 -0
  6. package/src/core/bootstrap.ts +11 -3
  7. package/src/core/events.ts +85 -3
  8. package/src/core/registry.ts +1 -1
  9. package/src/lib/__tests__/email.test.ts +44 -0
  10. package/src/lib/email.ts +37 -1
  11. package/src/modules/access/__tests__/ManageAccessDialog.add-row-picking.test.tsx +141 -0
  12. package/src/modules/access/__tests__/ManageAccessDialog.chip-truncation.test.tsx +204 -0
  13. package/src/modules/access/__tests__/ManageAccessDialog.download-read.test.tsx +234 -0
  14. package/src/modules/access/__tests__/ManageAccessDialog.edited-row-visible.test.tsx +160 -0
  15. package/src/modules/access/__tests__/ManageAccessDialog.placement.test.tsx +2 -2
  16. package/src/modules/access/__tests__/ManageAccessDialog.proposal.test.tsx +166 -0
  17. package/src/modules/access/__tests__/ManageAccessDialog.restrict.test.tsx +510 -0
  18. package/src/modules/access/__tests__/ManageAccessDialog.row-menu-axes.test.tsx +299 -0
  19. package/src/modules/access/__tests__/ManageAccessDialog.row-menu-width.test.tsx +226 -0
  20. package/src/modules/access/__tests__/ManageAccessDialog.test.tsx +721 -126
  21. package/src/modules/access/__tests__/ManageAccessDialog.unknown-email.test.tsx +314 -0
  22. package/src/modules/access/__tests__/manage-access-affordance.test.ts +14 -0
  23. package/src/modules/access/__tests__/tailwindDeclarations.ts +210 -0
  24. package/src/modules/access/api.ts +140 -6
  25. package/src/modules/access/components/ManageAccessDialog.tsx +1299 -561
  26. package/src/modules/access/manage-access-affordance.ts +17 -0
  27. package/src/modules/admin/__tests__/AddMemberInput.test.tsx +297 -0
  28. package/src/modules/admin/__tests__/AdminRolesPage.capabilities.test.tsx +2 -2
  29. package/src/modules/admin/__tests__/AdminRolesPage.fixed-admin.test.tsx +189 -0
  30. package/src/modules/admin/__tests__/AdminRolesPage.suggest.test.tsx +1 -1
  31. package/src/modules/admin/__tests__/ConnectionKeysPage.test.tsx +266 -0
  32. package/src/modules/admin/__tests__/DirectoryGroupsPage.suggest.test.tsx +182 -0
  33. package/src/modules/admin/__tests__/DirectoryGroupsPage.test.tsx +165 -14
  34. package/src/modules/admin/__tests__/UserAccountsPage.test.tsx +401 -4
  35. package/src/modules/admin/__tests__/group-members-path.test.ts +27 -0
  36. package/src/modules/admin/components/AddMemberInput.tsx +268 -0
  37. package/src/modules/admin/components/AdminRolesPage.tsx +97 -132
  38. package/src/modules/admin/components/ConnectionKeysPage.tsx +269 -0
  39. package/src/modules/admin/components/DirectoryGroupsPage.tsx +91 -39
  40. package/src/modules/admin/components/UserAccountsPage.tsx +271 -37
  41. package/src/modules/admin/components/connection-keys-grouping.ts +43 -0
  42. package/src/modules/admin/components/group-members-path.ts +32 -0
  43. package/src/modules/admin/services/connection-keys.api.ts +47 -0
  44. package/src/modules/admin/services/roles.api.ts +12 -1
  45. package/src/modules/auth/__tests__/AccountPage.test.tsx +50 -2
  46. package/src/modules/auth/components/AccountPage.tsx +73 -54
  47. package/src/modules/auth/components/LoginScreen.tsx +1 -0
  48. package/src/modules/auth/services/account.api.ts +78 -4
  49. package/src/modules/change-requests/__tests__/ChangeRequestDialog.access-rules.test.tsx +144 -0
  50. package/src/modules/change-requests/__tests__/ChangeRequestDialog.binary.test.tsx +422 -0
  51. package/src/modules/change-requests/__tests__/ChangeRequestDialog.brings-itself-up-to-date.test.tsx +431 -0
  52. package/src/modules/change-requests/__tests__/ChangeRequestDialog.fork-point.test.tsx +193 -0
  53. package/src/modules/change-requests/__tests__/ChangeRequestDialog.initial-file.test.tsx +142 -0
  54. package/src/modules/change-requests/__tests__/ChangeRequestDialog.moved.test.tsx +202 -0
  55. package/src/modules/change-requests/__tests__/ChangeRequestDialog.test.tsx +205 -13
  56. package/src/modules/change-requests/__tests__/ChangeRequestDialog.unreadable.test.tsx +271 -0
  57. package/src/modules/change-requests/__tests__/FileChangeBoxes.test.tsx +208 -0
  58. package/src/modules/change-requests/__tests__/apply-outcome-for-every-viewer.test.tsx +286 -0
  59. package/src/modules/change-requests/__tests__/propose.concurrent.test.ts +273 -0
  60. package/src/modules/change-requests/__tests__/readFailure.test.ts +122 -0
  61. package/src/modules/change-requests/__tests__/useCrFileDiffs.test.tsx +238 -0
  62. package/src/modules/change-requests/__tests__/useFileOnBranch.test.tsx +56 -1
  63. package/src/modules/change-requests/__tests__/useForkPointFile.test.tsx +79 -0
  64. package/src/modules/change-requests/components/BranchFilePreview.tsx +357 -0
  65. package/src/modules/change-requests/components/ChangeBox.tsx +31 -2
  66. package/src/modules/change-requests/components/ChangeRequestDialog.tsx +862 -72
  67. package/src/modules/change-requests/components/CrFileTree.tsx +74 -58
  68. package/src/modules/change-requests/components/FileChangeBoxes.tsx +19 -15
  69. package/src/modules/change-requests/hooks/useApplyChangeRequest.ts +41 -7
  70. package/src/modules/change-requests/hooks/useCrFileDiffs.ts +181 -23
  71. package/src/modules/change-requests/hooks/useFileOnBranch.ts +70 -7
  72. package/src/modules/change-requests/hooks/useForkPointFile.ts +77 -0
  73. package/src/modules/change-requests/services/change-requests.api.ts +57 -1
  74. package/src/modules/change-requests/services/denied-file.api.ts +53 -0
  75. package/src/modules/change-requests/services/propose.api.ts +97 -8
  76. package/src/modules/change-requests/utils/approval.ts +15 -0
  77. package/src/modules/change-requests/utils/author.ts +32 -0
  78. package/src/modules/change-requests/utils/readFailure.ts +110 -0
  79. package/src/modules/git/__tests__/FileHistoryPanel.test.tsx +20 -0
  80. package/src/modules/git/components/FileHistoryPanel.tsx +5 -0
  81. package/src/modules/git/components/PullRequestsForMe.tsx +51 -24
  82. package/src/modules/git/services/__tests__/error-messages.test.ts +29 -0
  83. package/src/modules/git/services/error-messages.ts +12 -0
  84. package/src/modules/git/services/pr-prompts.ts +5 -5
  85. package/src/modules/layout/__tests__/HeaderAlignment.test.tsx +401 -0
  86. package/src/modules/layout/__tests__/SidebarFooterGrid.test.tsx +286 -0
  87. package/src/modules/layout/__tests__/SidebarFrameResponsive.test.tsx +61 -0
  88. package/src/modules/layout/components/AppLayout.tsx +2 -0
  89. package/src/modules/layout/components/MobileChatLayout.tsx +4 -1
  90. package/src/modules/layout/components/ResizableThreePaneLayout.tsx +4 -1
  91. package/src/modules/layout/components/SidebarFrame.tsx +108 -3
  92. package/src/modules/library/__tests__/AddToPluginDialog.test.tsx +171 -5
  93. package/src/modules/library/__tests__/DeleteToolDialog.test.tsx +356 -0
  94. package/src/modules/library/__tests__/IntegrationsSetupReminder.test.tsx +60 -0
  95. package/src/modules/library/__tests__/LibraryCard.test.tsx +91 -10
  96. package/src/modules/library/__tests__/LibraryRoutes.test.tsx +242 -107
  97. package/src/modules/library/__tests__/LibrarySidebarMenu.test.tsx +103 -98
  98. package/src/modules/library/__tests__/LinkSkillPanel.test.tsx +20 -5
  99. package/src/modules/library/__tests__/LockedPluginView.test.tsx +97 -7
  100. package/src/modules/library/__tests__/NewPluginDialog.test.tsx +13 -4
  101. package/src/modules/library/__tests__/PersonalAddDialog.test.tsx +79 -3
  102. package/src/modules/library/__tests__/PersonalPluginPage.test.tsx +201 -0
  103. package/src/modules/library/__tests__/PluginExtras.test.tsx +100 -9
  104. package/src/modules/library/__tests__/PluginJoinRequests.test.tsx +60 -1
  105. package/src/modules/library/__tests__/PluginPage.test.tsx +258 -6
  106. package/src/modules/library/__tests__/PluginsSidebar.contextmenu.test.tsx +16 -56
  107. package/src/modules/library/__tests__/PluginsSidebar.test.tsx +155 -152
  108. package/src/modules/library/__tests__/PluginsSidebarMenu.test.tsx +16 -0
  109. package/src/modules/library/__tests__/SharedViaPlugins.test.tsx +106 -0
  110. package/src/modules/library/__tests__/SkillPage.test.tsx +386 -80
  111. package/src/modules/library/__tests__/SkillsTree.test.tsx +293 -4
  112. package/src/modules/library/__tests__/ToolConnectionSection.test.tsx +582 -71
  113. package/src/modules/library/__tests__/ToolPage.test.tsx +87 -4
  114. package/src/modules/library/__tests__/WorkspaceItemRoute.test.tsx +173 -26
  115. package/src/modules/library/__tests__/auth-harness.tsx +9 -9
  116. package/src/modules/library/__tests__/card-row-menu.test.tsx +320 -0
  117. package/src/modules/library/__tests__/library-data.mapping.test.tsx +98 -0
  118. package/src/modules/library/__tests__/library-data.stale.test.tsx +121 -28
  119. package/src/modules/library/__tests__/library-data.test.ts +7 -0
  120. package/src/modules/library/__tests__/library-paths.test.ts +47 -4
  121. package/src/modules/library/__tests__/link-membership.test.ts +13 -4
  122. package/src/modules/library/__tests__/name-with-badges.test.tsx +273 -0
  123. package/src/modules/library/__tests__/newSkillMarkdown.test.ts +30 -0
  124. package/src/modules/library/__tests__/owner-pill.test.tsx +357 -0
  125. package/src/modules/library/__tests__/pending-tools.test.tsx +400 -0
  126. package/src/modules/library/__tests__/plugin-entries.test.ts +122 -0
  127. package/src/modules/library/__tests__/plugin-summary.test.ts +36 -1
  128. package/src/modules/library/__tests__/status.test.ts +82 -2
  129. package/src/modules/library/__tests__/tools.api.test.ts +44 -1
  130. package/src/modules/library/components/AccessRequestsBanner.tsx +85 -47
  131. package/src/modules/library/components/AddDialogTabs.tsx +103 -0
  132. package/src/modules/library/components/AddToPluginDialog.tsx +74 -18
  133. package/src/modules/library/components/IntegrationsSetupReminder.tsx +59 -0
  134. package/src/modules/library/components/ItemActionsMenu.tsx +288 -0
  135. package/src/modules/library/components/LibraryCard.tsx +146 -45
  136. package/src/modules/library/components/LibraryLayout.tsx +119 -256
  137. package/src/modules/library/components/LibraryPage.tsx +172 -39
  138. package/src/modules/library/components/LinkSkillPanel.tsx +1 -3
  139. package/src/modules/library/components/LockedPluginView.tsx +62 -34
  140. package/src/modules/library/components/NameWithBadges.tsx +164 -0
  141. package/src/modules/library/components/NewPluginDialog.tsx +16 -2
  142. package/src/modules/library/components/PageActions.tsx +11 -9
  143. package/src/modules/library/components/{PendingSkillReview.tsx → PendingItemReview.tsx} +14 -7
  144. package/src/modules/library/components/PersonalAddDialog.tsx +68 -18
  145. package/src/modules/library/components/PersonalPluginPage.tsx +121 -22
  146. package/src/modules/library/components/PluginExtras.tsx +140 -17
  147. package/src/modules/library/components/PluginIndexRow.tsx +47 -12
  148. package/src/modules/library/components/PluginPage.tsx +157 -41
  149. package/src/modules/library/components/PluginRows.tsx +286 -0
  150. package/src/modules/library/components/PluginsSidebar.tsx +239 -263
  151. package/src/modules/library/components/PluginsSidebarMenu.tsx +26 -1
  152. package/src/modules/library/components/ShareButton.tsx +17 -0
  153. package/src/modules/library/components/SkillsTree.tsx +141 -28
  154. package/src/modules/library/components/TeamRoute.tsx +15 -0
  155. package/src/modules/library/components/__tests__/upload-notices-once-per-page.test.tsx +144 -0
  156. package/src/modules/library/components/plugin-page-parts.tsx +103 -17
  157. package/src/modules/library/components/skill-page/SharedViaPlugins.tsx +6 -12
  158. package/src/modules/library/components/skill-page/SkillFilePane.tsx +5 -0
  159. package/src/modules/library/components/skill-page/SkillPage.tsx +274 -122
  160. package/src/modules/library/components/tool-page/DeleteToolDialog.tsx +218 -0
  161. package/src/modules/library/components/tool-page/ToolConnectionSection.tsx +79 -178
  162. package/src/modules/library/components/tool-page/ToolPage.tsx +106 -16
  163. package/src/modules/library/components/tool-page/ToolVarRow.tsx +42 -41
  164. package/src/modules/library/hooks/__tests__/useLibraryData.test.ts +98 -0
  165. package/src/modules/library/hooks/useLibraryData.ts +92 -19
  166. package/src/modules/library/routes/LibraryRoutes.tsx +14 -11
  167. package/src/modules/library/routes/WorkspaceItemRoute.tsx +77 -27
  168. package/src/modules/library/routes/library-paths.ts +26 -28
  169. package/src/modules/library/services/library.api.ts +38 -20
  170. package/src/modules/library/services/plugins.api.ts +69 -8
  171. package/src/modules/library/services/teams.api.ts +15 -0
  172. package/src/modules/library/services/tools.api.ts +78 -0
  173. package/src/modules/library/state/library-data.tsx +170 -32
  174. package/src/modules/library/utils/personal-plugin.ts +13 -15
  175. package/src/modules/library/utils/plugin-entries.ts +134 -0
  176. package/src/modules/library/utils/plugin-summary.ts +75 -9
  177. package/src/modules/library/utils/status.ts +135 -33
  178. package/src/modules/onboarding/__tests__/creator-welcome.test.tsx +8 -1
  179. package/src/modules/onboarding/__tests__/onboarding.test.tsx +853 -760
  180. package/src/modules/onboarding/agent-clients.ts +55 -23
  181. package/src/modules/onboarding/components/ConnectAgentPill.tsx +5 -1
  182. package/src/modules/onboarding/components/WelcomePage.tsx +98 -62
  183. package/src/modules/pr/services/pr-merge.api.ts +2 -1
  184. package/src/modules/review/components/MarkdownDiffViewer.tsx +53 -8
  185. package/src/modules/review/components/ReviewPanel.tsx +15 -17
  186. package/src/modules/review/components/__tests__/MarkdownDiffViewer.test.tsx +64 -0
  187. package/src/modules/review/components/__tests__/ReviewPanel.test.tsx +25 -1
  188. package/src/modules/secrets-vault/components/ConnectToolsPage.tsx +454 -117
  189. package/src/modules/secrets-vault/components/SecretsPage.tsx +48 -7
  190. package/src/modules/secrets-vault/components/ToolSecretsPanel.tsx +84 -5
  191. package/src/modules/secrets-vault/components/__tests__/ConnectToolsPage.test.tsx +425 -0
  192. package/src/modules/secrets-vault/components/__tests__/SecretsPage.test.tsx +417 -82
  193. package/src/modules/secrets-vault/components/__tests__/ToolSecretsPanel.test.tsx +105 -0
  194. package/src/modules/secrets-vault/components/__tests__/connect-lists-what-the-banner-counted.test.tsx +407 -0
  195. package/src/modules/secrets-vault/probe/SavedKeyProbeResult.tsx +98 -0
  196. package/src/modules/secrets-vault/probe/__tests__/probe-verdict.test.ts +160 -0
  197. package/src/modules/secrets-vault/probe/probe-verdict.ts +108 -0
  198. package/src/modules/secrets-vault/probe/useSavedKeyProbe.ts +228 -0
  199. package/src/modules/secrets-vault/services/connect.api.ts +36 -5
  200. package/src/modules/secrets-vault/utils/connect-status.ts +98 -0
  201. package/src/modules/settings/components/ClaudeConnectionCard.tsx +9 -24
  202. package/src/modules/settings/components/ClaudeConnectionFields.tsx +23 -0
  203. package/src/modules/settings/components/DeploymentPage.tsx +10 -30
  204. package/src/modules/settings/components/MarketplaceSection.tsx +152 -0
  205. package/src/modules/settings/components/__tests__/DeploymentPage.test.tsx +67 -4
  206. package/src/modules/settings/components/__tests__/MarketplaceSection.test.tsx +325 -0
  207. package/src/modules/settings/components/__tests__/SettingsLayout.test.tsx +5 -5
  208. package/src/modules/settings/services/github-facade.api.ts +23 -0
  209. package/src/modules/settings/settings-nav-items.tsx +10 -2
  210. package/src/modules/setup/__tests__/setup.oidc.test.tsx +172 -0
  211. package/src/modules/setup/__tests__/setup.probe-refusal.test.tsx +123 -0
  212. package/src/modules/setup/__tests__/setup.test.tsx +497 -4
  213. package/src/modules/setup/__tests__/useSetupStatus.test.tsx +130 -0
  214. package/src/modules/setup/components/SetupGate.tsx +16 -16
  215. package/src/modules/setup/components/SetupScreen.tsx +521 -43
  216. package/src/modules/setup/hooks/useSetupStatus.ts +93 -0
  217. package/src/modules/setup/services/setup.api.ts +140 -3
  218. package/src/modules/setup/utils/__tests__/root-folders.test.ts +72 -0
  219. package/src/modules/setup/utils/root-folders.ts +46 -0
  220. package/src/modules/toolbar/assets/claude-setup/01-add-manually.webp +0 -0
  221. package/src/modules/toolbar/assets/claude-setup/02-add-configuration.webp +0 -0
  222. package/src/modules/toolbar/assets/claude-setup/03-connect-account.webp +0 -0
  223. package/src/modules/toolbar/assets/claude-setup/04-pick-instance.webp +0 -0
  224. package/src/modules/toolbar/assets/claude-setup/05-plugins-add.webp +0 -0
  225. package/src/modules/toolbar/assets/claude-setup/06-add-marketplace.webp +0 -0
  226. package/src/modules/toolbar/assets/claude-setup/07-paste-url-sync.webp +0 -0
  227. package/src/modules/toolbar/assets/claude-setup/08-install-plugins.webp +0 -0
  228. package/src/modules/toolbar/assets/claude-setup/09-select-repository.webp +0 -0
  229. package/src/modules/toolbar/assets/claude-setup/10-connector-not-added.webp +0 -0
  230. package/src/modules/toolbar/assets/claude-setup/11-add-custom-connector.webp +0 -0
  231. package/src/modules/toolbar/assets/claude-setup/README.md +68 -0
  232. package/src/modules/toolbar/components/AgentInstructionsCard.tsx +296 -0
  233. package/src/modules/toolbar/components/ClaudeMarketplaceCarousel.tsx +107 -0
  234. package/src/modules/toolbar/components/ClaudeRegistrationSteps.tsx +127 -0
  235. package/src/modules/toolbar/components/CoworkSetupSteps.tsx +100 -0
  236. package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +177 -118
  237. package/src/modules/toolbar/components/ScreenshotStep.tsx +77 -0
  238. package/src/modules/toolbar/components/SetupCarousel.tsx +177 -0
  239. package/src/modules/toolbar/components/__tests__/AgentInstructionsCard.test.tsx +370 -0
  240. package/src/modules/toolbar/components/__tests__/ExternalAgentAccessPage.test.tsx +542 -42
  241. package/src/modules/toolbar/components/__tests__/Toolbar.test.tsx +2 -2
  242. package/src/modules/toolbar/components/__tests__/claude-setup-shots.test.ts +104 -0
  243. package/src/modules/toolbar/components/claude-connector-slide.tsx +38 -0
  244. package/src/modules/toolbar/components/claude-setup-shots.ts +167 -0
  245. package/src/modules/toolbar/components/deployment-address.ts +29 -0
  246. package/src/modules/toolbar/components/setup-step-parts.tsx +35 -0
  247. package/src/modules/toolbar/services/__tests__/agent-instructions.api.test.ts +89 -0
  248. package/src/modules/toolbar/services/agent-instructions.api.ts +167 -0
  249. package/src/modules/toolbar/services/external-api-keys.api.ts +6 -0
  250. package/src/modules/workflow/state/ChangeRequestStaleBinder.tsx +43 -0
  251. package/src/modules/workflow/state/EventBusProvider.tsx +122 -11
  252. package/src/modules/workflow/state/__tests__/EventBusProvider.storage.test.tsx +87 -0
  253. package/src/modules/workflow/state/__tests__/EventBusProvider.watch.test.tsx +223 -0
  254. package/src/modules/workflow/state/event-bus.context.ts +10 -0
  255. package/src/modules/workspace/__tests__/testFixtures.ts +5 -3
  256. package/src/modules/workspace/components/FileExplorer.tsx +1295 -191
  257. package/src/modules/workspace/components/FileRoute.tsx +353 -36
  258. package/src/modules/workspace/components/FileViewer.tsx +166 -45
  259. package/src/modules/workspace/components/KbDocumentShell.tsx +50 -6
  260. package/src/modules/workspace/components/KbPageHeader.tsx +120 -55
  261. package/src/modules/workspace/components/TreeActionConfirm.tsx +350 -0
  262. package/src/modules/workspace/components/__tests__/FileExplorer.test.tsx +2473 -129
  263. package/src/modules/workspace/components/__tests__/FileRoute.test.tsx +731 -18
  264. package/src/modules/workspace/components/__tests__/FileViewer.test.tsx +331 -12
  265. package/src/modules/workspace/components/__tests__/KbDocumentShell.test.tsx +39 -0
  266. package/src/modules/workspace/components/__tests__/KbPageHeader.test.tsx +33 -20
  267. package/src/modules/workspace/components/renderers/DocxRenderer.tsx +4 -5
  268. package/src/modules/workspace/components/renderers/DownloadFileButton.tsx +13 -4
  269. package/src/modules/workspace/components/renderers/EmailRenderer.tsx +4 -3
  270. package/src/modules/workspace/components/renderers/HtmlRenderer.tsx +8 -14
  271. package/src/modules/workspace/components/renderers/ImageRenderer.tsx +75 -16
  272. package/src/modules/workspace/components/renderers/KbImage.tsx +180 -0
  273. package/src/modules/workspace/components/renderers/KbMarkdownView.tsx +22 -6
  274. package/src/modules/workspace/components/renderers/MarkdownRenderer.tsx +48 -22
  275. package/src/modules/workspace/components/renderers/PdfRenderer.tsx +4 -5
  276. package/src/modules/workspace/components/renderers/PptxRenderer.tsx +4 -3
  277. package/src/modules/workspace/components/renderers/XlsxRenderer.tsx +4 -3
  278. package/src/modules/workspace/components/renderers/__tests__/DocxRenderer.test.tsx +12 -0
  279. package/src/modules/workspace/components/renderers/__tests__/DownloadFileButton.test.tsx +57 -9
  280. package/src/modules/workspace/components/renderers/__tests__/EmailRenderer.test.tsx +13 -1
  281. package/src/modules/workspace/components/renderers/__tests__/ImageRenderer.test.tsx +163 -0
  282. package/src/modules/workspace/components/renderers/__tests__/KbMarkdownView.test.tsx +237 -0
  283. package/src/modules/workspace/components/renderers/__tests__/MarkdownRenderer.test.tsx +108 -14
  284. package/src/modules/workspace/components/renderers/__tests__/PptxRenderer.test.tsx +14 -1
  285. package/src/modules/workspace/components/renderers/__tests__/XlsxRenderer.test.tsx +16 -1
  286. package/src/modules/workspace/components/renderers/__tests__/rendererSelection.test.tsx +66 -1
  287. package/src/modules/workspace/components/renderers/index.ts +53 -2
  288. package/src/modules/workspace/components/renderers/kbMarkdownPipeline.tsx +25 -4
  289. package/src/modules/workspace/components/renderers/rendererWorkspace.ts +40 -0
  290. package/src/modules/workspace/hooks/__tests__/useImageRevision.test.tsx +174 -0
  291. package/src/modules/workspace/hooks/__tests__/useOpenChangeRequests.test.tsx +179 -1
  292. package/src/modules/workspace/hooks/__tests__/useWorkspaceImageResolver.test.tsx +122 -0
  293. package/src/modules/workspace/hooks/__tests__/useWorkspaceState.test.tsx +892 -7
  294. package/src/modules/workspace/hooks/useImageRevision.ts +101 -0
  295. package/src/modules/workspace/hooks/useMergedWorkspaceTree.ts +22 -3
  296. package/src/modules/workspace/hooks/useWorkspaceImageResolver.ts +55 -0
  297. package/src/modules/workspace/hooks/useWorkspaceState.ts +424 -66
  298. package/src/modules/workspace/routing/__tests__/kb-routes.test.tsx +279 -3
  299. package/src/modules/workspace/routing/kb-routes.ts +206 -29
  300. package/src/modules/workspace/services/__tests__/workspace.api.test.ts +57 -1
  301. package/src/modules/workspace/services/workspace.api.ts +57 -4
  302. package/src/modules/workspace/state/__tests__/applied-request-clears-pending.test.tsx +343 -0
  303. package/src/modules/workspace/state/__tests__/upload-lands-where-it-was-dropped.test.tsx +158 -0
  304. package/src/modules/workspace/state/open-change-requests.tsx +100 -12
  305. package/src/modules/workspace/state/workspace.context.ts +125 -19
  306. package/src/modules/workspace/utils/__tests__/file-trace.test.ts +73 -0
  307. package/src/modules/workspace/utils/__tests__/fileTree.test.ts +220 -6
  308. package/src/modules/workspace/utils/__tests__/pasteLink.test.ts +76 -0
  309. package/src/modules/workspace/utils/__tests__/treeConfirm.test.ts +364 -0
  310. package/src/modules/workspace/utils/__tests__/uploadError.test.ts +35 -0
  311. package/src/modules/workspace/utils/file-trace.ts +50 -0
  312. package/src/modules/workspace/utils/fileTree.ts +112 -36
  313. package/src/modules/workspace/utils/frontmatter.ts +8 -4
  314. package/src/modules/workspace/utils/pasteLink.ts +90 -0
  315. package/src/modules/workspace/utils/treeConfirm.ts +338 -0
  316. package/src/modules/workspace/utils/uploadError.ts +29 -0
  317. package/src/shared/__tests__/marketplace-url.test.ts +6 -1
  318. package/src/shared/components/Button.tsx +16 -2
  319. package/src/shared/components/Dialog.tsx +27 -11
  320. package/src/shared/components/Menu.tsx +13 -1
  321. package/src/shared/components/PageShell.tsx +13 -8
  322. package/src/shared/components/__tests__/primitives.test.tsx +116 -2
  323. package/src/shared/components/__tests__/useFocusHandoff.test.tsx +192 -0
  324. package/src/shared/components/index.ts +2 -0
  325. package/src/shared/components/useDismissableMenu.ts +32 -10
  326. package/src/shared/components/useFocusHandoff.ts +51 -0
  327. package/src/shared/components/useLatestRef.ts +28 -0
  328. package/src/shared/markdown/Markdown.tsx +12 -3
  329. package/src/shared/markdown/__tests__/escapeSpacesInLinkDestinations.test.ts +39 -0
  330. package/src/shared/markdown/hrefs.ts +50 -0
  331. package/src/shared/marketplace-url.ts +33 -5
  332. package/src/shared/mcp/ChatGptInstallLink.tsx +3 -3
  333. package/src/shared/mcp/ConnectionInstructions.tsx +38 -27
  334. package/src/shared/mcp/__tests__/connect-snippets.test.ts +3 -3
  335. package/src/shared/mcp/connect-snippets.ts +14 -9
  336. package/src/shared/mcp/index.ts +1 -1
  337. package/src/shared/theme/__tests__/header-band.test.ts +197 -0
  338. package/src/shared/theme/header.ts +75 -0
  339. package/src/shared/theme/measure.ts +7 -4
  340. package/src/shared/theme/tokens.css +25 -0
  341. package/src/modules/library/__tests__/PluginsIndexPage.test.tsx +0 -363
  342. package/src/modules/library/__tests__/PluginsSidebar.locked.test.tsx +0 -97
  343. package/src/modules/library/components/PluginsIndexPage.tsx +0 -270
  344. package/src/modules/update-check/__tests__/UpdateBanner.test.tsx +0 -126
  345. package/src/modules/update-check/components/UpdateBanner.tsx +0 -92
  346. package/src/modules/update-check/services/update-check.api.ts +0 -24
@@ -0,0 +1,218 @@
1
+ import { useEffect, useState } from 'react';
2
+ import { Banner, Button, Dialog, TextField } from '../../../../shared/components';
3
+ import { deleteTool, getToolDependents, type ToolDependents } from '../../services/tools.api';
4
+
5
+ /**
6
+ * The "are you sure" a TOOL deletion deserves — and what makes it different
7
+ * from the plugin's is that a tool is something other things POINT AT. A
8
+ * plugin's contents go with it; a tool's dependents stay behind, broken: a
9
+ * skill whose `allowed-tools` names it, a plugin that carries it, and every
10
+ * credential stored under its name.
11
+ *
12
+ * So the dialog asks the backend first and says exactly what it found, before
13
+ * the confirm is worth reading. The counts are counts — never a value, never
14
+ * whose sign-in — because the point is to inform the owner, not to hand them
15
+ * other people's credentials.
16
+ *
17
+ * Who may open it is the caller's decision (plugin ownership); the backend
18
+ * enforces the same verdict for real, and its refusal is what this shows.
19
+ *
20
+ * And the confirm is the tool's NAME, typed. The plugin dialog is content of
21
+ * yours going with a folder of yours; this one also wipes credentials that are
22
+ * not the clicker's — other people's stored keys and sign-ins — so the hand
23
+ * that does it says the name first.
24
+ */
25
+ export function DeleteToolDialog({
26
+ slug,
27
+ name,
28
+ onClose,
29
+ onDeleted,
30
+ }: {
31
+ slug: string;
32
+ /** The tool's name, for the title before the dependents arrive. */
33
+ name: string;
34
+ onClose(): void;
35
+ /** Fired after the delete lands, with the plugin the tool lived in. */
36
+ onDeleted(plugin: string): void;
37
+ }) {
38
+ const [dependents, setDependents] = useState<ToolDependents | null>(null);
39
+ const [loadError, setLoadError] = useState<string | null>(null);
40
+ const [busy, setBusy] = useState(false);
41
+ const [error, setError] = useState<string | null>(null);
42
+ const [typed, setTyped] = useState('');
43
+ const [shownFor, setShownFor] = useState(slug);
44
+
45
+ // A tool page can navigate to ANOTHER tool with this dialog still open, and
46
+ // the dependents read for the new slug does not resolve instantly. Clearing
47
+ // during the render that first sees the new slug — not in an effect, which
48
+ // runs after it — is what stops a confirmation typed for the old tool from
49
+ // arming Delete against the new one.
50
+ if (shownFor !== slug) {
51
+ setShownFor(slug);
52
+ setDependents(null);
53
+ setLoadError(null);
54
+ setError(null);
55
+ setTyped('');
56
+ }
57
+
58
+ useEffect(() => {
59
+ let live = true;
60
+ getToolDependents(slug)
61
+ .then((d) => {
62
+ if (live) setDependents(d);
63
+ })
64
+ .catch((err: unknown) => {
65
+ // The one thing worse than a scary dialog is a confident one: if we
66
+ // could not read what depends on the tool, the delete is not offered.
67
+ if (live) setLoadError(err instanceof Error ? err.message : "Couldn't read what depends on this tool.");
68
+ });
69
+ return () => {
70
+ live = false;
71
+ };
72
+ }, [slug]);
73
+
74
+ async function remove() {
75
+ setBusy(true);
76
+ setError(null);
77
+ try {
78
+ const { plugin } = await deleteTool(slug);
79
+ onDeleted(plugin);
80
+ onClose();
81
+ } catch (err) {
82
+ // The backend's refusal names the rule (ownership, an external format,
83
+ // a refused push); a generic apology would hide the one thing worth
84
+ // reading.
85
+ setError(err instanceof Error ? err.message : "Couldn't delete the tool.");
86
+ setBusy(false);
87
+ }
88
+ }
89
+
90
+ // The name as the BACKEND spells it once it answers, so the thing typed is
91
+ // the thing deleted even if the page arrived with a stale label.
92
+ const confirmName = dependents?.name ?? name;
93
+ const ready = dependents !== null && loadError === null;
94
+ const confirmed = ready && typed.trim() === confirmName;
95
+
96
+ return (
97
+ <Dialog
98
+ open
99
+ onClose={onClose}
100
+ title={`Delete ${dependents?.name ?? name}?`}
101
+ size="md"
102
+ busy={busy}
103
+ footer={
104
+ <>
105
+ <Button variant="quiet" onClick={onClose} disabled={busy}>
106
+ Cancel
107
+ </Button>
108
+ <Button variant="danger" onClick={() => void remove()} disabled={busy || !confirmed}>
109
+ {busy ? 'Deleting…' : 'Delete tool'}
110
+ </Button>
111
+ </>
112
+ }
113
+ >
114
+ {loadError ? (
115
+ <Banner tone="danger" role="alert">
116
+ {loadError}
117
+ </Banner>
118
+ ) : !dependents ? (
119
+ <p className="text-ui text-ink-muted">Checking what depends on this tool…</p>
120
+ ) : (
121
+ <>
122
+ <p className="text-ui text-ink-muted">
123
+ {dependents.source === 'server'
124
+ ? `This removes the ${dependents.name} server from ${dependents.plugin.displayName}'s configuration for everyone, and there is no undo — it survives only in git history.`
125
+ : `This deletes the ${dependents.name} tool from ${dependents.plugin.displayName} for everyone, and there is no undo — it survives only in git history.`}
126
+ </p>
127
+ <DependentList
128
+ // "You can see" is not modesty: the backend lists only the
129
+ // caller's readable skills, because naming one they cannot read
130
+ // would confirm it exists. An unqualified heading would present
131
+ // that subset as the whole truth.
132
+ label="Skills you can see that allow it"
133
+ items={dependents.skills.map((s) => s.name)}
134
+ // Said plainly, because it is the consequence people are most
135
+ // likely to be surprised by: the skills keep the name and break.
136
+ none="No skill you can see names it in its allowed tools."
137
+ tail="keep naming it in their allowed tools — those entries stop resolving."
138
+ tailOne="keeps naming it in its allowed tools — that entry stops resolving."
139
+ />
140
+ <DependentList
141
+ label="Plugins that carry it"
142
+ items={dependents.plugins.map((p) => p.displayName)}
143
+ none="No other plugin carries it."
144
+ tail="lose it too."
145
+ tailOne="loses it too."
146
+ />
147
+ <p className="mt-3 text-ui text-ink-muted">
148
+ {secretsLine(dependents.storedKeys, dependents.signIns)}
149
+ </p>
150
+ <label className="mt-4 block text-ui text-ink-muted" htmlFor={CONFIRM_FIELD_ID}>
151
+ {'Type '}
152
+ <span className="font-semibold text-ink">{confirmName}</span>
153
+ {' to confirm.'}
154
+ </label>
155
+ <TextField
156
+ id={CONFIRM_FIELD_ID}
157
+ className="mt-1.5"
158
+ value={typed}
159
+ autoComplete="off"
160
+ spellCheck={false}
161
+ disabled={busy}
162
+ onChange={(e) => setTyped(e.target.value)}
163
+ />
164
+ </>
165
+ )}
166
+ {error && (
167
+ <Banner tone="danger" role="alert" className="mt-3">
168
+ {error}
169
+ </Banner>
170
+ )}
171
+ </Dialog>
172
+ );
173
+ }
174
+
175
+ const CONFIRM_FIELD_ID = 'delete-tool-confirm';
176
+
177
+ /** One kind of dependent, named — or the honest "nothing" that saves a worry. */
178
+ function DependentList({
179
+ label,
180
+ items,
181
+ none,
182
+ tail,
183
+ tailOne,
184
+ }: {
185
+ label: string;
186
+ items: string[];
187
+ none: string;
188
+ tail: string;
189
+ tailOne: string;
190
+ }) {
191
+ return (
192
+ <div className="mt-3">
193
+ <p className="text-label font-semibold uppercase text-ink-faint">{label}</p>
194
+ {items.length === 0 ? (
195
+ <p className="text-ui text-ink-muted">{none}</p>
196
+ ) : (
197
+ <p className="text-ui text-ink-muted">
198
+ <span className="font-semibold text-ink">{items.join(', ')}</span>{' '}
199
+ {items.length === 1 ? tailOne : tail}
200
+ </p>
201
+ )}
202
+ </div>
203
+ );
204
+ }
205
+
206
+ /**
207
+ * The credentials, as numbers. EVERY user's, not just the reader's — the whole
208
+ * reason the count comes from the backend is that a page can only see its own
209
+ * secrets, and "0" from a page that cannot see the others would be a lie.
210
+ */
211
+ function secretsLine(keys: number, signIns: number): string {
212
+ const parts = [
213
+ keys > 0 ? `${keys} stored ${keys === 1 ? 'key' : 'keys'}` : null,
214
+ signIns > 0 ? `${signIns} ${signIns === 1 ? 'sign-in' : 'sign-ins'}` : null,
215
+ ].filter(Boolean);
216
+ if (parts.length === 0) return 'Nothing is stored under its name.';
217
+ return `${parts.join(' and ')} stored under its name ${parts.length === 1 ? 'is' : 'are'} wiped.`;
218
+ }
@@ -1,14 +1,11 @@
1
- import { useRef, useState } from 'react';
2
1
  import { Link, useNavigate } from 'react-router-dom';
3
2
  import { DEFAULT_BRANCH } from '@bevel-software/platform-shared';
4
3
  import { Banner, Button, buttonClasses } from '../../../../shared/components';
4
+ import { announceToolCredentialsChanged } from '../../../../core/events';
5
5
  import { useWorkspace } from '../../../workspace/state/workspace.context';
6
6
  import { kbFileUrl } from '../../../workspace/routing/kb-routes';
7
- import {
8
- checkToolConnection,
9
- type ProbeVerdict,
10
- type ToolSecrets,
11
- } from '../../../secrets-vault/services/tool-secrets.api';
7
+ import { useSavedKeyProbe } from '../../../secrets-vault/probe/useSavedKeyProbe';
8
+ import { type ToolSecrets } from '../../../secrets-vault/services/tool-secrets.api';
12
9
  import { pathForTool } from '../../routes/library-paths';
13
10
  import { toolStatus, toolVariableStatuses } from '../../utils/status';
14
11
  import { ToolVarRow } from './ToolVarRow';
@@ -17,13 +14,23 @@ import { ToolVarRow } from './ToolVarRow';
17
14
  * "Your connection" — what this tool still needs from you, and (if you own it)
18
15
  * from you on everyone's behalf.
19
16
  *
20
- * The setup banner above the rows exists because `oauth-manual` is the one
21
- * state the rows CANNOT explain on their own: the remote server wants a sign-in
22
- * through an app the OWNER registers, so every row underneath is stuck through
23
- * no fault of the person reading them. The banner names whose move it is — the
24
- * owner's — and what the move is: declare the sign-in (the server editor on
25
- * this page for an mcp.json server, the file itself for a `.tool`), then set
26
- * its client secret. Once declared, only the secret remains and it says so.
17
+ * A banner here names a CAUSE the rows cannot see; it never summarises them.
18
+ * There used to be a second one that did — "this tool needs 2 things before it
19
+ * works", then every missing label and status, sitting directly on top of rows
20
+ * that already carried those labels, those statuses and the buttons that fix
21
+ * them. What it really added was colour, so colour is what survived it: an
22
+ * unset row is drawn amber (see `ToolVarRow`'s `unset`), and the count is how
23
+ * many of them there are.
24
+ *
25
+ * The setup banner that remains passes that test, because `oauth-manual` is the
26
+ * one state the rows CANNOT explain on their own: the remote server wants a
27
+ * sign-in through an app the OWNER registers, so every row underneath is stuck
28
+ * through no fault of the person reading them. The banner names whose move it
29
+ * is — the owner's — and what the move is: declare the sign-in (the server
30
+ * editor on this page for an mcp.json server, the file itself for a `.tool`),
31
+ * then set its client secret. Once declared, only the secret remains and it
32
+ * says so. The rejected-credential banner passes it too: only a real call
33
+ * could know, so no row can.
27
34
  */
28
35
 
29
36
  export interface ToolConnectionSectionProps {
@@ -50,53 +57,22 @@ export function ToolConnectionSection({
50
57
  }: ToolConnectionSectionProps) {
51
58
  const navigate = useNavigate();
52
59
  const { kbDirName } = useWorkspace();
53
- /** `{varName, n}` — bumping `n` opens that variable's editor from the banner. */
54
- const [edit, setEdit] = useState<{ name: string; n: number }>({ name: '', n: 0 });
55
- /**
56
- * The revision of the probe in flight, or null. `checking` is DERIVED: an
57
- * in-flight probe owns the Test button only while the definition it dials
58
- * is still the one on screen, so a config edit mid-probe re-enables the
59
- * button for the new definition immediately instead of waiting for the
60
- * orphan to settle.
61
- */
62
- const [inFlight, setInFlight] = useState<{ rev: number } | null>(null);
63
- const checking = inFlight !== null && inFlight.rev === configRevision;
64
60
 
65
61
  /**
66
- * A probe's TRANSPORT failure (network, access — not a verdict about the
67
- * credential), held here rather than raised to the page's shared error
68
- * banner. Page-level state outlived its subject twice over: another
69
- * action's error could be cleared by a probe that happened to recover,
70
- * and a probe of the PREVIOUS tool (this section is keyed by slug) could
71
- * clear or raise it after unmount. Section state dies with the section,
72
- * and the revision stamp makes it self-invalidating, exactly like the
73
- * verdict: shown only while it describes the configuration on screen.
74
- */
75
- const [probeError, setProbeError] = useState<{ rev: number; message: string } | null>(null);
76
- const shownProbeError = probeError && probeError.rev === configRevision ? probeError.message : null;
77
- /**
78
- * The last probe's answer, and the ONLY place one exists.
62
+ * The probe, and the ONLY place its answer exists.
79
63
  *
80
64
  * Nothing persists a verdict, so this state IS the evidence behind the word
81
65
  * "Connected" — which is why the claim can be trusted: it cannot outlive the
82
- * page that watched the call succeed.
66
+ * page that watched the call succeed. Section state, not page state: a probe
67
+ * of the PREVIOUS tool (this section is keyed by slug) could otherwise raise
68
+ * or clear a page-level banner after unmount.
83
69
  *
84
- * Stored WITH the config revision it was probed under, and read back only
85
- * when that still matches. Comparing rather than clearing keeps it pure: an
86
- * effect that cleared on change would race the probe it is meant to protect,
87
- * since a credential save starts a probe and a refetch at the same moment.
88
- */
89
- const [probed, setProbed] = useState<{ rev: number; value: ProbeVerdict } | null>(null);
90
- const verdict = probed && probed.rev === configRevision ? probed.value : null;
91
-
92
- /**
93
- * Which probe is allowed to publish. Two saves in quick succession start two
94
- * probes, and the first can answer last — so a result is applied only while
95
- * it is still the newest one asked for. Without it the older credential's
96
- * verdict wins by finishing late, which is the same stale-answer bug this
97
- * whole feature exists to remove, one layer up.
70
+ * The revision is passed through as the hook's stamp, so an answer is read
71
+ * back only while it still describes the server definition on screen.
98
72
  */
99
- const probeSeq = useRef(0);
73
+ const probe = useSavedKeyProbe(tool.slug, configRevision);
74
+ const { checking, verdict } = probe;
75
+ const shownProbeError = probe.result?.kind === 'unreachable' ? probe.result.message : null;
100
76
 
101
77
 
102
78
  const setupKind = tool.setup?.kind ?? null;
@@ -113,59 +89,36 @@ export function ToolConnectionSection({
113
89
  const isMcpJsonServer = tool.path.endsWith('/mcp.json');
114
90
 
115
91
  /**
116
- * The CONFIGURATION this tool is still missing, named.
92
+ * The CONFIGURATION this tool is still missing, by variable name.
117
93
  *
118
- * Only configuration gaps earn the amber banner: keys nobody has entered,
119
- * owner-side setup nobody has finished. A pending sign-in on a fully
120
- * configured provider is deliberately NOT here — the row right below says
121
- * "Needs your sign-in" with its own Sign in button, and a banner repeating
122
- * both is the same sentence twice with two identical buttons. Configuration
123
- * is the state of the TOOL; signing in is a step each PERSON takes, and the
124
- * row is where personal steps live.
125
- */
126
- const missing = toolVariableStatuses(tool).filter(
127
- ({ v, status }) => status.state !== 'ok' && !(v.oauth && v.adminConfigured),
128
- );
129
-
130
- /**
131
- * The banner's one action — the first missing key the READER can enter.
94
+ * This list used to be prose in an amber banner above the rows — "needs 2
95
+ * things", then every label and status again — directly above rows already
96
+ * carrying the same labels, the same statuses and the buttons that fix
97
+ * them. The rows won: each one named here is drawn amber, and the count the
98
+ * banner gave is how many amber rows there are.
132
99
  *
133
- * Saying "Needs a key from you" and making the reader hunt for where to put
134
- * it is a treasure map; the banner carries the shovel: the button opens (and
135
- * scrolls to) the row's editor. An admin-scope gap for a non-writer yields
136
- * no button, because the honest button would be "go ask someone else" —
137
- * and an unconfigured sign-in provider is exactly that case too.
100
+ * Only configuration gaps qualify: keys nobody has entered, owner-side setup
101
+ * nobody has finished. A pending sign-in on a fully configured provider is
102
+ * deliberately NOT here — configuration is the state of the TOOL, while
103
+ * signing in is a step each PERSON takes, and its row already offers the
104
+ * Sign in button without needing to be flagged as unfinished setup.
138
105
  */
139
- const actionable = missing.find(
140
- ({ v }) => !v.oauth && (v.scope === 'user' || tool.canWrite),
106
+ const unset = new Set(
107
+ toolVariableStatuses(tool)
108
+ .filter(({ v, status }) => status.state !== 'ok' && !(v.oauth && v.adminConfigured))
109
+ .map(({ v }) => v.name),
141
110
  );
142
111
 
143
- // The aria-label carries the variable so the banner's button and the row's
144
- // never share an accessible name — same words to the eye, distinct to a
145
- // screen reader and to the tests.
146
- const bannerAction = actionable ? (
147
- <Button
148
- variant="primary"
149
- size="sm"
150
- aria-label={`${actionable.v.scope === 'user' ? 'Add key' : 'Set key'}: ${
151
- actionable.v.label ?? actionable.v.name
152
- }`}
153
- onClick={() => setEdit((e) => ({ name: actionable.v.name, n: e.n + 1 }))}
154
- >
155
- {actionable.v.scope === 'user' ? 'Add key' : 'Set key'}
156
- </Button>
157
- ) : null;
158
-
159
112
  /**
160
113
  * The health line, shown only once every variable is provided.
161
114
  *
162
- * While something is still missing, the amber banner above already names it,
115
+ * While something is still missing, the amber rows below already name it,
163
116
  * and a second line saying the connection is untested would be answering a
164
117
  * question nobody has reached yet. Once nothing is missing, this is the only
165
118
  * remaining question — and the one the badge used to answer by guessing.
166
119
  */
167
120
  const health = toolStatus(tool, verdict);
168
- // Every variable genuinely provided — NOT merely `missing.length === 0`, which
121
+ // Every variable genuinely provided — NOT merely `unset.size === 0`, which
169
122
  // excludes a pending sign-in on a configured provider. A tool nobody has
170
123
  // signed into yet has no credential to test, and saying so would put a health
171
124
  // line above a row that already says "Needs your sign-in".
@@ -181,66 +134,26 @@ export function ToolConnectionSection({
181
134
  !setupUnfinished && toolVariableStatuses(tool).every(({ status }) => status.state === 'ok');
182
135
 
183
136
  /**
184
- * Run a probe and keep its answer.
185
- *
186
- * `checking` lives here, beside the button it disables, so it is still true
187
- * while the request is in flight — the reason a save no longer blanks the
188
- * page (see `useToolPage`): a remount would drop both this flag and the
189
- * verdict, leaving an enabled "Test connection" over a probe already running.
190
- */
191
- async function runCheck() {
192
- const mine = ++probeSeq.current;
193
- const rev = configRevision;
194
- setInFlight({ rev });
195
- // A replacement probe makes the previous transport failure history the
196
- // moment it starts — leaving the alert up while "Testing…" runs reads as
197
- // the new attempt already having failed.
198
- setProbeError(null);
199
- try {
200
- const value = await checkToolConnection(tool.slug);
201
- // Newest-probe guard only: everything published is REVISION-STAMPED
202
- // and compared at render, so a probe that raced a definition change
203
- // stores state that simply never shows — no clock to synchronise, no
204
- // ref to read mid-render.
205
- if (probeSeq.current === mine) {
206
- setProbed({ rev, value });
207
- setProbeError(null);
208
- }
209
- } catch (err) {
210
- // A rejected credential resolves with `status: 'failed'`; only a
211
- // transport or access failure lands here, and that is not a verdict about
212
- // the credential — so the badge keeps saying "untested" rather than
213
- // inventing a result from our own network trouble.
214
- // Inside the guard too: an older probe rejecting after a newer one has
215
- // already answered would otherwise raise a transport error over a verdict
216
- // that is currently correct.
217
- if (probeSeq.current === mine) {
218
- setProbed(null);
219
- setProbeError({ rev, message: err instanceof Error ? err.message : "Couldn't test this connection." });
220
- }
221
- } finally {
222
- // Only the newest probe releases the slot: an older one finishing late
223
- // must not clear a newer probe's in-flight marker.
224
- if (probeSeq.current === mine) setInFlight(null);
225
- }
226
- }
227
-
228
- /**
229
- * A credential write LANDED (save or delete, from the banner's editor or a
230
- * row). Everything a pending probe could still say is about a credential
137
+ * A credential write LANDED (save or delete, from a row's editor).
138
+ * Everything a pending probe could still say is about a credential
231
139
  * that no longer exists in that form, so the write ORPHANS it outright —
232
140
  * the sequence bump takes its voice (a delete starts no replacement probe,
233
141
  * so nothing else would), the in-flight slot is released, and the old
234
142
  * transport alert goes with them.
235
143
  */
236
144
  function changed() {
237
- probeSeq.current++;
238
- setInFlight(null);
239
- setProbeError(null);
240
- // The VERDICT too: after a delete, “Connected” would otherwise keep
145
+ // The VERDICT goes too: after a delete, “Connected” would otherwise keep
241
146
  // describing a credential that no longer exists while the refetch is
242
147
  // still in flight.
243
- setProbed(null);
148
+ probe.forget();
149
+ // And the rest of the Library, which derives "needs setup" from a catalog
150
+ // loaded before this write: the card, the plugin banner and the sidebar
151
+ // count all keep the old answer otherwise, and the reader meets it the
152
+ // moment they press back. Announced HERE, on the landing, rather than
153
+ // after the probe — what the catalog believes about a stored key does not
154
+ // depend on whether the provider likes it, and making the reload wait for
155
+ // a round-trip nobody is watching only widens the stale window.
156
+ announceToolCredentialsChanged();
244
157
  onChanged();
245
158
  }
246
159
 
@@ -249,11 +162,10 @@ export function ToolConnectionSection({
249
162
  * the key it replaced, so drop it and test the new one straight away —
250
163
  * while the user still has it to hand, which is when a wrong key is
251
164
  * cheapest to fix. (The row calls `changed` too, which orphans the old
252
- * probe; the fresh `runCheck` claims the sequence for the new key.)
165
+ * probe; the fresh probe claims the sequence for the new key.)
253
166
  */
254
167
  function onSaved() {
255
- setProbed(null);
256
- void runCheck();
168
+ probe.probeSaved();
257
169
  }
258
170
 
259
171
  return (
@@ -275,15 +187,15 @@ export function ToolConnectionSection({
275
187
  {settled && (
276
188
  <Button
277
189
  variant="quiet"
278
- size="tiny"
190
+ size="sm"
279
191
  disabled={checking}
280
- onClick={() => void runCheck()}
192
+ onClick={() => void probe.run()}
281
193
  aria-label={`Test connection: ${tool.name}`}
282
194
  >
283
195
  {checking ? 'Testing…' : 'Test connection'}
284
196
  </Button>
285
197
  )}
286
- <Link to="/secrets" className={buttonClasses({ variant: 'quiet', size: 'tiny' })}>
198
+ <Link to="/secrets" className={buttonClasses({ variant: 'quiet', size: 'sm' })}>
287
199
  Open Secrets
288
200
  </Link>
289
201
  </div>
@@ -295,6 +207,17 @@ export function ToolConnectionSection({
295
207
  </Banner>
296
208
  )}
297
209
 
210
+ {/* Why the word above says "Unverified" — the manual defines no health
211
+ check, so there was nothing to call. A quiet LINE, not a banner: the
212
+ key is saved, nothing is broken and nobody has to act, but a word
213
+ that hides its reason has only moved the question. The tooltip alone
214
+ is not enough — it is unreachable on touch and to a screen reader. */}
215
+ {settled && verdict?.status === 'unverifiable' && (
216
+ <p className="mb-2.5 text-detail text-ink-muted" data-testid="tool-health-unverified">
217
+ {health.hint}
218
+ </p>
219
+ )}
220
+
298
221
  {setupUnfinished && (
299
222
  <Banner tone="wait" role="status" className="mb-2.5">
300
223
  {tool.canWrite && signInDeclared ? (
@@ -315,11 +238,11 @@ export function ToolConnectionSection({
315
238
  {kbDirName && !isMcpJsonServer && (
316
239
  <Button
317
240
  variant="quiet"
318
- size="tiny"
241
+ size="sm"
319
242
  className="mt-1.5"
320
- // `rawFile` steps past the WorkspaceItemGate: this URL is
321
- // the tool page's own canonical address, and the button
322
- // wants the raw editor behind it.
243
+ // `rawFile` asks the item route for the raw editor: this
244
+ // URL is the tool page's own canonical address, and the
245
+ // button wants the file behind it — still in this app.
323
246
  onClick={() =>
324
247
  navigate(kbFileUrl(DEFAULT_BRANCH, `${kbDirName}/${tool.path}`), {
325
248
  state: { rawFile: true },
@@ -339,28 +262,6 @@ export function ToolConnectionSection({
339
262
  </Banner>
340
263
  )}
341
264
 
342
- {/* Suppressed while the sign-in setup banner is up: that one names a
343
- cause, this one would only re-list its symptoms. */}
344
- {missing.length > 0 && !setupUnfinished && (
345
- <Banner tone="wait" role="status" className="mb-2.5">
346
- <div className="flex items-center gap-3">
347
- <span className="min-w-0 flex-1">
348
- <span className="font-semibold">
349
- {missing.length === 1
350
- ? 'This tool is not connected yet.'
351
- : `This tool needs ${missing.length} things before it works.`}
352
- </span>{' '}
353
- <span>
354
- {missing
355
- .map(({ v, status }) => `${v.label ?? v.name}: ${status.text}`)
356
- .join(' · ')}
357
- </span>
358
- </span>
359
- {bannerAction && <span className="shrink-0">{bannerAction}</span>}
360
- </div>
361
- </Banner>
362
- )}
363
-
364
265
  {/* The one health state that needs a person: the provider tested this
365
266
  credential and refused it. Everything is configured, so no other
366
267
  banner covers it, and the row below cannot know — only a real call
@@ -389,7 +290,7 @@ export function ToolConnectionSection({
389
290
  canWrite={tool.canWrite}
390
291
  setupKind={setupKind}
391
292
  returnTo={pathForTool(tool.slug)}
392
- editSignal={edit.name === variable.name ? edit.n : undefined}
293
+ unset={unset.has(variable.name)}
393
294
  onChanged={changed}
394
295
  // Test the moment a key is entered — while the user still has it
395
296
  // to hand, which is when a typo is cheapest to fix. Waiting for