@bevel-software/platform-core-frontend 0.32.0 → 0.34.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 (207) hide show
  1. package/package.json +2 -2
  2. package/src/core/CoreAppShell.tsx +1 -1
  3. package/src/lib/__tests__/api.test.ts +28 -1
  4. package/src/lib/api.ts +4 -2
  5. package/src/modules/access/__tests__/ManageAccessDialog.add-row-picking.test.tsx +53 -1
  6. package/src/modules/access/api.ts +4 -5
  7. package/src/modules/access/components/ManageAccessDialog.tsx +11 -12
  8. package/src/modules/access/hooks/useAccessRequests.ts +1 -1
  9. package/src/modules/access/hooks/useFileAccess.ts +1 -1
  10. package/src/modules/access/index.ts +11 -0
  11. package/src/modules/access/requests.api.ts +1 -1
  12. package/src/modules/admin/__tests__/DirectoryGroupsPage.test.tsx +51 -0
  13. package/src/modules/admin/components/AddMemberInput.tsx +1 -1
  14. package/src/modules/admin/components/DirectoryGroupsPage.tsx +42 -5
  15. package/src/modules/admin/components/UserAccountsPage.tsx +3 -3
  16. package/src/modules/admin/index.ts +7 -0
  17. package/src/modules/admin/services/groups.api.ts +11 -1
  18. package/src/modules/admin/state/admin.context.tsx +1 -1
  19. package/src/modules/agents/__tests__/useConnectAsChoice.test.ts +56 -0
  20. package/src/modules/agents/components/ConnectAsChoice.tsx +81 -0
  21. package/src/modules/agents/connect-as.ts +15 -0
  22. package/src/modules/agents/index.ts +5 -0
  23. package/src/modules/agents/services/agent-choices.api.ts +39 -0
  24. package/src/modules/agents/useConnectAsChoice.ts +66 -0
  25. package/src/modules/audit/__tests__/AuditLogPage.test.tsx +13 -0
  26. package/src/modules/audit/components/AuditEventsPanel.tsx +1 -1
  27. package/src/modules/audit/components/AuditLogPage.tsx +11 -2
  28. package/src/modules/audit/services/audit.api.ts +5 -0
  29. package/src/modules/auth/__tests__/AccountPage.test.tsx +21 -0
  30. package/src/modules/auth/__tests__/account.api.test.ts +69 -0
  31. package/src/modules/auth/components/AccountPage.tsx +8 -2
  32. package/src/modules/auth/index.ts +12 -0
  33. package/src/modules/auth/services/account.api.ts +18 -2
  34. package/src/modules/change-requests/__tests__/ChangeRequestDialog.access-rules.test.tsx +0 -1
  35. package/src/modules/change-requests/__tests__/ChangeRequestDialog.binary.test.tsx +0 -1
  36. package/src/modules/change-requests/__tests__/ChangeRequestDialog.brings-itself-up-to-date.test.tsx +0 -1
  37. package/src/modules/change-requests/__tests__/ChangeRequestDialog.edit.test.tsx +166 -0
  38. package/src/modules/change-requests/__tests__/ChangeRequestDialog.fork-point.test.tsx +0 -1
  39. package/src/modules/change-requests/__tests__/ChangeRequestDialog.initial-file.test.tsx +0 -1
  40. package/src/modules/change-requests/__tests__/ChangeRequestDialog.moved.test.tsx +0 -1
  41. package/src/modules/change-requests/__tests__/ChangeRequestDialog.sync-banner.test.tsx +0 -1
  42. package/src/modules/change-requests/__tests__/ChangeRequestDialog.test.tsx +0 -2
  43. package/src/modules/change-requests/__tests__/ChangeRequestDialog.unreadable.test.tsx +0 -1
  44. package/src/modules/change-requests/__tests__/apply-outcome-for-every-viewer.test.tsx +0 -1
  45. package/src/modules/change-requests/components/BranchFilePreview.tsx +4 -12
  46. package/src/modules/change-requests/components/ChangeRequestDialog.tsx +138 -30
  47. package/src/modules/change-requests/components/ChangeRequestLink.tsx +2 -3
  48. package/src/modules/change-requests/components/CrFileTree.tsx +1 -1
  49. package/src/modules/change-requests/components/FileChangeBoxes.tsx +2 -3
  50. package/src/modules/change-requests/hooks/useApplyChangeRequest.ts +3 -5
  51. package/src/modules/change-requests/hooks/useCrFileDiffs.ts +1 -1
  52. package/src/modules/change-requests/index.ts +14 -0
  53. package/src/modules/change-requests/services/change-requests.api.ts +2 -2
  54. package/src/modules/change-requests/services/denied-file.api.ts +2 -2
  55. package/src/modules/change-requests/services/propose.api.ts +3 -4
  56. package/src/modules/change-requests/utils/diff.ts +1 -1
  57. package/src/modules/change-requests/utils/readFailure.ts +1 -1
  58. package/src/modules/embed/__tests__/EmbedView.test.tsx +19 -2
  59. package/src/modules/embed/components/EmbedLinkPage.tsx +1 -2
  60. package/src/modules/git/__tests__/BranchSwitcher.test.tsx +0 -14
  61. package/src/modules/git/__tests__/git.api.test.ts +2 -2
  62. package/src/modules/git/components/BranchSwitcher.tsx +3 -4
  63. package/src/modules/git/components/FileHistoryPanel.tsx +2 -2
  64. package/src/modules/git/components/GitSyncFailedBanner.tsx +2 -4
  65. package/src/modules/git/components/HistoryVersionPreview.tsx +4 -15
  66. package/src/modules/git/components/PullNeededBanner.tsx +1 -1
  67. package/src/modules/git/hooks/__tests__/useGitState.deleteBranch.test.tsx +1 -1
  68. package/src/modules/git/hooks/useAutoPullUpdates.ts +1 -1
  69. package/src/modules/git/index.ts +11 -0
  70. package/src/modules/layout/components/MobileChatLayout.tsx +1 -1
  71. package/src/modules/layout/index.ts +9 -0
  72. package/src/modules/library/__tests__/SkillPage.test.tsx +268 -24
  73. package/src/modules/library/__tests__/propose-change.test.ts +75 -0
  74. package/src/modules/library/components/AddToPluginDialog.tsx +1 -1
  75. package/src/modules/library/components/ChangeRequestDock.tsx +1 -1
  76. package/src/modules/library/components/LibraryLayout.tsx +2 -2
  77. package/src/modules/library/components/LibraryPage.tsx +3 -3
  78. package/src/modules/library/components/ManagedPluginRequests.tsx +1 -1
  79. package/src/modules/library/components/NewSkillPanel.tsx +2 -2
  80. package/src/modules/library/components/PersonalAddDialog.tsx +1 -1
  81. package/src/modules/library/components/PersonalPluginPage.tsx +1 -1
  82. package/src/modules/library/components/PluginExtras.tsx +1 -4
  83. package/src/modules/library/components/PluginPage.tsx +1 -1
  84. package/src/modules/library/components/PluginRows.tsx +1 -1
  85. package/src/modules/library/components/SkillsTree.tsx +1 -4
  86. package/src/modules/library/components/plugin-page-parts.tsx +1 -1
  87. package/src/modules/library/components/skill-page/SkillFilePane.tsx +74 -14
  88. package/src/modules/library/components/skill-page/SkillPage.tsx +80 -47
  89. package/src/modules/library/components/tool-page/ToolConnectionSection.tsx +2 -4
  90. package/src/modules/library/components/tool-page/ToolVarRow.tsx +2 -2
  91. package/src/modules/library/hooks/useJoinRequests.ts +1 -1
  92. package/src/modules/library/hooks/useLibraryData.ts +3 -3
  93. package/src/modules/library/hooks/useToolPage.ts +1 -1
  94. package/src/modules/library/hooks/useToolSource.ts +1 -1
  95. package/src/modules/library/index.ts +12 -0
  96. package/src/modules/library/routes/LibraryRoutes.tsx +1 -1
  97. package/src/modules/library/routes/WorkspaceItemRoute.tsx +1 -3
  98. package/src/modules/library/routes/library-paths.ts +1 -1
  99. package/src/modules/library/services/library.api.ts +10 -8
  100. package/src/modules/library/services/plugins.api.ts +1 -1
  101. package/src/modules/library/services/teams.api.ts +1 -1
  102. package/src/modules/library/utils/status.ts +2 -2
  103. package/src/modules/onboarding/components/ConnectAgentPill.tsx +1 -1
  104. package/src/modules/onboarding/components/CreatorWelcomePage.tsx +2 -3
  105. package/src/modules/onboarding/components/GetStartedColumn.tsx +6 -13
  106. package/src/modules/onboarding/components/InviteButton.tsx +2 -2
  107. package/src/modules/onboarding/components/InviteDialog.tsx +4 -6
  108. package/src/modules/onboarding/components/RootLanding.tsx +2 -2
  109. package/src/modules/onboarding/components/StarterPackCard.tsx +1 -1
  110. package/src/modules/onboarding/components/WelcomePage.tsx +2 -5
  111. package/src/modules/onboarding/index.ts +10 -0
  112. package/src/modules/onboarding/paths.ts +1 -1
  113. package/src/modules/onboarding/state/agent-connection.ts +2 -2
  114. package/src/modules/onboarding/state/onboarding.ts +1 -1
  115. package/src/modules/onboarding/state/starter-packs.ts +1 -1
  116. package/src/modules/pr/components/OpenChangeRequestDialog.tsx +1 -1
  117. package/src/modules/pr/index.ts +14 -0
  118. package/src/modules/pr/services/pr-approvals.api.ts +1 -1
  119. package/src/modules/pr/services/pr-cancel.api.ts +1 -1
  120. package/src/modules/pr/services/pr-detail.api.ts +2 -2
  121. package/src/modules/pr/services/pr-edit.api.ts +22 -0
  122. package/src/modules/pr/services/pr-merge.api.ts +1 -1
  123. package/src/modules/pr/services/pr-open.api.ts +1 -1
  124. package/src/modules/review/components/DiffViewer.tsx +1 -1
  125. package/src/modules/review/components/MarkdownDiffViewer.tsx +24 -3
  126. package/src/modules/review/components/ReviewPanel.tsx +10 -5
  127. package/src/modules/review/components/__tests__/MarkdownDiffViewer.test.tsx +31 -0
  128. package/src/modules/review/state/ReviewProvider.tsx +2 -2
  129. package/src/modules/secrets-vault/components/ConnectToolsPage.tsx +79 -16
  130. package/src/modules/secrets-vault/components/__tests__/ConnectToolsPage.test.tsx +112 -2
  131. package/src/modules/secrets-vault/index.ts +6 -0
  132. package/src/modules/secrets-vault/services/connect.api.ts +20 -5
  133. package/src/modules/settings/components/DeploymentPage.tsx +2 -2
  134. package/src/modules/settings/components/SettingsLayout.tsx +2 -2
  135. package/src/modules/settings/index.ts +8 -0
  136. package/src/modules/setup/components/FirstRunStorage.tsx +1 -1
  137. package/src/modules/setup/index.ts +6 -0
  138. package/src/modules/toolbar/commands/actions.tsx +3 -3
  139. package/src/modules/toolbar/commands/useCommandActions.ts +5 -9
  140. package/src/modules/toolbar/components/AgentInstructionsCard.tsx +2 -2
  141. package/src/modules/toolbar/components/AppSwitcher.tsx +1 -2
  142. package/src/modules/toolbar/components/CoworkSetupSteps.tsx +1 -1
  143. package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +39 -5
  144. package/src/modules/toolbar/components/ProfileMenu.tsx +3 -3
  145. package/src/modules/toolbar/components/SearchPalette.tsx +4 -8
  146. package/src/modules/toolbar/components/Toolbar.tsx +2 -5
  147. package/src/modules/toolbar/components/__tests__/ExternalAgentAccessPage.test.tsx +91 -2
  148. package/src/modules/toolbar/index.ts +6 -0
  149. package/src/modules/toolbar/search/sources.ts +4 -7
  150. package/src/modules/toolbar/services/agent-instructions.api.ts +1 -1
  151. package/src/modules/toolbar/services/external-api-keys.api.ts +5 -2
  152. package/src/modules/tools/ToolsExplorerPage.tsx +217 -18
  153. package/src/modules/tools/__tests__/ToolsExplorerPage.read-only.test.tsx +220 -0
  154. package/src/modules/tools/tool-hints.api.ts +44 -0
  155. package/src/modules/workflow/index.ts +7 -0
  156. package/src/modules/workflow/state/ChangeRequestStaleBinder.tsx +1 -0
  157. package/src/modules/workflow/state/EventBusFocusBinder.tsx +1 -1
  158. package/src/modules/workspace/components/FileExplorer.tsx +35 -8
  159. package/src/modules/workspace/components/FilePaneCard.tsx +37 -12
  160. package/src/modules/workspace/components/FileRoute.tsx +10 -3
  161. package/src/modules/workspace/components/FileViewer.tsx +169 -25
  162. package/src/modules/workspace/components/FullScreenView.tsx +93 -0
  163. package/src/modules/workspace/components/KbFileRail.tsx +1 -1
  164. package/src/modules/workspace/components/KbPageHeader.tsx +9 -0
  165. package/src/modules/workspace/components/__tests__/FileExplorer.test.tsx +163 -0
  166. package/src/modules/workspace/components/__tests__/FileRoute.test.tsx +11 -0
  167. package/src/modules/workspace/components/__tests__/FileViewer.test.tsx +487 -3
  168. package/src/modules/workspace/components/readingCarry.ts +59 -0
  169. package/src/modules/workspace/components/renderers/HtmlRenderer.tsx +74 -180
  170. package/src/modules/workspace/components/renderers/KbAppLink.tsx +56 -0
  171. package/src/modules/workspace/components/renderers/KbMarkdownView.tsx +30 -10
  172. package/src/modules/workspace/components/renderers/MarkdownRenderer.tsx +37 -40
  173. package/src/modules/workspace/components/renderers/ToolRenderer.tsx +1 -1
  174. package/src/modules/workspace/components/renderers/__tests__/HtmlRenderer.links.test.tsx +185 -0
  175. package/src/modules/workspace/components/renderers/__tests__/HtmlRenderer.tools.test.tsx +168 -42
  176. package/src/modules/workspace/components/renderers/__tests__/MarkdownRenderer.sectionReclick.test.tsx +88 -0
  177. package/src/modules/workspace/components/renderers/__tests__/MarkdownRenderer.test.tsx +199 -29
  178. package/src/modules/workspace/components/renderers/__tests__/bridgeHarness.ts +57 -7
  179. package/src/modules/workspace/components/renderers/__tests__/htmlSandbox.test.ts +122 -4
  180. package/src/modules/workspace/components/renderers/__tests__/htmlToolBridge.test.ts +235 -1
  181. package/src/modules/workspace/components/renderers/__tests__/htmlViewsGuide.test.ts +29 -4
  182. package/src/modules/workspace/components/renderers/__tests__/liveDataReferencePage.test.ts +397 -0
  183. package/src/modules/workspace/components/renderers/__tests__/pageToolsHarness.ts +79 -0
  184. package/src/modules/workspace/components/renderers/__tests__/useHtmlToolBridge.test.tsx +316 -0
  185. package/src/modules/workspace/components/renderers/htmlSandbox.ts +123 -28
  186. package/src/modules/workspace/components/renderers/htmlToolBridge.ts +215 -25
  187. package/src/modules/workspace/components/renderers/index.ts +10 -0
  188. package/src/modules/workspace/components/renderers/kbMarkdownPipeline.tsx +35 -28
  189. package/src/modules/workspace/components/renderers/scrollToHeading.ts +35 -0
  190. package/src/modules/workspace/components/renderers/useHtmlToolBridge.tsx +253 -0
  191. package/src/modules/workspace/hooks/__tests__/useLinksOut.test.ts +6 -0
  192. package/src/modules/workspace/hooks/useFullScreenView.ts +52 -0
  193. package/src/modules/workspace/hooks/useImageRevision.ts +1 -1
  194. package/src/modules/workspace/hooks/useKnowledgeWriteTarget.ts +1 -1
  195. package/src/modules/workspace/hooks/useLastCommit.ts +1 -1
  196. package/src/modules/workspace/hooks/useLinksOut.ts +12 -6
  197. package/src/modules/workspace/hooks/useWorkspaceState.ts +4 -4
  198. package/src/modules/workspace/index.ts +50 -2
  199. package/src/modules/workspace/routing/__tests__/kb-routes.test.tsx +262 -25
  200. package/src/modules/workspace/routing/kb-routes.ts +222 -54
  201. package/src/modules/workspace/state/__tests__/applied-request-clears-pending.test.tsx +0 -1
  202. package/src/modules/workspace/state/open-change-requests.tsx +1 -1
  203. package/src/modules/workspace/utils/fileTree.ts +1 -1
  204. package/src/modules/workspace/utils/frameEscape.ts +15 -0
  205. package/src/modules/workspace/utils/treeConfirm.ts +1 -1
  206. package/src/shared/theme/measure.ts +7 -0
  207. package/src/modules/pr/services/pr-comments.api.ts +0 -45
@@ -4,7 +4,7 @@ import {
4
4
  IDLE_AUTO_UPDATE,
5
5
  type AutoUpdateState,
6
6
  } from '../state/auto-update.context';
7
- import type { WorkspaceContextValue } from '../../workspace/state/workspace.context';
7
+ import type { WorkspaceContextValue } from '../../workspace';
8
8
  import { sanitizeErrorText } from '../services/error-messages';
9
9
  import { pullFailureDetail } from '../services/pull-failure';
10
10
  import { PR_STALE_EVENT } from '../../../core/events';
@@ -16,3 +16,14 @@ export const GIT_MENU_ITEMS: readonly AdminMenuItem[] = [BRANCH_DELETE_CONFIRM_M
16
16
 
17
17
  /** The branch state a page reads (`useGit`), and the context a test provides it through. */
18
18
  export { GitContext, useGit, type GitContextValue } from './state/git.context';
19
+
20
+ /**
21
+ * The HTTP helpers git's own services are built on, for the modules whose
22
+ * services talk to the same API: the response reader that turns a refusal
23
+ * into a thrown `GitApiError` carrying the server's words and status.
24
+ */
25
+ export { GitApiError, handleApiResponse } from './services/git.api';
26
+ // Reached by other modules; exported here so they stop importing the files.
27
+ export { friendlyGitError, friendlyGitMessage } from './services/error-messages';
28
+ export { createBranch, deleteBranch } from './services/git.api';
29
+ export { getPullRequest } from './services/pr.api';
@@ -2,7 +2,7 @@ import { useCallback, useEffect, useMemo, type ReactNode } from 'react';
2
2
  import { useLocation, useMatch, useNavigate } from 'react-router-dom';
3
3
  import { X } from 'lucide-react';
4
4
  import { LayoutContext, type LayoutController } from '../state/layout.context';
5
- import { KB_ROUTE_PREFIX, kbFileUrl } from '../../workspace/routing/kb-routes';
5
+ import { kbFileUrl, KB_ROUTE_PREFIX } from '../../workspace';
6
6
  import { SlideOverlay } from './SlideOverlay';
7
7
  import { SidebarFrame } from './SidebarFrame';
8
8
  import {
@@ -0,0 +1,9 @@
1
+ /**
2
+ * What the layout module offers the other modules. A consumer outside the
3
+ * module imports from here, never from the files: they are the module's own
4
+ * layout and free to move. Export what another module needs; nothing more.
5
+ */
6
+ export { SETUP_COLUMN_HIDDEN_QUERY, TOOLBAR_STACK_QUERY } from './breakpoints';
7
+ export { useMediaQuery } from './hooks/useMediaQuery';
8
+ export { LayoutContext, useLayout } from './state/layout.context';
9
+ export { toggleSidebar, useSidebar } from './state/sidebar';
@@ -1,4 +1,5 @@
1
- import { describe, it, expect, vi, beforeEach } from 'vitest';
1
+ import { describe, it, expect, vi, beforeEach, afterEach, type MockInstance } from 'vitest';
2
+ import { useContext } from 'react';
2
3
  import { render, screen, fireEvent, waitFor, act, within } from '@testing-library/react';
3
4
  import { MemoryRouter, Route, Routes, useLocation } from 'react-router-dom';
4
5
  import {
@@ -33,7 +34,9 @@ const apiMock = vi.hoisted(() => ({
33
34
  * callback the pane only reaches through an HTML page's frame (Open in the
34
35
  * platform). The pane itself renders as it always does.
35
36
  */
36
- const paneProps = vi.hoisted(() => ({ last: null as null | { onOpenInPlatform?: () => void } }));
37
+ const paneProps = vi.hoisted(() => ({
38
+ last: null as null | { onOpenInPlatform?: () => void; linkHome?: { path: string; branch: string } },
39
+ }));
37
40
  vi.mock('../components/skill-page/SkillFilePane', async (importOriginal) => {
38
41
  const real = await importOriginal<typeof import('../components/skill-page/SkillFilePane')>();
39
42
  return {
@@ -87,24 +90,53 @@ vi.mock('../../pr/services/pr-detail.api', () => ({ fetchPrDetail: apiMock.fetch
87
90
  vi.mock('../../pr/services/pr-approvals.api', () => ({ approvePrFile: apiMock.approvePrFile }));
88
91
 
89
92
  // Keep the markdown pipeline (mermaid etc.) out of this test — the stub renders
90
- // the raw source so assertions can see the body text, plus two probes for the
91
- // wiring the page hands the view: a click on a percent-encoded link, and what
93
+ // the raw source so assertions can see the body text, plus probes for the
94
+ // wiring the page hands the view: a click on a link (another file, and a
95
+ // section of this one), where the page says such a link leads, and what
92
96
  // the image resolver answers for a picture beside the file.
93
97
  vi.mock('../../workspace/components/renderers/KbMarkdownView', () => ({
94
98
  KbMarkdownView: ({
95
99
  source,
96
100
  onOpenFile,
101
+ fileLinkTarget,
102
+ onOpenNodeId,
103
+ nodeIdLinkTarget,
97
104
  resolveImage,
98
105
  }: {
99
106
  source: string;
100
107
  onOpenFile: (href: string) => void;
108
+ fileLinkTarget?: (href: string) => unknown;
109
+ onOpenNodeId?: (id: string) => void;
110
+ nodeIdLinkTarget?: (id: string) => unknown;
101
111
  resolveImage?: (src: string) => unknown;
102
112
  }) => (
103
113
  <div data-testid="md-view">
104
114
  {source}
115
+ <h2 id="steps">Steps</h2>
105
116
  <button type="button" onClick={() => onOpenFile('Some%20File.md')}>
106
117
  link-probe
107
118
  </button>
119
+ <button type="button" onClick={() => onOpenFile('SKILL.md#steps')}>
120
+ section-probe
121
+ </button>
122
+ <button type="button" onClick={() => onOpenNodeId?.('newsletter#steps')}>
123
+ self-id-probe
124
+ </button>
125
+ <button type="button" onClick={() => onOpenNodeId?.('plan-node#goal')}>
126
+ other-id-probe
127
+ </button>
128
+ <span data-testid="other-id-target-probe">
129
+ {JSON.stringify(nodeIdLinkTarget ? nodeIdLinkTarget('plan-node#goal') : 'no-target')}
130
+ </span>
131
+ <span data-testid="self-id-target-probe">
132
+ {JSON.stringify(nodeIdLinkTarget ? nodeIdLinkTarget('newsletter#steps') : 'no-target')}
133
+ </span>
134
+ <span data-testid="link-target-probe">
135
+ {JSON.stringify(fileLinkTarget ? fileLinkTarget('Some%20File.md') : 'no-target')}
136
+ </span>
137
+ <span data-testid="section-target-probe">
138
+ {JSON.stringify(fileLinkTarget ? fileLinkTarget('SKILL.md#steps') : 'no-target')}
139
+ </span>
108
140
  <span data-testid="image-probe">
109
141
  {JSON.stringify(resolveImage ? resolveImage('./assets/shot.png') : 'no-resolver')}
110
142
  </span>
@@ -112,6 +144,25 @@ vi.mock('../../workspace/components/renderers/KbMarkdownView', () => ({
112
144
  ),
113
145
  }));
114
146
 
147
+ // The HTML renderer's frame and cards are its own suite's business; this
148
+ // stand-in shows what the page hands it — the page-tool bridge, and the path
149
+ // a page's calls would be recorded under.
150
+ // The context is read through the module's entry point at RENDER time: the
151
+ // entry point itself imports this renderer, so importing it inside the
152
+ // factory would wait on its own result.
153
+ vi.mock('../../workspace/components/renderers/HtmlRenderer', () => {
154
+ return {
155
+ HtmlRenderer: ({ filePath }: { filePath: string }) => {
156
+ const tools = useContext(PageToolsContext);
157
+ return (
158
+ <div data-testid="html-view" data-file={filePath}>
159
+ {tools ? tools.pagePath : 'no tools'}
160
+ </div>
161
+ );
162
+ },
163
+ };
164
+ });
165
+
115
166
  // The file bar's Edit-or-Propose decision asks the per-file access resolver.
116
167
  // Default here is the READER's answer (`canWrite: false`) so the proposing
117
168
  // suites below exercise the propose path; the Edit test flips it.
@@ -144,6 +195,7 @@ vi.mock('../state/library-data', () => ({
144
195
  }));
145
196
 
146
197
  import { SkillPage } from '../components/skill-page/SkillPage';
198
+ import { PageToolsContext } from '../../workspace';
147
199
  import { LibraryToastProvider } from '../state/toast';
148
200
  import { expectTitleRowSpansTheDocumentColumn } from './title-row-actions';
149
201
  import { PAGE_HEADER_TESTID } from '../../../shared/theme/header';
@@ -364,11 +416,13 @@ function harness(
364
416
  routerState?: Record<string, unknown>,
365
417
  pageProps?: { provisional?: boolean },
366
418
  workspaceValue: WorkspaceContextValue = workspace,
419
+ /** The fragment the page's address arrives with, e.g. `#steps`. */
420
+ hash = '',
367
421
  ) {
368
422
  return (
369
423
  <MemoryRouter
370
424
  initialEntries={[
371
- { pathname: '/skills-and-tools/skills/newsletter', state: routerState ?? null },
425
+ { pathname: '/skills-and-tools/skills/newsletter', hash, state: routerState ?? null },
372
426
  ]}
373
427
  >
374
428
  <AuthContext.Provider value={auth}>
@@ -409,6 +463,27 @@ allowed-tools: [slack_post_message]
409
463
  Collect the news and draft the letter.`;
410
464
  const RAW_BRANCH = RAW_MAIN.replace('draft the letter', 'ship the letter');
411
465
 
466
+ /**
467
+ * The node id of the file in the pane, as the backend answers it for the
468
+ * default branch (`resolve-path`): SKILL.md is the node `newsletter`, and
469
+ * no other file of the skill is a node. Every other request goes to the real
470
+ * fetch, as it always has.
471
+ */
472
+ let resolvePathSpy: MockInstance<typeof fetch>;
473
+ beforeEach(() => {
474
+ const realFetch = globalThis.fetch;
475
+ resolvePathSpy = vi.spyOn(globalThis, 'fetch').mockImplementation(async (input, init) => {
476
+ const url = String(input);
477
+ if (!url.includes('/resolve-path?')) return realFetch(input, init);
478
+ return url.includes(encodeURIComponent('knowledge-base/Skills/newsletter/SKILL.md'))
479
+ ? new Response(JSON.stringify({ id: 'newsletter' }), { status: 200 })
480
+ : new Response('{}', { status: 404 });
481
+ });
482
+ });
483
+ afterEach(() => {
484
+ resolvePathSpy.mockRestore();
485
+ });
486
+
412
487
  beforeEach(() => {
413
488
  apiMock.getSkill.mockReset().mockResolvedValue(skillDetail);
414
489
  apiMock.getSkillFile.mockReset().mockResolvedValue('watchlist:\n - topic: AI');
@@ -455,15 +530,47 @@ describe('SkillPage', () => {
455
530
  expect(await screen.findByTestId('navigated-to')).toHaveTextContent(/^\/skills-and-tools\/connect$/);
456
531
  });
457
532
 
458
- it("opens a page of the skill on the Knowledge file page, not back on this page, for Open in the platform", async () => {
459
- renderPage(true);
460
- await settled();
461
- expect(paneProps.last?.onOpenInPlatform).toBeTypeOf('function');
462
- act(() => paneProps.last!.onOpenInPlatform!());
463
- // The file's own address, with the state that makes the item route show
464
- // the file route rather than this skill page again.
465
- expect(await screen.findByTestId('navigated-to')).toHaveTextContent(/^\/workspace\/[^/]+\/knowledge-base\/Skills\/newsletter\/SKILL\.md$/);
466
- expect(screen.getByTestId('navigated-raw-file')).toHaveTextContent('true');
533
+ it("opens a page of the skill on the Knowledge file page in a new tab, not back on this page, for Open in the platform", async () => {
534
+ const open = vi
535
+ .spyOn(window, 'open')
536
+ .mockImplementation(() => ({ opener: window }) as unknown as Window);
537
+ try {
538
+ renderPage(true);
539
+ await settled();
540
+ expect(paneProps.last?.onOpenInPlatform).toBeTypeOf('function');
541
+ act(() => paneProps.last!.onOpenInPlatform!());
542
+ // The file page's own address on the default branch — the query is what
543
+ // makes the item route show the file route rather than this skill page
544
+ // again, since a new tab carries no router state.
545
+ expect(open).toHaveBeenCalledTimes(1);
546
+ expect(open).toHaveBeenCalledWith(
547
+ `/workspace/${encodeURIComponent(DEFAULT_BRANCH)}/knowledge-base/Skills/newsletter/SKILL.md?as=file`,
548
+ '_blank',
549
+ );
550
+ // And this tab stayed on the skill page.
551
+ expect(screen.queryByTestId('navigated-to')).toBeNull();
552
+ expect(screen.getByRole('heading', { name: 'newsletter' })).toBeInTheDocument();
553
+ } finally {
554
+ open.mockRestore();
555
+ }
556
+ });
557
+
558
+ /**
559
+ * The skill page is the platform: a page of the skill gets its tools here,
560
+ * as on its file page, and under the path the file page would record —
561
+ * the knowledge-base path, never the skill-relative tab name.
562
+ */
563
+ it.each([
564
+ ['the Skills/ root', 'Skills/newsletter'],
565
+ ['a plugin', 'Plugins/Engineering/skills/newsletter'],
566
+ ])('answers an HTML page’s tools under its knowledge-base path, for a skill under %s', async (_, path) => {
567
+ apiMock.getSkill.mockResolvedValue({ ...skillDetail, path, files: [`${path}/view.html`] });
568
+ apiMock.getSkillFile.mockResolvedValue('<script>bevel.tools.requireTools()</script>');
569
+ renderPage(false);
570
+ fireEvent.click(await screen.findByRole('tab', { name: /view\.html/ }));
571
+ const page = await screen.findByTestId('html-view');
572
+ expect(page).toHaveAttribute('data-file', 'view.html');
573
+ expect(page).toHaveTextContent(new RegExp(`^${path}/view\\.html$`));
467
574
  });
468
575
 
469
576
  it('loads the skill and shows its name, needed integrations and files', async () => {
@@ -1535,18 +1642,155 @@ describe('SkillPage: deciding on a change', () => {
1535
1642
  * is under test is what the PAGE hands the view.
1536
1643
  */
1537
1644
  describe('SkillPage: links and images in the file', () => {
1538
- it('opens a percent-encoded link as the file it names, on the default branch', async () => {
1539
- // The drift this fixes: the page used to resolve the href undecoded, so a
1540
- // link written `Some File.md` opened `Some%20File.md`, a file that is not there.
1645
+ const SOME_FILE_URL = `/workspace/${encodeURIComponent(DEFAULT_BRANCH)}/knowledge-base/Skills/newsletter/Some%20File.md`;
1646
+
1647
+ it('opens a link to another file in a new tab, as the file it names, on the default branch', async () => {
1648
+ // Decoded: the page used to resolve the href undecoded, so a link written
1649
+ // `Some File.md` opened `Some%20File.md`, a file that is not there. And a
1650
+ // NEW TAB: a link inside a file never navigates away from it. The git
1651
+ // status names another branch, so the default branch is the page's doing.
1652
+ const open = vi
1653
+ .spyOn(window, 'open')
1654
+ .mockImplementation(() => ({ opener: window }) as unknown as Window);
1655
+ try {
1656
+ renderPage(false, [], [], makeFakeBus(), undefined, undefined, undefined, {
1657
+ ...git,
1658
+ status: { ...git.status!, branch: 'alice/draft' },
1659
+ });
1660
+ await settled();
1661
+ fireEvent.click(screen.getByRole('button', { name: 'link-probe' }));
1662
+ expect(open).toHaveBeenCalledTimes(1);
1663
+ expect(open).toHaveBeenCalledWith(SOME_FILE_URL, '_blank');
1664
+ expect(screen.queryByTestId('navigated-to')).toBeNull();
1665
+ expect(screen.getByRole('heading', { name: 'newsletter' })).toBeInTheDocument();
1666
+ } finally {
1667
+ open.mockRestore();
1668
+ }
1669
+ });
1670
+
1671
+ it("hands the view each link's target: another file a new tab, this file's section this tab", async () => {
1541
1672
  renderPage(false);
1542
1673
  await settled();
1543
- fireEvent.click(screen.getByRole('button', { name: 'link-probe' }));
1544
- const target = await screen.findByTestId('navigated-to');
1545
- expect(target.textContent).toMatch(
1546
- new RegExp(
1547
- `^/workspace/${encodeURIComponent(DEFAULT_BRANCH)}/knowledge-base/Skills/newsletter/Some(%20| )File\\.md$`,
1548
- ),
1549
- );
1674
+ // The same answer the click follows, so the anchor's href, target and rel
1675
+ // agree with it (a middle-click goes where the click goes).
1676
+ expect(JSON.parse(screen.getByTestId('link-target-probe').textContent ?? 'null')).toEqual({
1677
+ href: SOME_FILE_URL,
1678
+ newTab: true,
1679
+ });
1680
+ expect(JSON.parse(screen.getByTestId('section-target-probe').textContent ?? 'null')).toEqual({
1681
+ href: '/skills-and-tools/skills/newsletter#steps',
1682
+ newTab: false,
1683
+ });
1684
+ });
1685
+
1686
+ it('follows a link to a section of the file on screen by scrolling to its heading, in this tab', async () => {
1687
+ const open = vi.spyOn(window, 'open');
1688
+ // The page's address has no heading scroll of its own, so the click is
1689
+ // what scrolls: the heading the fragment names comes into view, and the
1690
+ // page neither opens a tab nor navigates.
1691
+ const original = Element.prototype.scrollIntoView;
1692
+ const scrolled: string[] = [];
1693
+ Element.prototype.scrollIntoView = function (this: Element) {
1694
+ scrolled.push(this.id);
1695
+ };
1696
+ try {
1697
+ renderPage(false);
1698
+ await settled();
1699
+ fireEvent.click(screen.getByRole('button', { name: 'section-probe' }));
1700
+ expect(scrolled).toEqual(['steps']);
1701
+ expect(open).not.toHaveBeenCalled();
1702
+ expect(screen.queryByTestId('navigated-to')).toBeNull();
1703
+ expect(screen.getByRole('heading', { name: 'newsletter' })).toBeInTheDocument();
1704
+ } finally {
1705
+ open.mockRestore();
1706
+ Element.prototype.scrollIntoView = original;
1707
+ }
1708
+ });
1709
+
1710
+ it("follows an id-link to this skill's own heading by scrolling the pane, in this tab", async () => {
1711
+ const open = vi.spyOn(window, 'open').mockImplementation(() => ({ opener: window }) as unknown as Window);
1712
+ const original = Element.prototype.scrollIntoView;
1713
+ const scrolled: string[] = [];
1714
+ Element.prototype.scrollIntoView = function (this: Element) {
1715
+ scrolled.push(this.id);
1716
+ };
1717
+ try {
1718
+ renderPage(false);
1719
+ await settled();
1720
+ // The anchor's own answer agrees: a section of this page, not a new tab.
1721
+ await waitFor(() =>
1722
+ expect(JSON.parse(screen.getByTestId('self-id-target-probe').textContent ?? 'null')).toEqual({
1723
+ href: '/skills-and-tools/skills/newsletter#steps',
1724
+ newTab: false,
1725
+ }),
1726
+ );
1727
+ fireEvent.click(screen.getByRole('button', { name: 'self-id-probe' }));
1728
+ expect(scrolled).toEqual(['steps']);
1729
+ expect(open).not.toHaveBeenCalled();
1730
+ expect(screen.queryByTestId('navigated-to')).toBeNull();
1731
+ // Another node is still a new tab.
1732
+ fireEvent.click(screen.getByRole('button', { name: 'other-id-probe' }));
1733
+ expect(open).toHaveBeenCalledWith(`/workspace/${encodeURIComponent(DEFAULT_BRANCH)}/plan-node#goal`, '_blank');
1734
+ expect(screen.getByRole('heading', { name: 'newsletter' })).toBeInTheDocument();
1735
+ } finally {
1736
+ open.mockRestore();
1737
+ Element.prototype.scrollIntoView = original;
1738
+ }
1739
+ });
1740
+
1741
+ // The pane renders the default branch's file whatever is checked out, so
1742
+ // an id in it names a node there: with a draft checked out, the click and
1743
+ // the anchor both open the default branch's node, not the draft's.
1744
+ it("opens another node on the default branch, where the file was read, while a draft is checked out", async () => {
1745
+ const open = vi.spyOn(window, 'open').mockImplementation(() => ({ opener: window }) as unknown as Window);
1746
+ try {
1747
+ renderPage(false, [], [], makeFakeBus(), undefined, undefined, undefined, {
1748
+ ...git,
1749
+ status: { ...git.status!, branch: 'alice/draft' },
1750
+ });
1751
+ await settled();
1752
+ fireEvent.click(screen.getByRole('button', { name: 'other-id-probe' }));
1753
+ expect(open).toHaveBeenCalledTimes(1);
1754
+ expect(open).toHaveBeenCalledWith(`/workspace/${encodeURIComponent(DEFAULT_BRANCH)}/plan-node#goal`, '_blank');
1755
+ expect(JSON.parse(screen.getByTestId('other-id-target-probe').textContent ?? 'null')).toEqual({
1756
+ href: `/workspace/${encodeURIComponent(DEFAULT_BRANCH)}/plan-node#goal`,
1757
+ newTab: true,
1758
+ });
1759
+ expect(screen.queryByTestId('navigated-to')).toBeNull();
1760
+ } finally {
1761
+ open.mockRestore();
1762
+ }
1763
+ });
1764
+
1765
+ // A section link's own address — where a middle-click or a modified click
1766
+ // on it goes — is this page plus the heading. Arriving there scrolls to it,
1767
+ // so the new tab lands where the plain click does.
1768
+ it('scrolls to the heading its address names when it arrives with a fragment', async () => {
1769
+ const original = Element.prototype.scrollIntoView;
1770
+ const scrolled: string[] = [];
1771
+ Element.prototype.scrollIntoView = function (this: Element) {
1772
+ scrolled.push(this.id);
1773
+ };
1774
+ try {
1775
+ libraryMock.value = libraryValue(false, [], []);
1776
+ render(harness(makeFakeBus(), git, undefined, undefined, workspace, '#steps'));
1777
+ await settled();
1778
+ await waitFor(() => expect(scrolled).toContain('steps'));
1779
+ } finally {
1780
+ Element.prototype.scrollIntoView = original;
1781
+ }
1782
+ });
1783
+
1784
+ it("names the file's real home for an HTML page's links: its workspace path, on the default branch", async () => {
1785
+ renderPage(false, [], [], makeFakeBus(), undefined, undefined, undefined, {
1786
+ ...git,
1787
+ status: { ...git.status!, branch: 'alice/draft' },
1788
+ });
1789
+ await settled();
1790
+ expect(paneProps.last?.linkHome).toEqual({
1791
+ path: 'knowledge-base/Skills/newsletter/SKILL.md',
1792
+ branch: DEFAULT_BRANCH,
1793
+ });
1550
1794
  });
1551
1795
 
1552
1796
  it("serves a relative image from the default branch's workspace, under the skill folder", async () => {
@@ -0,0 +1,75 @@
1
+ import { describe, it, expect, vi, beforeEach } from 'vitest';
2
+ import type { PullRequestSummary } from '@bevel-software/platform-shared';
3
+
4
+ // `proposeChange`'s collaborators, mocked at the module boundary: what is
5
+ // pinned here is which change-request write each round makes.
6
+ vi.mock('../../git/services/git.api', () => ({
7
+ createBranch: vi.fn(),
8
+ handleApiResponse: vi.fn(),
9
+ }));
10
+ vi.mock('../../workspace/services/workspace.api', () => ({
11
+ getOrCreateWorkspace: vi.fn(),
12
+ writeFile: vi.fn(),
13
+ deleteFile: vi.fn(),
14
+ }));
15
+ vi.mock('../../pr/services/pr-open.api', () => ({ openChangeRequest: vi.fn() }));
16
+ vi.mock('../../pr/services/pr-edit.api', () => ({ updateChangeRequest: vi.fn() }));
17
+ vi.mock('../services/plugins.api', () => ({ ensurePersonalPlugin: vi.fn() }));
18
+
19
+ import { proposeChange } from '../services/library.api';
20
+ import { createBranch } from '../../git/services/git.api';
21
+ import { getOrCreateWorkspace, writeFile } from '../../workspace/services/workspace.api';
22
+ import { openChangeRequest } from '../../pr/services/pr-open.api';
23
+ import { updateChangeRequest } from '../../pr/services/pr-edit.api';
24
+
25
+ const existingCr = { number: 42, branch: 'suggestions/alice/deploy' } as PullRequestSummary;
26
+
27
+ const base = {
28
+ skillName: 'deploy',
29
+ repoRelativePath: 'Skills/deploy/SKILL.md',
30
+ content: 'new text',
31
+ userEmail: 'alice@example.com',
32
+ userName: 'Alice',
33
+ };
34
+
35
+ describe('proposeChange', () => {
36
+ beforeEach(() => {
37
+ vi.clearAllMocks();
38
+ vi.mocked(getOrCreateWorkspace).mockResolvedValue({
39
+ workspace: { id: 'ws-branch', kbDirName: 'kb' },
40
+ } as Awaited<ReturnType<typeof getOrCreateWorkspace>>);
41
+ vi.mocked(writeFile).mockResolvedValue({} as Awaited<ReturnType<typeof writeFile>>);
42
+ });
43
+
44
+ it("a later round's note is APPENDED to the open request's description, never a replacement", async () => {
45
+ const result = await proposeChange({ ...base, existingCr, note: 'Also fix the example.' });
46
+
47
+ expect(updateChangeRequest).toHaveBeenCalledTimes(1);
48
+ expect(updateChangeRequest).toHaveBeenCalledWith(42, { appendDescription: 'Also fix the example.' });
49
+ // The append is the whole edit: no title, no full description to overwrite
50
+ // a note or edit that landed meanwhile.
51
+ expect(vi.mocked(updateChangeRequest).mock.calls[0][1]).not.toHaveProperty('description');
52
+ expect(openChangeRequest).not.toHaveBeenCalled();
53
+ expect(createBranch).not.toHaveBeenCalled();
54
+ // The text is committed to the existing request's own branch.
55
+ expect(getOrCreateWorkspace).toHaveBeenCalledWith('suggestions/alice/deploy');
56
+ expect(writeFile).toHaveBeenCalledWith('ws-branch', 'kb/Skills/deploy/SKILL.md', 'new text');
57
+ expect(result.branch).toBe('suggestions/alice/deploy');
58
+ });
59
+
60
+ it('a later round without a note leaves the description alone', async () => {
61
+ await proposeChange({ ...base, existingCr });
62
+
63
+ expect(updateChangeRequest).not.toHaveBeenCalled();
64
+ expect(openChangeRequest).not.toHaveBeenCalled();
65
+ });
66
+
67
+ it("a first round opens a request carrying the note, and edits nothing", async () => {
68
+ await proposeChange({ ...base, existingCr: null, note: 'Why: the old step is wrong.' });
69
+
70
+ expect(openChangeRequest).toHaveBeenCalledWith(
71
+ expect.objectContaining({ description: 'Why: the old step is wrong.' }),
72
+ );
73
+ expect(updateChangeRequest).not.toHaveBeenCalled();
74
+ });
75
+ });
@@ -1,6 +1,6 @@
1
1
  import { useState } from 'react';
2
2
  import { Button, Dialog, Surface } from '../../../shared/components';
3
- import { useAdmin } from '../../admin/state/admin.context';
3
+ import { useAdmin } from '../../admin';
4
4
  import { NewSkillPanel } from './NewSkillPanel';
5
5
  import { LinkSkillPanel } from './LinkSkillPanel';
6
6
  import { AddDialogTabs, type AddKind } from './AddDialogTabs';
@@ -1,6 +1,6 @@
1
1
  import type { PullRequestSummary } from '@bevel-software/platform-shared';
2
2
  import { Badge } from '../../../shared/components';
3
- import { changeAuthorName } from '../../change-requests/utils/author';
3
+ import { changeAuthorName } from '../../change-requests';
4
4
 
5
5
  interface ChangeRequestDockProps {
6
6
  crs: PullRequestSummary[];
@@ -4,7 +4,7 @@ import { isPersonalPluginFolder } from '@bevel-software/platform-shared';
4
4
  import { cn } from '../../../lib/utils';
5
5
  import { DOCUMENT_COLUMN, documentGutters } from '../../../shared/theme/measure';
6
6
  import { HEADER_COLUMN_TOP } from '../../../shared/theme/header';
7
- import { useAdmin } from '../../admin/state/admin.context';
7
+ import { useAdmin } from '../../admin';
8
8
  import { attentionOf, useLibrary, workspaceHasNoPlugins } from '../state/library-data';
9
9
  import { personalPluginName } from '../utils/personal-plugin';
10
10
  import { CONNECT_TOOLS_PATH, libraryFilterForPath, pathForLibraryFilter } from '../routes/library-paths';
@@ -13,7 +13,7 @@ import { pathForGroupMembers } from '../../admin/components/group-members-path';
13
13
  import { ownedLensOf, pluginEntriesFor } from '../utils/plugin-entries';
14
14
  import { LINK_COPIED_TOAST, LINK_COPY_FAILED_TOAST, copyToClipboard } from '../utils/clipboard';
15
15
  import { useLibraryToast } from '../state/toast.context';
16
- import { useSidebar } from '../../layout/state/sidebar';
16
+ import { useSidebar } from '../../layout';
17
17
  import { SidebarFrame } from '../../layout/components/SidebarFrame';
18
18
  import { ConnectAgentPill } from '../../onboarding/components/ConnectAgentPill';
19
19
  import { PullRequestsForMe } from '../../git/components/PullRequestsForMe';
@@ -4,7 +4,7 @@ import { DEFAULT_BRANCH, type FileTreeEntry } from '@bevel-software/platform-sha
4
4
  import '../library.css';
5
5
  import { useLibrary, type LibraryItem } from '../state/library-data';
6
6
  import { urlForLibraryItem } from '../routes/library-paths';
7
- import { useWorkspace } from '../../workspace/state/workspace.context';
7
+ import { useWorkspace } from '../../workspace';
8
8
  import { EVERYONE_TEAM, emptyMessageFor, filterLibraryItems, type LibraryFilter } from '../utils/status';
9
9
  import { pluginEntriesFor } from '../utils/plugin-entries';
10
10
  import { personalPluginName } from '../utils/personal-plugin';
@@ -12,8 +12,8 @@ import { Banner, TextField } from '../../../shared/components';
12
12
  import { cn } from '../../../lib/utils';
13
13
  import { HEADER_BAND, PAGE_HEADER_TESTID, TITLE_INK_ROOM } from '../../../shared/theme/header';
14
14
  import { ManageAccessDialog } from '../../access/components/ManageAccessDialog';
15
- import { offersManageAccess } from '../../access/manage-access-affordance';
16
- import { useAdmin } from '../../admin/state/admin.context';
15
+ import { offersManageAccess } from '../../access';
16
+ import { useAdmin } from '../../admin';
17
17
  import { CreatorWelcomePage } from '../../onboarding/components/CreatorWelcomePage';
18
18
  import { PluginItemSections } from './plugin-page-parts';
19
19
  import { PluginRows } from './PluginRows';
@@ -1,6 +1,6 @@
1
1
  import { useMemo, useState } from 'react';
2
2
  import { useLibrary } from '../state/library-data';
3
- import { useWorkspace } from '../../workspace/state/workspace.context';
3
+ import { useWorkspace } from '../../workspace';
4
4
  import { ManageAccessDialog } from '../../access/components/ManageAccessDialog';
5
5
  import { PluginJoinRequests } from './PluginJoinRequests';
6
6
 
@@ -1,9 +1,9 @@
1
1
  import { useState } from 'react';
2
2
  import { useNavigate } from 'react-router-dom';
3
3
  import { Button, Surface, TextField } from '../../../shared/components';
4
- import { useAuth } from '../../auth/state/auth.context';
4
+ import { useAuth } from '../../auth';
5
5
  import { DEFAULT_BRANCH } from '@bevel-software/platform-shared';
6
- import { kbFileUrl } from '../../workspace/routing/kb-routes';
6
+ import { kbFileUrl } from '../../workspace';
7
7
  import { createEmptySkill } from '../services/library.api';
8
8
  import { useLibraryReload } from '../state/library-context';
9
9
  import { useLibraryToast } from '../state/toast.context';
@@ -1,6 +1,6 @@
1
1
  import { useState } from 'react';
2
2
  import { Button, Dialog, Surface } from '../../../shared/components';
3
- import { useAdmin } from '../../admin/state/admin.context';
3
+ import { useAdmin } from '../../admin';
4
4
  import { NewSkillPanel } from './NewSkillPanel';
5
5
  import { AddDialogTabs, type AddKind } from './AddDialogTabs';
6
6
  import { useLibraryToast } from '../state/toast.context';
@@ -5,7 +5,7 @@ import { useNavigate } from 'react-router-dom';
5
5
  import { useLibrary, type LibraryItem } from '../state/library-data';
6
6
  import { useLibraryToast } from '../state/toast.context';
7
7
  import { urlForLibraryItem } from '../routes/library-paths';
8
- import { useWorkspace } from '../../workspace/state/workspace.context';
8
+ import { useWorkspace } from '../../workspace';
9
9
  import { personalPluginName } from '../utils/personal-plugin';
10
10
  import { EmptySkillsNudge, PluginBreadcrumb, PluginItemSections, PageNote,
11
11
  RemoveLibraryItemDialog,
@@ -4,10 +4,7 @@ import { ChevronRight } from 'lucide-react';
4
4
  import { DEFAULT_BRANCH, PLUGINS_DIR, PLUGIN_MANIFEST_FILE, type FileTreeEntry } from '@bevel-software/platform-shared';
5
5
  import { cn } from '../../../lib/utils';
6
6
  import { Button } from '../../../shared/components';
7
- import { listFiles, readFile } from '../../workspace/services/workspace.api';
8
- import { useWorkspace } from '../../workspace/state/workspace.context';
9
- import { checkoutRoot } from '../../workspace/utils/fileTree';
10
- import { kbFileUrl } from '../../workspace/routing/kb-routes';
7
+ import { listFiles, readFile, useWorkspace, checkoutRoot, kbFileUrl } from '../../workspace';
11
8
 
12
9
  /**
13
10
  * The plugin page's two smallest sections, both pure REUSE of the Knowledge
@@ -19,7 +19,7 @@ import { joinNames } from '../utils/names';
19
19
  import { repairPluginLinks, type LinkRepairReport, type UnrepairedLink } from '../services/plugins.api';
20
20
  import { RenamePluginDialog } from './RenamePluginDialog';
21
21
  import { PluginJoinRequests } from './PluginJoinRequests';
22
- import { useWorkspace } from '../../workspace/state/workspace.context';
22
+ import { useWorkspace } from '../../workspace';
23
23
  import { ManifestButton, ClientExtensionsSection, ManifestSection } from './PluginExtras';
24
24
  import { ManageAccessDialog } from '../../access/components/ManageAccessDialog';
25
25
  import { AddToPluginDialog } from './AddToPluginDialog';
@@ -2,7 +2,7 @@ import { useState, type ReactNode } from 'react';
2
2
  import { useNavigate } from 'react-router-dom';
3
3
  import { ExternalLink, UserPlus, Users } from 'lucide-react';
4
4
  import { Badge, Banner } from '../../../shared/components';
5
- import { useAdmin } from '../../admin/state/admin.context';
5
+ import { useAdmin } from '../../admin';
6
6
  import { useLibrary, workspaceHasNoPlugins } from '../state/library-data';
7
7
  import { LIBRARY_ROOT, pathForPlugin } from '../routes/library-paths';
8
8
  import { adminNamesOf, ownersTextOf, primaryFolderOf } from '../utils/plugin-summary';
@@ -1,10 +1,7 @@
1
1
  import { useMemo } from 'react';
2
2
  import { useLocation, useNavigate } from 'react-router-dom';
3
3
  import { DEFAULT_BRANCH, PLUGINS_DIR, SKILLS_DIR, type FileTreeEntry } from '@bevel-software/platform-shared';
4
- import { libraryUploadTarget, useWorkspace } from '../../workspace/state/workspace.context';
5
- import { checkoutRoot } from '../../workspace/utils/fileTree';
6
- import { KB_ROUTE_PREFIX, kbFileUrl, safeDecode } from '../../workspace/routing/kb-routes';
7
- import { useMergedWorkspaceTree } from '../../workspace/hooks/useMergedWorkspaceTree';
4
+ import { libraryUploadTarget, useWorkspace, checkoutRoot, kbFileUrl, KB_ROUTE_PREFIX, safeDecode, useMergedWorkspaceTree } from '../../workspace';
8
5
  import { Puzzle } from 'lucide-react';
9
6
  import {
10
7
  EmptyTreeNotice,