@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,357 @@
1
+ import { useEffect, useState } from 'react';
2
+ import { ExternalLink } from 'lucide-react';
3
+ import { Banner } from '../../../shared/components';
4
+ import { fetchFileAccess } from '../../access/api';
5
+ import { FilePaneCard } from '../../workspace/components/FilePaneCard';
6
+ import {
7
+ CanDownloadContext,
8
+ DownloadFileButton,
9
+ } from '../../workspace/components/renderers/DownloadFileButton';
10
+ import {
11
+ RendererWorkspaceContext,
12
+ getFileRenderer,
13
+ getRendererLayout,
14
+ } from '../../workspace/components/renderers';
15
+ import { kbFileUrl } from '../../workspace/routing/kb-routes';
16
+ import { getOrCreateWorkspace } from '../../workspace/services/workspace.api';
17
+
18
+ /**
19
+ * A document or image shown with the FILE PAGE's viewer, read from a named
20
+ * branch's workspace.
21
+ *
22
+ * A change request that adds a pdf, a deck or a screenshot used to reach its
23
+ * owner as one sentence — "there is no text to compare" — and the owner was
24
+ * asked to approve bytes nobody had seen. Every one of those formats already
25
+ * has a viewer on the file page, and a viewer only needs a workspace id and a
26
+ * path; a branch IS a workspace here. So the pane mounts the same renderer,
27
+ * pointed at the request's branch, and the reader decides on the actual
28
+ * document.
29
+ *
30
+ * Read-only throughout: no save path, no lock, no edit mode. The bytes belong
31
+ * to someone else's branch and the only verbs over them are the dialog's own
32
+ * Apply and Decline.
33
+ */
34
+
35
+ /** The branch workspace this pane reads from, once it has bootstrapped. */
36
+ interface BranchWorkspace {
37
+ id: string;
38
+ kbDirName: string;
39
+ }
40
+
41
+ /**
42
+ * Bootstrap (or join) the shared workspace for `branch`.
43
+ *
44
+ * The same call `readFileOnBranch` makes for the text diff — going through
45
+ * the endpoint rather than deriving `encodeURIComponent(branch)` client-side
46
+ * is what forces the backend to clone a branch nobody has opened yet, which
47
+ * for a change request's branch is the common case.
48
+ */
49
+ function useBranchWorkspace(branch: string): { workspace: BranchWorkspace | null; failed: boolean } {
50
+ /**
51
+ * The answer carries the branch it is an answer FOR, so switching files (or
52
+ * panes) needs no synchronous reset in the effect — the read below simply
53
+ * doesn't recognise the previous branch's answer. Clearing state in the
54
+ * effect body would cost a cascading render on every switch, and for one
55
+ * render would show the OLD branch's workspace under the NEW branch's file.
56
+ */
57
+ const [state, setState] = useState<{
58
+ branch: string;
59
+ workspace: BranchWorkspace | null;
60
+ failed: boolean;
61
+ } | null>(null);
62
+
63
+ useEffect(() => {
64
+ let cancelled = false;
65
+ getOrCreateWorkspace(branch)
66
+ .then(({ workspace }) => {
67
+ if (cancelled) return;
68
+ setState({
69
+ branch,
70
+ workspace: { id: workspace.id, kbDirName: workspace.kbDirName },
71
+ failed: false,
72
+ });
73
+ })
74
+ .catch(() => {
75
+ if (!cancelled) setState({ branch, workspace: null, failed: true });
76
+ });
77
+ return () => {
78
+ cancelled = true;
79
+ };
80
+ }, [branch]);
81
+
82
+ if (state === null || state.branch !== branch) return { workspace: null, failed: false };
83
+ return { workspace: state.workspace, failed: state.failed };
84
+ }
85
+
86
+ /** The read/download verdicts for one path on one branch. */
87
+ interface BranchFileAccess {
88
+ /** `null` while the lookup is in flight. */
89
+ canRead: boolean | null;
90
+ canDownload: boolean | null;
91
+ }
92
+
93
+ /**
94
+ * The same access question the file page asks, against the branch being read.
95
+ *
96
+ * The raw endpoint is the authoritative gate — it 403s a path the caller may
97
+ * not read, on any workspace — but a viewer meeting that 403 says "Failed to
98
+ * load PDF (HTTP 403)", or (the image viewer) says nothing at all and spins.
99
+ * Asking first is what lets the pane give the refusal the file page gives.
100
+ *
101
+ * Default-ALLOW when the lookup itself fails, matching `useFileAccess`: a
102
+ * transient API failure must not manufacture a refusal, and the bytes are
103
+ * still gated where it counts. What that costs is a viewer's own error rather
104
+ * than this pane's refusal — so every viewer mounted here has to HAVE one.
105
+ * `ImageRenderer` did not (it sat on "Loading image…" for a rejected read)
106
+ * and now names the status, which is the only path that could end in a
107
+ * permanent spinner.
108
+ */
109
+ function useBranchFileAccess(
110
+ workspaceId: string | null,
111
+ repoRelativePath: string,
112
+ ): BranchFileAccess {
113
+ /** Keyed by what was asked, for the reason `useBranchWorkspace` is. */
114
+ const key = `${workspaceId ?? ''}::${repoRelativePath}`;
115
+ const [answer, setAnswer] = useState<{ key: string; access: BranchFileAccess } | null>(null);
116
+
117
+ useEffect(() => {
118
+ if (!workspaceId) return;
119
+ let cancelled = false;
120
+ fetchFileAccess(workspaceId, repoRelativePath)
121
+ .then((res) => {
122
+ if (!cancelled) {
123
+ setAnswer({ key, access: { canRead: res.canRead, canDownload: res.canDownload } });
124
+ }
125
+ })
126
+ .catch(() => {
127
+ // Default-ALLOW, and NOT a third "the lookup failed" state: see the
128
+ // note above. What makes it safe is that the viewer this then mounts
129
+ // reports its own rejected read — the pane hands over to the raw
130
+ // endpoint's answer rather than claiming the read succeeded. Every
131
+ // viewer here says so out loud (`ImageRenderer` was the last one that
132
+ // did not, and now names the status); a viewer that swallowed a 403
133
+ // would strand this path on a spinner.
134
+ //
135
+ // `canDownload: null` — unknown, so the button stays clickable and the
136
+ // backend keeps the last word on it.
137
+ if (!cancelled) setAnswer({ key, access: { canRead: true, canDownload: null } });
138
+ });
139
+ return () => {
140
+ cancelled = true;
141
+ };
142
+ }, [workspaceId, repoRelativePath, key]);
143
+
144
+ if (answer === null || answer.key !== key) return { canRead: null, canDownload: null };
145
+ return answer.access;
146
+ }
147
+
148
+ /**
149
+ * The refusal, worded as `FileRoute` words it — the same sentence a reader
150
+ * gets for the same file on the file page, because it IS the same answer.
151
+ */
152
+ function AccessRefused({ repoRelativePath }: { repoRelativePath: string }) {
153
+ const name = repoRelativePath.slice(repoRelativePath.lastIndexOf('/') + 1);
154
+ return (
155
+ <div className="py-6">
156
+ <p className="pb-2 text-ui font-medium text-ink">You don't have access to this file</p>
157
+ <Banner role="alert" tone="danger">
158
+ <span className="font-mono">{name}</span> is restricted. Ask an owner to grant you read
159
+ access.
160
+ </Banner>
161
+ </div>
162
+ );
163
+ }
164
+
165
+ /**
166
+ * A read-only save handler for a pane that has no save. Every renderer here
167
+ * is mounted `readOnly`, and the view-only viewers (pdf, images, decks,
168
+ * workbooks, mail) have no editing surface to reach it from at all — so this
169
+ * refusing rather than silently resolving keeps the impossible case honest.
170
+ */
171
+ const NO_SAVE = (): Promise<void> =>
172
+ Promise.reject(new Error('A change request preview is read-only.'));
173
+
174
+ export interface BranchFilePreviewProps {
175
+ /** The branch whose bytes to show — the request's branch, or its target. */
176
+ branch: string;
177
+ /** Repo-relative path (the dialog's own currency), no `kbDirName` prefix. */
178
+ repoRelativePath: string;
179
+ /** What this pane is showing. */
180
+ label: 'Proposed version' | 'Current version';
181
+ /**
182
+ * The branch to open the CURRENT version on, for a file the request
183
+ * CHANGES. Null for an added file (there is no current version), for one the
184
+ * request doesn't touch (this pane already IS the current version), and for
185
+ * a rename whose old path the request never named (nothing to point at).
186
+ */
187
+ currentVersionBranch?: string | null;
188
+ /**
189
+ * WHERE the current version is, on `currentVersionBranch` — which for a
190
+ * RENAMED file is not `repoRelativePath`. The proposed path is the new
191
+ * name; the target branch has the file under the old one, and linking the
192
+ * new name there opens a 404. Defaults to the path being previewed.
193
+ */
194
+ currentVersionPath?: string;
195
+ }
196
+
197
+ /**
198
+ * The viewer pane: a label, the "open the current version" way out, and the
199
+ * file page's renderer for this extension bound to `branch`'s workspace.
200
+ */
201
+ export function BranchFilePreview({
202
+ branch,
203
+ repoRelativePath,
204
+ label,
205
+ currentVersionBranch = null,
206
+ currentVersionPath,
207
+ }: BranchFilePreviewProps) {
208
+ const { workspace, failed } = useBranchWorkspace(branch);
209
+ const access = useBranchFileAccess(workspace?.id ?? null, repoRelativePath);
210
+
211
+ const Renderer = getFileRenderer(repoRelativePath);
212
+ const layout = getRendererLayout(repoRelativePath);
213
+ const fileName = repoRelativePath.slice(repoRelativePath.lastIndexOf('/') + 1);
214
+
215
+ const header = (
216
+ <div className="flex flex-wrap items-center gap-3 pb-2">
217
+ <span className="text-meta font-medium text-ink-muted">{label}</span>
218
+ {currentVersionBranch && workspace && (
219
+ // A new tab, not a navigation: leaving the dialog mid-review would
220
+ // lose the review context, and the two versions are meant to be read
221
+ // side by side.
222
+ <a
223
+ href={kbFileUrl(
224
+ currentVersionBranch,
225
+ `${workspace.kbDirName}/${currentVersionPath ?? repoRelativePath}`,
226
+ )}
227
+ target="_blank"
228
+ rel="noopener noreferrer"
229
+ className="inline-flex items-center gap-1 text-meta text-ink-faint transition-colors hover:text-ink"
230
+ >
231
+ Open the current version
232
+ <ExternalLink size={11} aria-hidden />
233
+ </a>
234
+ )}
235
+ </div>
236
+ );
237
+
238
+ let body;
239
+ if (failed) {
240
+ body = (
241
+ <p className="py-6 text-center text-detail text-ink-faint">
242
+ That branch couldn't be opened, so this file can't be shown here.
243
+ </p>
244
+ );
245
+ } else if (!workspace || access.canRead === null) {
246
+ body = <p className="py-6 text-center text-detail text-ink-faint">Loading…</p>;
247
+ } else if (access.canRead === false) {
248
+ body = <AccessRefused repoRelativePath={repoRelativePath} />;
249
+ } else {
250
+ const viewer = (
251
+ <RendererWorkspaceContext.Provider value={{ workspaceId: workspace.id }}>
252
+ <CanDownloadContext.Provider value={access.canDownload}>
253
+ {/* Not a component created during render: `getFileRenderer` returns
254
+ one of a fixed set of module-level components (or a lazy wrapper
255
+ built once at module load), keyed by the path's extension — the
256
+ same lookup, with the same identity, `FileViewer` mounts. */}
257
+ {/* eslint-disable-next-line react-hooks/static-components */}
258
+ <Renderer
259
+ // The viewers here fetch their own bytes; the text buffer is
260
+ // never read, and there is nothing to seed it from on a branch
261
+ // the dialog deliberately does not check out.
262
+ //
263
+ // Which also means the FRESHNESS of those bytes is the viewer's
264
+ // own business, and the branch under review is one its author may
265
+ // still be pushing to. `ImageRenderer` folds this workspace's
266
+ // image revision into its URL (`useImageRevision`), so a replaced
267
+ // picture reaches this pane while it stays open. A document viewer
268
+ // has no equivalent signal to fold in — `file-changed` carries a
269
+ // path, and only the image resolvers count it — so a pdf or a deck
270
+ // replaced mid-review is still read at the revision the pane
271
+ // opened on.
272
+ content=""
273
+ savedContent=""
274
+ filePath={`${workspace.kbDirName}/${repoRelativePath}`}
275
+ onSave={NO_SAVE}
276
+ readOnly
277
+ />
278
+ </CanDownloadContext.Provider>
279
+ </RendererWorkspaceContext.Provider>
280
+ );
281
+ body =
282
+ layout === 'prose' ? (
283
+ // A document: the same edged frame, with the same mono filename bar,
284
+ // the file page puts around prose.
285
+ <FilePaneCard file={fileName}>{viewer}</FilePaneCard>
286
+ ) : (
287
+ // A viewport (pdf, image, workbook): it owns its own scrolling and
288
+ // needs a DEFINITE height to do it — an `h-full` child of an
289
+ // auto-height column collapses to 0px. `h-full` takes the pane's
290
+ // height when the pane has one; the floor keeps a short dialog from
291
+ // squeezing a PDF into a sliver.
292
+ <div data-testid="cr-preview-viewport" className="h-full min-h-[60vh]">
293
+ {viewer}
294
+ </div>
295
+ );
296
+ }
297
+
298
+ return (
299
+ <div className="flex h-full min-h-0 flex-col">
300
+ {header}
301
+ <div className="min-h-0 flex-1">{body}</div>
302
+ </div>
303
+ );
304
+ }
305
+
306
+ export interface BranchFileDownloadProps {
307
+ branch: string;
308
+ repoRelativePath: string;
309
+ label: string;
310
+ }
311
+
312
+ /**
313
+ * The way out for a format no viewer here renders — a legacy `.doc`, an
314
+ * OpenDocument file, a `.zip`, an unknown binary. The dialog keeps its note
315
+ * ("there is no text to compare") and this hands over the bytes it is talking
316
+ * about, from the request's branch rather than the checked-out tree.
317
+ *
318
+ * Through the SAME access question as the viewer pane, and for the same
319
+ * reason: a file the reader may not have is a file the reader may not have in
320
+ * either shape. Without the lookup this offered a live button that answered a
321
+ * click with a bare "Download failed (HTTP 403)" — the raw endpoint's gate
322
+ * holding, but nothing the file page would ever say. A refused read gets
323
+ * `FileRoute`'s wording instead, and a read-but-not-download verdict leaves
324
+ * the button disabled with its reason, exactly as the file page does.
325
+ */
326
+ export function BranchFileDownload({ branch, repoRelativePath, label }: BranchFileDownloadProps) {
327
+ const { workspace, failed } = useBranchWorkspace(branch);
328
+ const access = useBranchFileAccess(workspace?.id ?? null, repoRelativePath);
329
+ // A failed bootstrap has to be SAID. Folding it into the loading case
330
+ // rendered nothing at all, which under a note that promises the bytes reads
331
+ // as a missing button rather than as the branch problem it is.
332
+ if (failed) {
333
+ return (
334
+ <p className="text-center text-detail text-ink-faint">
335
+ That branch couldn't be opened, so the file can't be downloaded here.
336
+ </p>
337
+ );
338
+ }
339
+ // Nothing yet — and no button either. An enabled Download that turns out to
340
+ // be a refusal is worse than one that arrives a moment later.
341
+ if (!workspace || access.canRead === null) return null;
342
+ if (access.canRead === false) return <AccessRefused repoRelativePath={repoRelativePath} />;
343
+ return (
344
+ <RendererWorkspaceContext.Provider value={{ workspaceId: workspace.id }}>
345
+ {/* `canDownload` false disables the button and says why; null keeps it
346
+ optimistic, with the backend as the gate — `DownloadFileButton`'s own
347
+ rule, unchanged, and the same one `FileViewer` feeds it. */}
348
+ <CanDownloadContext.Provider value={access.canDownload}>
349
+ <DownloadFileButton
350
+ filePath={`${workspace.kbDirName}/${repoRelativePath}`}
351
+ size="sm"
352
+ label={label}
353
+ />
354
+ </CanDownloadContext.Provider>
355
+ </RendererWorkspaceContext.Provider>
356
+ );
357
+ }
@@ -3,6 +3,7 @@ import '../change-requests.css';
3
3
  import { Button, Surface } from '../../../shared/components';
4
4
  import { cn } from '../../../lib/utils';
5
5
  import { collapseUnchanged, type DiffLine } from '../utils/diff';
6
+ import { waitingOnViewerLabel } from '../utils/author';
6
7
  import { ConflictHelp } from './ConflictHelp';
7
8
 
8
9
  export interface ChangeBoxProps {
@@ -14,7 +15,11 @@ export interface ChangeBoxProps {
14
15
  when: string;
15
16
  /** The caller wrote this one. */
16
17
  mine: boolean;
17
- /** The caller decides this one (owns the skill). */
18
+ /**
19
+ * The caller decides this one: they can write the file. That is not
20
+ * ownership — a writer decides without being named in an `owner:` grant —
21
+ * so the box never tells them they own it.
22
+ */
18
23
  canDecide: boolean;
19
24
  /** The proposal diffed against the file as it stands NOW; null while loading. */
20
25
  diff: DiffLine[] | null;
@@ -24,6 +29,12 @@ export interface ChangeBoxProps {
24
29
  * working — approving still applies the whole request.
25
30
  */
26
31
  binary?: boolean;
32
+ /**
33
+ * One of the two file reads failed, so there is no comparison to show and
34
+ * none is coming. Said plainly rather than left on "Loading the change…",
35
+ * and never rendered as an empty or whole-file diff.
36
+ */
37
+ unreadable?: boolean;
27
38
  /**
28
39
  * This file already reads the way the proposal wants it to — someone landed
29
40
  * the same edit first, or the author reverted it. There is nothing here to
@@ -50,6 +61,12 @@ export interface ChangeBoxProps {
50
61
  refusal?: string | null;
51
62
  /** Who the decision is waiting on, for the non-owner's footer. */
52
63
  owner?: string;
64
+ /**
65
+ * For a viewer who can decide: how many OTHER approvers the proposal is also
66
+ * waiting on. Given, the footer reads "Waiting on you" / "Waiting on you and
67
+ * N others" rather than the generic "You can decide this.".
68
+ */
69
+ othersPending?: number;
53
70
  busy?: boolean;
54
71
  /**
55
72
  * What the apply is doing right now, so the label names the step instead of
@@ -94,11 +111,13 @@ export function ChangeBox({
94
111
  canDecide,
95
112
  diff,
96
113
  binary = false,
114
+ unreadable = false,
97
115
  upToDate = false,
98
116
  blocked = false,
99
117
  conflictPrompt = null,
100
118
  refusal = null,
101
119
  owner,
120
+ othersPending,
102
121
  busy,
103
122
  phase = 'idle',
104
123
  onApprove,
@@ -134,6 +153,10 @@ export function ChangeBox({
134
153
  A binary file (an image, a document…). There is no text to compare. Read the whole
135
154
  change to decide.
136
155
  </p>
156
+ ) : unreadable ? (
157
+ <p className="px-3.5 py-4 text-center text-detail text-ink-faint">
158
+ Couldn't read this change. Read the whole change to decide.
159
+ </p>
137
160
  ) : diff === null ? (
138
161
  <p className="px-3.5 py-4 text-center text-detail text-ink-faint">Loading the change…</p>
139
162
  ) : (
@@ -193,7 +216,11 @@ export function ChangeBox({
193
216
  </span>
194
217
  {!busy && (
195
218
  <span className="text-meta text-ink-faint">
196
- {canDecide ? 'You decide. You own this.' : `Waiting on ${owner ?? 'the owner'}`}
219
+ {canDecide
220
+ ? othersPending === undefined
221
+ ? 'You can decide this.'
222
+ : waitingOnViewerLabel(othersPending)
223
+ : `Waiting on ${owner ?? 'the owner'}`}
197
224
  </span>
198
225
  )}
199
226
  {/* What the server said, verbatim. The gate names the files and the
@@ -214,6 +241,8 @@ export function ChangeBox({
214
241
  Read the whole change
215
242
  </Button>
216
243
  )}
244
+ {/* Authorship and approval rights are independent: an approver who
245
+ wrote the proposal gets Withdraw AND the verdicts. */}
217
246
  {mine && onWithdraw && (
218
247
  <Button variant="quiet" size="tiny" onClick={onWithdraw} disabled={busy}>
219
248
  Withdraw