@bevel-software/platform-core-frontend 0.32.0 → 0.33.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.
- package/package.json +2 -2
- package/src/core/CoreAppShell.tsx +1 -1
- package/src/modules/access/api.ts +1 -1
- package/src/modules/access/components/ManageAccessDialog.tsx +4 -5
- package/src/modules/access/hooks/useAccessRequests.ts +1 -1
- package/src/modules/access/hooks/useFileAccess.ts +1 -1
- package/src/modules/access/index.ts +11 -0
- package/src/modules/access/requests.api.ts +1 -1
- package/src/modules/admin/components/AddMemberInput.tsx +1 -1
- package/src/modules/admin/components/UserAccountsPage.tsx +3 -3
- package/src/modules/admin/index.ts +7 -0
- package/src/modules/admin/state/admin.context.tsx +1 -1
- package/src/modules/audit/components/AuditEventsPanel.tsx +1 -1
- package/src/modules/audit/components/AuditLogPage.tsx +2 -2
- package/src/modules/auth/index.ts +12 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.access-rules.test.tsx +0 -1
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.binary.test.tsx +0 -1
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.brings-itself-up-to-date.test.tsx +0 -1
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.edit.test.tsx +166 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.fork-point.test.tsx +0 -1
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.initial-file.test.tsx +0 -1
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.moved.test.tsx +0 -1
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.sync-banner.test.tsx +0 -1
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.test.tsx +0 -2
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.unreadable.test.tsx +0 -1
- package/src/modules/change-requests/__tests__/apply-outcome-for-every-viewer.test.tsx +0 -1
- package/src/modules/change-requests/components/BranchFilePreview.tsx +4 -12
- package/src/modules/change-requests/components/ChangeRequestDialog.tsx +138 -30
- package/src/modules/change-requests/components/ChangeRequestLink.tsx +2 -3
- package/src/modules/change-requests/components/CrFileTree.tsx +1 -1
- package/src/modules/change-requests/components/FileChangeBoxes.tsx +2 -3
- package/src/modules/change-requests/hooks/useApplyChangeRequest.ts +3 -5
- package/src/modules/change-requests/hooks/useCrFileDiffs.ts +1 -1
- package/src/modules/change-requests/index.ts +14 -0
- package/src/modules/change-requests/services/change-requests.api.ts +2 -2
- package/src/modules/change-requests/services/denied-file.api.ts +2 -2
- package/src/modules/change-requests/services/propose.api.ts +3 -4
- package/src/modules/change-requests/utils/diff.ts +1 -1
- package/src/modules/change-requests/utils/readFailure.ts +1 -1
- package/src/modules/embed/__tests__/EmbedView.test.tsx +19 -2
- package/src/modules/embed/components/EmbedLinkPage.tsx +1 -2
- package/src/modules/git/components/BranchSwitcher.tsx +3 -4
- package/src/modules/git/components/FileHistoryPanel.tsx +2 -2
- package/src/modules/git/components/GitSyncFailedBanner.tsx +2 -4
- package/src/modules/git/components/HistoryVersionPreview.tsx +4 -15
- package/src/modules/git/components/PullNeededBanner.tsx +1 -1
- package/src/modules/git/hooks/useAutoPullUpdates.ts +1 -1
- package/src/modules/git/index.ts +11 -0
- package/src/modules/layout/components/MobileChatLayout.tsx +1 -1
- package/src/modules/layout/index.ts +9 -0
- package/src/modules/library/__tests__/SkillPage.test.tsx +39 -0
- package/src/modules/library/__tests__/propose-change.test.ts +75 -0
- package/src/modules/library/components/AddToPluginDialog.tsx +1 -1
- package/src/modules/library/components/ChangeRequestDock.tsx +1 -1
- package/src/modules/library/components/LibraryLayout.tsx +2 -2
- package/src/modules/library/components/LibraryPage.tsx +3 -3
- package/src/modules/library/components/ManagedPluginRequests.tsx +1 -1
- package/src/modules/library/components/NewSkillPanel.tsx +2 -2
- package/src/modules/library/components/PersonalAddDialog.tsx +1 -1
- package/src/modules/library/components/PersonalPluginPage.tsx +1 -1
- package/src/modules/library/components/PluginExtras.tsx +1 -4
- package/src/modules/library/components/PluginPage.tsx +1 -1
- package/src/modules/library/components/PluginRows.tsx +1 -1
- package/src/modules/library/components/SkillsTree.tsx +1 -4
- package/src/modules/library/components/plugin-page-parts.tsx +1 -1
- package/src/modules/library/components/skill-page/SkillFilePane.tsx +19 -7
- package/src/modules/library/components/skill-page/SkillPage.tsx +19 -26
- package/src/modules/library/components/tool-page/ToolConnectionSection.tsx +2 -4
- package/src/modules/library/components/tool-page/ToolVarRow.tsx +2 -2
- package/src/modules/library/hooks/useJoinRequests.ts +1 -1
- package/src/modules/library/hooks/useLibraryData.ts +3 -3
- package/src/modules/library/hooks/useToolPage.ts +1 -1
- package/src/modules/library/hooks/useToolSource.ts +1 -1
- package/src/modules/library/index.ts +12 -0
- package/src/modules/library/routes/LibraryRoutes.tsx +1 -1
- package/src/modules/library/routes/WorkspaceItemRoute.tsx +1 -3
- package/src/modules/library/routes/library-paths.ts +1 -1
- package/src/modules/library/services/library.api.ts +10 -8
- package/src/modules/library/services/plugins.api.ts +1 -1
- package/src/modules/library/services/teams.api.ts +1 -1
- package/src/modules/library/utils/status.ts +2 -2
- package/src/modules/onboarding/components/ConnectAgentPill.tsx +1 -1
- package/src/modules/onboarding/components/CreatorWelcomePage.tsx +2 -3
- package/src/modules/onboarding/components/GetStartedColumn.tsx +6 -13
- package/src/modules/onboarding/components/InviteButton.tsx +2 -2
- package/src/modules/onboarding/components/InviteDialog.tsx +4 -6
- package/src/modules/onboarding/components/RootLanding.tsx +2 -2
- package/src/modules/onboarding/components/StarterPackCard.tsx +1 -1
- package/src/modules/onboarding/components/WelcomePage.tsx +2 -5
- package/src/modules/onboarding/index.ts +10 -0
- package/src/modules/onboarding/paths.ts +1 -1
- package/src/modules/onboarding/state/agent-connection.ts +2 -2
- package/src/modules/onboarding/state/onboarding.ts +1 -1
- package/src/modules/onboarding/state/starter-packs.ts +1 -1
- package/src/modules/pr/components/OpenChangeRequestDialog.tsx +1 -1
- package/src/modules/pr/index.ts +14 -0
- package/src/modules/pr/services/pr-approvals.api.ts +1 -1
- package/src/modules/pr/services/pr-cancel.api.ts +1 -1
- package/src/modules/pr/services/pr-detail.api.ts +2 -2
- package/src/modules/pr/services/pr-edit.api.ts +22 -0
- package/src/modules/pr/services/pr-merge.api.ts +1 -1
- package/src/modules/pr/services/pr-open.api.ts +1 -1
- package/src/modules/review/components/DiffViewer.tsx +1 -1
- package/src/modules/review/components/MarkdownDiffViewer.tsx +1 -2
- package/src/modules/review/components/ReviewPanel.tsx +2 -3
- package/src/modules/review/state/ReviewProvider.tsx +2 -2
- package/src/modules/secrets-vault/index.ts +6 -0
- package/src/modules/settings/components/DeploymentPage.tsx +2 -2
- package/src/modules/settings/components/SettingsLayout.tsx +2 -2
- package/src/modules/settings/index.ts +8 -0
- package/src/modules/setup/components/FirstRunStorage.tsx +1 -1
- package/src/modules/setup/index.ts +6 -0
- package/src/modules/toolbar/commands/actions.tsx +3 -3
- package/src/modules/toolbar/commands/useCommandActions.ts +5 -9
- package/src/modules/toolbar/components/AgentInstructionsCard.tsx +2 -2
- package/src/modules/toolbar/components/AppSwitcher.tsx +1 -2
- package/src/modules/toolbar/components/CoworkSetupSteps.tsx +1 -1
- package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +1 -1
- package/src/modules/toolbar/components/ProfileMenu.tsx +3 -3
- package/src/modules/toolbar/components/SearchPalette.tsx +4 -8
- package/src/modules/toolbar/components/Toolbar.tsx +2 -5
- package/src/modules/toolbar/index.ts +6 -0
- package/src/modules/toolbar/search/sources.ts +4 -7
- package/src/modules/toolbar/services/agent-instructions.api.ts +1 -1
- package/src/modules/tools/ToolsExplorerPage.tsx +217 -18
- package/src/modules/tools/__tests__/ToolsExplorerPage.read-only.test.tsx +220 -0
- package/src/modules/tools/tool-hints.api.ts +44 -0
- package/src/modules/workflow/index.ts +7 -0
- package/src/modules/workflow/state/ChangeRequestStaleBinder.tsx +1 -0
- package/src/modules/workflow/state/EventBusFocusBinder.tsx +1 -1
- package/src/modules/workspace/components/FileExplorer.tsx +35 -8
- package/src/modules/workspace/components/FilePaneCard.tsx +37 -12
- package/src/modules/workspace/components/FileRoute.tsx +10 -3
- package/src/modules/workspace/components/FileViewer.tsx +169 -25
- package/src/modules/workspace/components/FullScreenView.tsx +93 -0
- package/src/modules/workspace/components/KbFileRail.tsx +1 -1
- package/src/modules/workspace/components/KbPageHeader.tsx +9 -0
- package/src/modules/workspace/components/__tests__/FileExplorer.test.tsx +137 -0
- package/src/modules/workspace/components/__tests__/FileRoute.test.tsx +11 -0
- package/src/modules/workspace/components/__tests__/FileViewer.test.tsx +487 -3
- package/src/modules/workspace/components/readingCarry.ts +59 -0
- package/src/modules/workspace/components/renderers/HtmlRenderer.tsx +36 -175
- package/src/modules/workspace/components/renderers/ToolRenderer.tsx +1 -1
- package/src/modules/workspace/components/renderers/__tests__/HtmlRenderer.tools.test.tsx +168 -42
- package/src/modules/workspace/components/renderers/__tests__/bridgeHarness.ts +20 -3
- package/src/modules/workspace/components/renderers/__tests__/htmlSandbox.test.ts +63 -4
- package/src/modules/workspace/components/renderers/__tests__/htmlToolBridge.test.ts +235 -1
- package/src/modules/workspace/components/renderers/__tests__/htmlViewsGuide.test.ts +14 -3
- package/src/modules/workspace/components/renderers/__tests__/pageToolsHarness.ts +79 -0
- package/src/modules/workspace/components/renderers/__tests__/useHtmlToolBridge.test.tsx +316 -0
- package/src/modules/workspace/components/renderers/htmlSandbox.ts +75 -13
- package/src/modules/workspace/components/renderers/htmlToolBridge.ts +196 -25
- package/src/modules/workspace/components/renderers/index.ts +10 -0
- package/src/modules/workspace/components/renderers/useHtmlToolBridge.tsx +253 -0
- package/src/modules/workspace/hooks/useFullScreenView.ts +52 -0
- package/src/modules/workspace/hooks/useImageRevision.ts +1 -1
- package/src/modules/workspace/hooks/useKnowledgeWriteTarget.ts +1 -1
- package/src/modules/workspace/hooks/useLastCommit.ts +1 -1
- package/src/modules/workspace/hooks/useWorkspaceState.ts +4 -4
- package/src/modules/workspace/index.ts +30 -1
- package/src/modules/workspace/routing/kb-routes.ts +1 -1
- package/src/modules/workspace/state/__tests__/applied-request-clears-pending.test.tsx +0 -1
- package/src/modules/workspace/state/open-change-requests.tsx +1 -1
- package/src/modules/workspace/utils/frameEscape.ts +15 -0
- package/src/modules/workspace/utils/treeConfirm.ts +1 -1
- package/src/shared/theme/measure.ts +7 -0
- package/src/modules/pr/services/pr-comments.api.ts +0 -45
|
@@ -18,6 +18,8 @@ import { AuthContext, type AuthContextValue } from '../../../auth/state/auth.con
|
|
|
18
18
|
import { OpenChangeRequestsContext } from '../../state/open-change-requests.context';
|
|
19
19
|
import { AdminContext, type AdminContextValue } from '../../../admin/state/admin.context';
|
|
20
20
|
import { PR_STALE_EVENT } from '../../../../core/events';
|
|
21
|
+
import { EventBusProvider } from '../../../workflow';
|
|
22
|
+
import type { WorkflowEvent } from '@bevel-software/platform-shared';
|
|
21
23
|
import {
|
|
22
24
|
AppRegistryContext,
|
|
23
25
|
makeRegistry,
|
|
@@ -4157,3 +4159,138 @@ describe('FileExplorer: deleting platform files', () => {
|
|
|
4157
4159
|
expect(deleteEntry).toHaveBeenCalledWith(`${KB}/Team/access.md`);
|
|
4158
4160
|
});
|
|
4159
4161
|
});
|
|
4162
|
+
|
|
4163
|
+
describe('FileExplorer: a document the server could not read', () => {
|
|
4164
|
+
// Legal is open (a folder above depth 2 opens by default); Archive/Old is
|
|
4165
|
+
// at depth 2 and starts closed, so its file has no row on screen until opened.
|
|
4166
|
+
const TREE: FileTreeEntry = {
|
|
4167
|
+
name: '.',
|
|
4168
|
+
relativePath: '.',
|
|
4169
|
+
type: 'directory',
|
|
4170
|
+
children: [
|
|
4171
|
+
{
|
|
4172
|
+
name: 'Legal',
|
|
4173
|
+
relativePath: 'Legal',
|
|
4174
|
+
type: 'directory',
|
|
4175
|
+
children: [
|
|
4176
|
+
{ name: 'Supplier-Agreement.pdf', relativePath: 'Legal/Supplier-Agreement.pdf', type: 'file' },
|
|
4177
|
+
{ name: 'Terms-2026.md', relativePath: 'Legal/Terms-2026.md', type: 'file' },
|
|
4178
|
+
],
|
|
4179
|
+
},
|
|
4180
|
+
{
|
|
4181
|
+
name: 'Archive',
|
|
4182
|
+
relativePath: 'Archive',
|
|
4183
|
+
type: 'directory',
|
|
4184
|
+
children: [
|
|
4185
|
+
{
|
|
4186
|
+
name: 'Old',
|
|
4187
|
+
relativePath: 'Archive/Old',
|
|
4188
|
+
type: 'directory',
|
|
4189
|
+
children: [{ name: 'Hidden.pdf', relativePath: 'Archive/Old/Hidden.pdf', type: 'file' }],
|
|
4190
|
+
},
|
|
4191
|
+
],
|
|
4192
|
+
},
|
|
4193
|
+
],
|
|
4194
|
+
};
|
|
4195
|
+
|
|
4196
|
+
/**
|
|
4197
|
+
* The app's own event bus, driven as the server drives it. jsdom ships no
|
|
4198
|
+
* EventSource, so the provider gets this stand-in for the stream it opens
|
|
4199
|
+
* on mount; `deliver` hands it one server event the way the stream would.
|
|
4200
|
+
*/
|
|
4201
|
+
class FakeEventSource {
|
|
4202
|
+
static current: FakeEventSource | null = null;
|
|
4203
|
+
private readonly listeners = new Map<string, ((e: Event) => void)[]>();
|
|
4204
|
+
constructor() {
|
|
4205
|
+
FakeEventSource.current = this;
|
|
4206
|
+
}
|
|
4207
|
+
addEventListener(type: string, fn: (e: Event) => void) {
|
|
4208
|
+
this.listeners.set(type, [...(this.listeners.get(type) ?? []), fn]);
|
|
4209
|
+
}
|
|
4210
|
+
removeEventListener(type: string, fn: (e: Event) => void) {
|
|
4211
|
+
this.listeners.set(type, (this.listeners.get(type) ?? []).filter((f) => f !== fn));
|
|
4212
|
+
}
|
|
4213
|
+
close() {}
|
|
4214
|
+
deliver(event: WorkflowEvent) {
|
|
4215
|
+
for (const fn of [...(this.listeners.get('message') ?? [])]) {
|
|
4216
|
+
fn(new MessageEvent('message', { data: JSON.stringify(event) }));
|
|
4217
|
+
}
|
|
4218
|
+
}
|
|
4219
|
+
}
|
|
4220
|
+
|
|
4221
|
+
beforeEach(() => {
|
|
4222
|
+
FakeEventSource.current = null;
|
|
4223
|
+
vi.stubGlobal('EventSource', FakeEventSource);
|
|
4224
|
+
// The provider posts its focus to the server; nothing here reads the answer.
|
|
4225
|
+
vi.stubGlobal('fetch', vi.fn(async () => new Response(JSON.stringify({ status: 'ok' }), { status: 200 })));
|
|
4226
|
+
window.sessionStorage.setItem('bevel-event-bus-session-id', 'sess-explorer');
|
|
4227
|
+
});
|
|
4228
|
+
afterEach(() => {
|
|
4229
|
+
vi.unstubAllGlobals();
|
|
4230
|
+
window.sessionStorage.clear();
|
|
4231
|
+
});
|
|
4232
|
+
|
|
4233
|
+
function renderWithBus() {
|
|
4234
|
+
const workspace = makeWorkspaceFixture({ fileTree: inCheckout(TREE) });
|
|
4235
|
+
render(
|
|
4236
|
+
<MemoryRouter>
|
|
4237
|
+
<AuthContext.Provider value={makeAuth()}>
|
|
4238
|
+
<WorkspaceContext.Provider value={workspace}>
|
|
4239
|
+
<GitContext.Provider value={makeGit()}>
|
|
4240
|
+
<EventBusProvider>
|
|
4241
|
+
<FileExplorer />
|
|
4242
|
+
</EventBusProvider>
|
|
4243
|
+
</GitContext.Provider>
|
|
4244
|
+
</WorkspaceContext.Provider>
|
|
4245
|
+
</AuthContext.Provider>
|
|
4246
|
+
</MemoryRouter>,
|
|
4247
|
+
);
|
|
4248
|
+
let id = 1;
|
|
4249
|
+
const push = (payload: { workspaceId: string; path: string; reason: string }) =>
|
|
4250
|
+
act(() => {
|
|
4251
|
+
const event = { id: id++, ts: new Date().toISOString(), kind: 'document-unreadable', ...payload } as WorkflowEvent;
|
|
4252
|
+
FakeEventSource.current!.deliver(event);
|
|
4253
|
+
});
|
|
4254
|
+
return { push };
|
|
4255
|
+
}
|
|
4256
|
+
|
|
4257
|
+
const damaged = kbPath('Legal/Supplier-Agreement.pdf');
|
|
4258
|
+
|
|
4259
|
+
it('shows the notice under the row of the file, with the reason after "Could not be read:"', () => {
|
|
4260
|
+
const { push } = renderWithBus();
|
|
4261
|
+
push({ workspaceId: 'ws-1', path: damaged, reason: "could not extract the PDF's text (Bad (uncompressed) XRef entry: 4R)" });
|
|
4262
|
+
const notice = screen.getByTestId('tree-unreadable-notice');
|
|
4263
|
+
expect(notice).toHaveTextContent("Could not be read: could not extract the PDF's text (Bad (uncompressed) XRef entry: 4R)");
|
|
4264
|
+
// Under THAT row: the row's own element is the one right before it.
|
|
4265
|
+
const row = screen.getByText('Supplier-Agreement.pdf').closest('button')!;
|
|
4266
|
+
expect(row.nextElementSibling).toBe(notice);
|
|
4267
|
+
// The row itself carries no marker of its own.
|
|
4268
|
+
expect(within(row).queryByTestId('tree-unreadable-notice')).toBeNull();
|
|
4269
|
+
});
|
|
4270
|
+
|
|
4271
|
+
it('words a timeout as the mock does, and Dismiss removes it for good', () => {
|
|
4272
|
+
const { push } = renderWithBus();
|
|
4273
|
+
push({ workspaceId: 'ws-1', path: damaged, reason: 'extracting its text took longer than 10 seconds' });
|
|
4274
|
+
expect(screen.getByTestId('tree-unreadable-notice')).toHaveTextContent(
|
|
4275
|
+
'Could not be read: extracting its text took longer than 10 seconds.',
|
|
4276
|
+
);
|
|
4277
|
+
fireEvent.click(screen.getByRole('button', { name: 'Dismiss could not be read' }));
|
|
4278
|
+
expect(screen.queryByTestId('tree-unreadable-notice')).toBeNull();
|
|
4279
|
+
});
|
|
4280
|
+
|
|
4281
|
+
it('shows nothing for a file in another workspace, or for another file', () => {
|
|
4282
|
+
const { push } = renderWithBus();
|
|
4283
|
+
push({ workspaceId: 'someone%2Felse', path: damaged, reason: 'x' });
|
|
4284
|
+
push({ workspaceId: 'ws-1', path: kbPath('Legal/Terms-2026.md.pdf'), reason: 'x' });
|
|
4285
|
+
expect(screen.queryByTestId('tree-unreadable-notice')).toBeNull();
|
|
4286
|
+
});
|
|
4287
|
+
|
|
4288
|
+
it('keeps nothing for a row that was not on screen when the failure was pushed', () => {
|
|
4289
|
+
const { push } = renderWithBus();
|
|
4290
|
+
expect(screen.queryByText('Hidden.pdf')).toBeNull();
|
|
4291
|
+
push({ workspaceId: 'ws-1', path: kbPath('Archive/Old/Hidden.pdf'), reason: 'x' });
|
|
4292
|
+
fireEvent.click(screen.getByText('Old'));
|
|
4293
|
+
expect(screen.getByText('Hidden.pdf')).toBeInTheDocument();
|
|
4294
|
+
expect(screen.queryByTestId('tree-unreadable-notice')).toBeNull();
|
|
4295
|
+
});
|
|
4296
|
+
});
|
|
@@ -105,6 +105,7 @@ function LocationProbe() {
|
|
|
105
105
|
<>
|
|
106
106
|
<div aria-label="pathname">{location.pathname}</div>
|
|
107
107
|
<div aria-label="location-state">{JSON.stringify(location.state)}</div>
|
|
108
|
+
<div aria-label="search">{location.search}</div>
|
|
108
109
|
</>
|
|
109
110
|
);
|
|
110
111
|
}
|
|
@@ -267,6 +268,16 @@ describe('FileRoute: the canonical id URL', () => {
|
|
|
267
268
|
expect(screen.getByLabelText('location-state')).toHaveTextContent('{"rawFile":true}');
|
|
268
269
|
});
|
|
269
270
|
|
|
271
|
+
it('keeps the query across the swap, so a link that asked for full screen still has it on the id URL', async () => {
|
|
272
|
+
routesMock.fetchNodeId.mockResolvedValue('web_search');
|
|
273
|
+
renderAt(`/workspace/main/${PATH}?fullscreen=1`, openOn());
|
|
274
|
+
await waitFor(() =>
|
|
275
|
+
expect(screen.getByLabelText('pathname')).toHaveTextContent('/workspace/main/web_search'),
|
|
276
|
+
);
|
|
277
|
+
expect(screen.getByLabelText('search')).toHaveTextContent('?fullscreen=1');
|
|
278
|
+
expect(screen.getByTestId('exit-full-screen')).toBeInTheDocument();
|
|
279
|
+
});
|
|
280
|
+
|
|
270
281
|
it('keeps the path URL when canonicalising is off — the Library frame renders it there, and an id URL is no library location', async () => {
|
|
271
282
|
routesMock.fetchNodeId.mockResolvedValue('web_search');
|
|
272
283
|
renderAt(`/workspace/main/${PATH}`, { ...openOn(), canonicalize: false });
|