@bevel-software/platform-core-frontend 0.28.1 → 0.30.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 +11 -4
- package/src/core/CoreAppShell.tsx +29 -11
- package/src/core/__tests__/ShellRoutes.test.tsx +43 -1
- package/src/core/events.ts +4 -2
- package/src/core/registry.ts +25 -3
- package/src/modules/embed/__tests__/EmbedView.test.tsx +560 -17
- package/src/modules/embed/__tests__/embed-config.test.ts +77 -1
- package/src/modules/embed/__tests__/mcp-app-view.test.ts +203 -1
- package/src/modules/embed/components/EmbedView.tsx +233 -47
- package/src/modules/embed/embed-config.ts +126 -2
- package/src/modules/embed/embed-host.ts +11 -2
- package/src/modules/embed/mount.tsx +1 -0
- package/src/modules/library/__tests__/LibraryRoutes.test.tsx +213 -4
- package/src/modules/library/__tests__/PluginPage.test.tsx +1 -1
- package/src/modules/library/__tests__/SkillPage.test.tsx +10 -0
- package/src/modules/library/components/LibraryLayout.tsx +2 -2
- package/src/modules/library/components/PluginPage.tsx +2 -1
- package/src/modules/library/components/skill-page/SkillPage.tsx +2 -2
- package/src/modules/library/components/tool-page/ToolPage.tsx +1 -1
- package/src/modules/library/index.ts +18 -0
- package/src/modules/library/routes/LibraryRoutes.tsx +17 -1
- package/src/modules/library/routes/library-paths.ts +16 -2
- package/src/modules/onboarding/__tests__/get-started-column.test.tsx +3 -3
- package/src/modules/secrets-vault/components/ConnectToolsPage.tsx +39 -32
- package/src/modules/secrets-vault/components/SecretsPage.tsx +9 -24
- package/src/modules/secrets-vault/components/__tests__/ConnectToolsPage.test.tsx +111 -8
- package/src/modules/secrets-vault/components/__tests__/connect-lists-what-the-banner-counted.test.tsx +1 -1
- package/src/modules/secrets-vault/index.ts +7 -0
- package/src/modules/settings/settings-nav-items.tsx +3 -3
- package/src/modules/toolbar/commands/__tests__/actions.test.tsx +20 -37
- package/src/modules/toolbar/commands/actions.tsx +62 -50
- package/src/modules/toolbar/commands/command-menu.ts +37 -3
- package/src/modules/toolbar/commands/useCommandShortcuts.ts +29 -76
- package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +4 -2
- package/src/modules/toolbar/components/SearchPalette.tsx +20 -21
- package/src/modules/toolbar/components/__tests__/ExternalAgentAccessPage.test.tsx +5 -2
- package/src/modules/toolbar/components/__tests__/SearchPalette.test.tsx +242 -103
- package/src/modules/toolbar/components/__tests__/Toolbar.test.tsx +51 -1
- package/src/modules/toolbar/search/__tests__/rank.test.ts +7 -3
- package/src/modules/workflow/hooks/__tests__/useFileLock.test.tsx +475 -0
- package/src/modules/workflow/hooks/__tests__/useFileLock.wire.test.tsx +115 -0
- package/src/modules/workflow/hooks/useFileLock.ts +321 -57
- package/src/modules/workflow/index.ts +8 -0
- package/src/modules/workflow/services/__tests__/lock.api.test.ts +4 -0
- package/src/modules/workflow/services/lock.api.ts +28 -9
- package/src/modules/workspace/components/FileViewer.tsx +30 -16
- package/src/modules/workspace/components/KbPageHeader.tsx +8 -1
- package/src/modules/workspace/components/__tests__/FileViewer.test.tsx +107 -4
- package/src/modules/workspace/components/__tests__/KbPageHeader.test.tsx +12 -0
- package/src/modules/workspace/components/renderers/HtmlRenderer.tsx +118 -13
- package/src/modules/workspace/components/renderers/__tests__/HtmlRenderer.test.tsx +189 -0
- package/src/modules/workspace/components/renderers/__tests__/htmlSandbox.test.ts +9 -0
- package/src/modules/workspace/components/renderers/__tests__/kbGraphLoader.test.tsx +60 -0
- package/src/modules/workspace/components/renderers/frameResizeHandle.ts +116 -0
- package/src/modules/workspace/components/renderers/index.ts +6 -0
- package/src/modules/workspace/components/renderers/kbGraphLoader.ts +27 -0
- package/src/modules/workspace/components/renderers/lazyRenderer.tsx +1 -1
- package/src/modules/workspace/components/renderers/rendererSurface.ts +19 -0
- package/src/modules/workspace/index.ts +33 -0
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
2
|
import { useLatestRef } from '../../../shared/components';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
/** How long the second key of a sequence (G, then K) is waited for. */
|
|
6
|
-
export const SEQUENCE_TIMEOUT_MS = 1000;
|
|
3
|
+
import { shortcutId, type CommandAction, type CommandContext } from './actions';
|
|
7
4
|
|
|
8
5
|
/**
|
|
9
6
|
* Where a key is somebody typing, not a command: a text field, a select, an
|
|
@@ -19,23 +16,27 @@ function isTypingTarget(target: EventTarget | null): boolean {
|
|
|
19
16
|
}
|
|
20
17
|
|
|
21
18
|
/**
|
|
22
|
-
* Bind every offered command's `shortcut` on the document: `C` for
|
|
23
|
-
* page,
|
|
24
|
-
* whatever
|
|
25
|
-
* has already dropped the ones that
|
|
26
|
-
* are
|
|
19
|
+
* Bind every offered command's `shortcut` on the document: `C` for Create
|
|
20
|
+
* new page, ⇧I for Invite people, ⇧K for Knowledge, ⇧S for Skills & Tools,
|
|
21
|
+
* and whatever letter a distribution gave its own commands
|
|
22
|
+
* (`mergeCommandActions` has already dropped the ones that are not one
|
|
23
|
+
* letter or are taken). The key a row shows is the key bound, one field.
|
|
24
|
+
* Mounted once, by the toolbar's palette.
|
|
27
25
|
*
|
|
28
|
-
* A
|
|
29
|
-
*
|
|
26
|
+
* A letter is a lot to claim, so it is claimed only when nobody could mean it
|
|
27
|
+
* as text or as anything else:
|
|
30
28
|
*
|
|
31
29
|
* - focus is not in a field or an editor (a `c` typed into a page is a `c`);
|
|
32
|
-
* - no
|
|
30
|
+
* - no Ctrl, ⌘ or Alt is held (Ctrl+C is copy);
|
|
31
|
+
* - Shift is held exactly when the shortcut has it: `C` runs without it,
|
|
32
|
+
* ⇧K with it, and ⇧C does not run C (it is free for a
|
|
33
|
+
* distribution command to take);
|
|
33
34
|
* - no modal dialog is up (it owns the keyboard, as it does for Ctrl/⌘K);
|
|
34
|
-
* - the palette is shut (`enabled`) — open,
|
|
35
|
+
* - the palette is shut (`enabled`) — open, the shortcut letters type into
|
|
36
|
+
* the query (Escape, Tab, Enter and the arrows still close and navigate).
|
|
35
37
|
*
|
|
36
|
-
* Only commands on offer run:
|
|
37
|
-
* and lets the key through.
|
|
38
|
-
* {@link SEQUENCE_TIMEOUT_MS} for its second, then is forgotten.
|
|
38
|
+
* Only commands on offer run: ⇧I for someone who may not invite does
|
|
39
|
+
* nothing, and lets the key through.
|
|
39
40
|
*/
|
|
40
41
|
export function useCommandShortcuts({
|
|
41
42
|
actions,
|
|
@@ -53,69 +54,21 @@ export function useCommandShortcuts({
|
|
|
53
54
|
const latest = useLatestRef({ actions, ctx, enabled, run });
|
|
54
55
|
|
|
55
56
|
useEffect(() => {
|
|
56
|
-
let first: string | null = null;
|
|
57
|
-
let timer: number | undefined;
|
|
58
|
-
const forget = () => {
|
|
59
|
-
first = null;
|
|
60
|
-
window.clearTimeout(timer);
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
// The commands on offer now, by their keys; read per key press, since
|
|
64
|
-
// what is offered follows the page on screen.
|
|
65
|
-
const bound = (seq: string): CommandAction | undefined =>
|
|
66
|
-
latest.current.actions.find((a) => shortcutSequence(a) === seq);
|
|
67
|
-
|
|
68
|
-
const runBound = (keys: readonly string[]): boolean => {
|
|
69
|
-
const action = bound(keys.join(' '));
|
|
70
|
-
if (!action) return false;
|
|
71
|
-
run(action, latest.current.ctx);
|
|
72
|
-
return true;
|
|
73
|
-
};
|
|
74
|
-
const run = (action: CommandAction, ctx: CommandContext) => latest.current.run(action, ctx);
|
|
75
|
-
|
|
76
57
|
function onKeyDown(e: KeyboardEvent) {
|
|
77
58
|
if (!latest.current.enabled || e.defaultPrevented || e.repeat) return;
|
|
78
|
-
if (e.ctrlKey || e.metaKey || e.altKey ||
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const sequence = [first, key];
|
|
89
|
-
forget();
|
|
90
|
-
if (runBound(sequence)) {
|
|
91
|
-
e.preventDefault();
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
// Not a sequence after all: the second key is tried on its own, so
|
|
95
|
-
// `G` then `C` still makes a page, and `G` then `G` re-arms.
|
|
96
|
-
}
|
|
97
|
-
if (runBound([key])) {
|
|
98
|
-
e.preventDefault();
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
// The first key of a sequence: hold it for the second.
|
|
102
|
-
const opensSequence = latest.current.actions.some((a) => {
|
|
103
|
-
const keys = a.shortcut ?? [];
|
|
104
|
-
return keys.length === 2 && keys[0]?.toLowerCase() === key;
|
|
105
|
-
});
|
|
106
|
-
if (opensSequence) {
|
|
107
|
-
first = key;
|
|
108
|
-
timer = window.setTimeout(forget, SEQUENCE_TIMEOUT_MS);
|
|
109
|
-
}
|
|
59
|
+
if (e.ctrlKey || e.metaKey || e.altKey || isTypingTarget(e.target)) return;
|
|
60
|
+
if (document.querySelector('[aria-modal="true"]')) return;
|
|
61
|
+
// The pressed key as a shortcut's id (`c`, `shift+k`), matched against
|
|
62
|
+
// the commands on offer now — read per key press, since what is
|
|
63
|
+
// offered follows the page on screen.
|
|
64
|
+
const pressed = shortcutId({ key: e.key, shift: e.shiftKey });
|
|
65
|
+
const action = latest.current.actions.find((a) => shortcutId(a.shortcut) === pressed);
|
|
66
|
+
if (!action) return;
|
|
67
|
+
e.preventDefault();
|
|
68
|
+
latest.current.run(action, latest.current.ctx);
|
|
110
69
|
}
|
|
111
70
|
|
|
112
71
|
document.addEventListener('keydown', onKeyDown);
|
|
113
|
-
return () =>
|
|
114
|
-
|
|
115
|
-
forget();
|
|
116
|
-
};
|
|
117
|
-
// `enabled` is in the list so a pending first key is forgotten when the
|
|
118
|
-
// palette opens or closes: a `G` pressed before Ctrl+K must not turn the
|
|
119
|
-
// `K` typed after Escape into a navigation.
|
|
120
|
-
}, [latest, enabled]);
|
|
72
|
+
return () => document.removeEventListener('keydown', onKeyDown);
|
|
73
|
+
}, [latest]);
|
|
121
74
|
}
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
} from '../../../shared/mcp';
|
|
21
21
|
import { CODEX_LOGIN_NOTE, GITHUB_LINK_KIND, marketplaceCommands, marketplaceGitUrl } from '../../../shared/marketplace-url';
|
|
22
22
|
import { AgentInstructionsCard } from './AgentInstructionsCard';
|
|
23
|
+
import { CONNECT_TOOLS_PATH } from '../../library';
|
|
23
24
|
import { CoworkSetupSteps } from './CoworkSetupSteps';
|
|
24
25
|
import { useAdmin } from '../../admin/state/admin.context';
|
|
25
26
|
import {
|
|
@@ -48,7 +49,7 @@ function formatRelative(ts: number | null): string {
|
|
|
48
49
|
* - "Your agent" (default) — connecting the user's own interactive agent
|
|
49
50
|
* (Claude, ChatGPT, Claude Code, Cursor…). No key: the agent gets only the
|
|
50
51
|
* server URL, and on first connect the browser opens our authorization
|
|
51
|
-
* flow (sign in + choose tools on
|
|
52
|
+
* flow (sign in + choose tools on Connect your tools). Copy-paste configs only.
|
|
52
53
|
* - "Marketplaces" — skills as native plugins rather than through the MCP
|
|
53
54
|
* server: the git remote Claude Code and Codex install from (with a key
|
|
54
55
|
* from the autonomous tab), and the Cowork / claude.ai route, where the
|
|
@@ -123,6 +124,7 @@ export function ExternalAgentAccessPage() {
|
|
|
123
124
|
}, []);
|
|
124
125
|
|
|
125
126
|
useEffect(() => {
|
|
127
|
+
// eslint-disable-next-line react-hooks/set-state-in-effect -- the first load; refresh sets state once it answers
|
|
126
128
|
void refresh();
|
|
127
129
|
}, [refresh]);
|
|
128
130
|
|
|
@@ -257,7 +259,7 @@ export function ExternalAgentAccessPage() {
|
|
|
257
259
|
variants between them, and its docstring prescribes exactly
|
|
258
260
|
this shape for links. */}
|
|
259
261
|
<Link
|
|
260
|
-
to=
|
|
262
|
+
to={CONNECT_TOOLS_PATH}
|
|
261
263
|
target="_blank"
|
|
262
264
|
rel="noopener noreferrer"
|
|
263
265
|
className={buttonClasses({ variant: 'outline', size: 'sm', className: 'w-full' })}
|
|
@@ -36,6 +36,8 @@ import {
|
|
|
36
36
|
COMMAND_MENU_SHORTCUT_LABEL,
|
|
37
37
|
isCommandMenuShortcut,
|
|
38
38
|
onCommandMenuRequest,
|
|
39
|
+
shortcutHint,
|
|
40
|
+
shortcutKeycapWidth,
|
|
39
41
|
} from '../commands/command-menu';
|
|
40
42
|
import { useSetupChecklist } from '../../onboarding/state/onboarding';
|
|
41
43
|
|
|
@@ -72,9 +74,6 @@ type PaletteRow =
|
|
|
72
74
|
const actionRow = (action: CommandAction): PaletteRow => ({ key: `action:${action.id}`, action });
|
|
73
75
|
const resultRow = (result: SearchResult): PaletteRow => ({ key: result.key, result });
|
|
74
76
|
|
|
75
|
-
/** A shortcut as a screen reader should hear it: "C", "G then K". */
|
|
76
|
-
const spokenShortcut = (keys: readonly string[]) => keys.join(' then ');
|
|
77
|
-
|
|
78
77
|
interface CatalogState {
|
|
79
78
|
/** A load is in flight. The previous catalog, if any, stays on screen meanwhile. */
|
|
80
79
|
loading: boolean;
|
|
@@ -210,8 +209,8 @@ export function SearchPalette({ compact }: { compact: boolean }) {
|
|
|
210
209
|
[openRef],
|
|
211
210
|
);
|
|
212
211
|
|
|
213
|
-
// The commands are read here, not in the panel, because
|
|
214
|
-
//
|
|
212
|
+
// The commands are read here, not in the panel, because their shortcuts
|
|
213
|
+
// (C, ⇧I, ⇧K, ⇧S) run them while the palette is shut.
|
|
215
214
|
const { actions, ctx } = useCommandActions();
|
|
216
215
|
useCommandShortcuts({ actions, ctx, enabled: !open, run: runAction });
|
|
217
216
|
|
|
@@ -332,7 +331,7 @@ function SearchPanel({
|
|
|
332
331
|
const [query, setQuery] = useState('');
|
|
333
332
|
/**
|
|
334
333
|
* The highlighted row. An EMPTY query highlights nothing until ↑/↓ or the
|
|
335
|
-
* pointer picks a row: its first row is a suggested command (
|
|
334
|
+
* pointer picks a row: its first row is a suggested command (Create new page), and
|
|
336
335
|
* Ctrl+K then Enter must never make a page nobody asked for. Once something
|
|
337
336
|
* is typed, the best match is highlighted and Enter takes it.
|
|
338
337
|
*/
|
|
@@ -434,7 +433,7 @@ function SearchPanel({
|
|
|
434
433
|
{rows.map((r, i) => {
|
|
435
434
|
const index = offset + i;
|
|
436
435
|
const selected = index === active;
|
|
437
|
-
const
|
|
436
|
+
const hint = r.action?.shortcut ? shortcutHint(r.action.shortcut) : null;
|
|
438
437
|
const location = r.action ? r.action.group : r.result.location;
|
|
439
438
|
return (
|
|
440
439
|
<div
|
|
@@ -462,21 +461,21 @@ function SearchPanel({
|
|
|
462
461
|
{location}
|
|
463
462
|
</span>
|
|
464
463
|
)}
|
|
465
|
-
{
|
|
464
|
+
{hint && (
|
|
466
465
|
<>
|
|
467
|
-
{/* Drawn as
|
|
468
|
-
|
|
469
|
-
<
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
</
|
|
479
|
-
<span className="sr-only"> (shortcut {
|
|
466
|
+
{/* Drawn as one key for the eye, every cap one width so the
|
|
467
|
+
keys line up; said as words for the ear. */}
|
|
468
|
+
<kbd
|
|
469
|
+
aria-hidden
|
|
470
|
+
className={cn(
|
|
471
|
+
'inline-flex flex-none justify-center rounded-xs border border-line-strong font-mono text-meta text-ink-faint',
|
|
472
|
+
shortcutKeycapWidth(),
|
|
473
|
+
location ? 'ml-2' : 'ml-auto',
|
|
474
|
+
)}
|
|
475
|
+
>
|
|
476
|
+
{hint.label}
|
|
477
|
+
</kbd>
|
|
478
|
+
<span className="sr-only"> (shortcut {hint.spoken})</span>
|
|
480
479
|
</>
|
|
481
480
|
)}
|
|
482
481
|
</div>
|
|
@@ -269,9 +269,12 @@ describe('the interactive tab: Claude and ChatGPT first, each family on its own
|
|
|
269
269
|
}
|
|
270
270
|
});
|
|
271
271
|
|
|
272
|
-
it('still offers the tool-configuration link', () => {
|
|
272
|
+
it('still offers the tool-configuration link, at the page\'s address in Skills & Tools', () => {
|
|
273
273
|
mount(PUBLIC_URL);
|
|
274
|
-
expect(screen.getByRole('link', { name: /Configure your tools/ })).
|
|
274
|
+
expect(screen.getByRole('link', { name: /Configure your tools/ })).toHaveAttribute(
|
|
275
|
+
'href',
|
|
276
|
+
'/skills-and-tools/connect',
|
|
277
|
+
);
|
|
275
278
|
});
|
|
276
279
|
|
|
277
280
|
/**
|