@bevel-software/platform-core-frontend 0.25.2 → 0.27.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 +87 -25
- package/src/core/ProductName.tsx +49 -0
- package/src/core/__tests__/ShellRoutes.test.tsx +22 -0
- package/src/core/__tests__/core-contributions.test.ts +16 -0
- package/src/core/core-contributions.ts +17 -0
- package/src/core/registry.ts +51 -1
- package/src/index.css +23 -5
- package/src/index.ts +5 -0
- package/src/modules/access/__tests__/ManageAccessDialog.proposal.test.tsx +1 -1
- package/src/modules/access/components/ManageAccessDialog.tsx +1 -1
- package/src/modules/admin/__tests__/RolesCorruptedBanner.test.tsx +70 -0
- package/src/modules/admin/components/RolesCorruptedBanner.tsx +9 -4
- package/src/modules/auth/components/LoginScreen.tsx +4 -1
- package/src/modules/auth/services/account.api.ts +28 -1
- package/src/modules/auth/services/sso.ts +1 -2
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.sync-banner.test.tsx +176 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.unreadable.test.tsx +68 -0
- package/src/modules/change-requests/__tests__/ChangeRequestLink.test.tsx +182 -0
- package/src/modules/change-requests/__tests__/FileChangeBoxes.test.tsx +1 -1
- package/src/modules/change-requests/__tests__/readFileOnBranch.test.ts +79 -0
- package/src/modules/change-requests/components/ChangeBox.tsx +6 -1
- package/src/modules/change-requests/components/ChangeRequestDialog.tsx +45 -15
- package/src/modules/change-requests/components/ChangeRequestLink.tsx +151 -0
- package/src/modules/change-requests/components/CrFileTree.tsx +2 -1
- package/src/modules/change-requests/components/FileChangeBoxes.tsx +4 -2
- package/src/modules/change-requests/hooks/useApplyChangeRequest.ts +6 -3
- package/src/modules/change-requests/services/change-requests.api.ts +15 -2
- package/src/modules/change-requests/utils/readFailure.ts +22 -0
- package/src/modules/embed/__tests__/EmbedLinkPage.test.tsx +74 -0
- package/src/modules/embed/__tests__/EmbedView.test.tsx +473 -0
- package/src/modules/embed/__tests__/embed-config.test.ts +128 -0
- package/src/modules/embed/__tests__/embed-host.test.ts +111 -0
- package/src/modules/embed/__tests__/mcp-app-view.test.ts +295 -0
- package/src/modules/embed/__tests__/mount.test.tsx +157 -0
- package/src/modules/embed/components/EmbedLinkPage.tsx +109 -0
- package/src/modules/embed/components/EmbedView.tsx +545 -0
- package/src/modules/embed/embed-config.ts +132 -0
- package/src/modules/embed/embed-host.ts +120 -0
- package/src/modules/embed/mount.tsx +80 -0
- package/src/modules/embed/services/embed-token.ts +22 -0
- package/src/modules/embed/services/embed.api.ts +158 -0
- package/src/modules/git/__tests__/BranchSwitcher.test.tsx +202 -4
- package/src/modules/git/__tests__/GitSyncFailedBanner.test.tsx +59 -1
- package/src/modules/git/__tests__/PullNeededBanner.test.tsx +39 -22
- package/src/modules/git/__tests__/useAutoPullUpdates.test.tsx +7 -2
- package/src/modules/git/branch-delete-menu-item.tsx +24 -0
- package/src/modules/git/components/BranchSwitcher.tsx +29 -5
- package/src/modules/git/components/GitSyncFailedBanner.tsx +53 -15
- package/src/modules/git/components/HistoryVersionPreview.tsx +5 -3
- package/src/modules/git/components/PullNeededBanner.tsx +15 -49
- package/src/modules/git/hooks/useAutoPullUpdates.ts +9 -5
- package/src/modules/git/index.ts +15 -0
- package/src/modules/git/services/__tests__/error-messages.test.ts +67 -0
- package/src/modules/git/services/__tests__/pull-failure.test.ts +36 -0
- package/src/modules/git/services/error-messages.ts +58 -1
- package/src/modules/git/services/pull-failure.ts +68 -0
- package/src/modules/git/state/branch-delete-confirm.ts +46 -0
- package/src/modules/layout/__tests__/HeaderAlignment.test.tsx +1 -0
- package/src/modules/layout/__tests__/breakpoints.test.ts +7 -1
- package/src/modules/layout/breakpoints.ts +8 -0
- package/src/modules/library/__tests__/PluginExtras.test.tsx +9 -9
- package/src/modules/library/__tests__/PluginPage.test.tsx +8 -1
- package/src/modules/library/__tests__/SkillsTree.test.tsx +13 -4
- package/src/modules/library/__tests__/ToolPage.test.tsx +53 -0
- package/src/modules/library/components/LibraryPage.tsx +22 -0
- package/src/modules/library/components/PluginExtras.tsx +23 -6
- package/src/modules/library/components/PluginPage.tsx +6 -1
- package/src/modules/library/components/tool-page/ToolPage.tsx +45 -1
- package/src/modules/library/routes/LibraryRoutes.tsx +8 -7
- package/src/modules/library/services/plugins.api.ts +4 -1
- package/src/modules/library/services/tools.api.ts +27 -0
- package/src/modules/library/state/plugins-revision.ts +28 -0
- package/src/modules/onboarding/__tests__/agent-connection-api.test.ts +55 -0
- package/src/modules/onboarding/__tests__/creator-welcome.test.tsx +87 -82
- package/src/modules/onboarding/__tests__/first-page-prompt.test.ts +109 -0
- package/src/modules/onboarding/__tests__/get-started-column.test.tsx +1001 -0
- package/src/modules/onboarding/__tests__/invite-dialog.test.tsx +392 -0
- package/src/modules/onboarding/__tests__/onboarding.test.tsx +226 -193
- package/src/modules/onboarding/__tests__/starter-pack-card.test.tsx +136 -0
- package/src/modules/onboarding/components/CreatorWelcomePage.tsx +7 -11
- package/src/modules/onboarding/components/EmailChipsInput.tsx +138 -0
- package/src/modules/onboarding/components/GetStartedColumn.tsx +651 -0
- package/src/modules/onboarding/components/InviteButton.tsx +35 -0
- package/src/modules/onboarding/components/InviteDialog.tsx +424 -0
- package/src/modules/onboarding/components/RootLanding.tsx +8 -24
- package/src/modules/onboarding/components/StarterPackCard.tsx +98 -0
- package/src/modules/onboarding/components/WelcomePage.tsx +65 -154
- package/src/modules/onboarding/first-page-prompt.ts +89 -0
- package/src/modules/onboarding/invite-emails.ts +175 -0
- package/src/modules/onboarding/services/agent-connection.api.ts +53 -0
- package/src/modules/onboarding/services/starter-packs.api.ts +83 -0
- package/src/modules/onboarding/state/agent-connection.ts +167 -0
- package/src/modules/onboarding/state/invite-dialog.context.ts +32 -0
- package/src/modules/onboarding/state/invite-dialog.tsx +31 -0
- package/src/modules/onboarding/state/onboarding.ts +133 -59
- package/src/modules/onboarding/state/starter-packs.ts +169 -0
- package/src/modules/settings/settings-nav-items.tsx +8 -3
- package/src/modules/setup/__tests__/setup.first-run-storage.test.tsx +389 -0
- package/src/modules/setup/__tests__/setup.github.test.tsx +5 -5
- package/src/modules/setup/__tests__/setup.kept-draft.test.tsx +1 -1
- package/src/modules/setup/__tests__/setup.repository-change.test.tsx +1 -1
- package/src/modules/setup/__tests__/setup.repository.test.tsx +21 -21
- package/src/modules/setup/__tests__/setup.test.tsx +65 -81
- package/src/modules/setup/__tests__/useConnectionProbe.test.tsx +123 -0
- package/src/modules/setup/components/FirstRunStorage.tsx +560 -0
- package/src/modules/setup/components/SetupGate.tsx +46 -1
- package/src/modules/setup/components/SetupScreen.tsx +92 -152
- package/src/modules/setup/hooks/useConnectionProbe.ts +93 -0
- package/src/modules/setup/services/setup.api.ts +3 -3
- package/src/modules/setup/utils/suggested-branch.ts +27 -0
- package/src/modules/toolbar/commands/__tests__/actions.test.tsx +210 -0
- package/src/modules/toolbar/commands/actions.tsx +324 -0
- package/src/modules/toolbar/commands/command-menu.ts +44 -0
- package/src/modules/toolbar/commands/useCommandActions.ts +69 -0
- package/src/modules/toolbar/commands/useCommandShortcuts.ts +121 -0
- package/src/modules/toolbar/components/AppSwitcher.tsx +106 -22
- package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +1 -1
- package/src/modules/toolbar/components/ProfileMenu.tsx +9 -4
- package/src/modules/toolbar/components/SearchPalette.tsx +540 -0
- package/src/modules/toolbar/components/Toolbar.tsx +10 -0
- package/src/modules/toolbar/components/__tests__/AppSwitcher.test.tsx +187 -54
- package/src/modules/toolbar/components/__tests__/ExternalAgentAccessPage.test.tsx +4 -4
- package/src/modules/toolbar/components/__tests__/ProfileMenu.test.tsx +64 -0
- package/src/modules/toolbar/components/__tests__/SearchPalette.test.tsx +832 -0
- package/src/modules/toolbar/components/__tests__/Toolbar.test.tsx +57 -2
- package/src/modules/toolbar/search/__tests__/rank.test.ts +93 -0
- package/src/modules/toolbar/search/__tests__/sources.test.ts +131 -0
- package/src/modules/toolbar/search/rank.ts +111 -0
- package/src/modules/toolbar/search/sources.ts +169 -0
- package/src/modules/workflow/hooks/useFileLock.ts +10 -7
- package/src/modules/workflow/services/__tests__/lock.api.test.ts +41 -0
- package/src/modules/workflow/services/lock.api.ts +17 -2
- package/src/modules/workspace/__tests__/useWorkspaceState.test.ts +49 -1
- package/src/modules/workspace/components/EditorTabs.tsx +39 -15
- package/src/modules/workspace/components/FileExplorer.tsx +39 -6
- package/src/modules/workspace/components/FilePaneCard.tsx +6 -2
- package/src/modules/workspace/components/FileRoute.tsx +12 -7
- package/src/modules/workspace/components/FileViewer.tsx +271 -74
- package/src/modules/workspace/components/KbPageHeader.tsx +13 -6
- package/src/modules/workspace/components/__tests__/EditorTabs.test.tsx +88 -21
- package/src/modules/workspace/components/__tests__/FileExplorer.test.tsx +101 -11
- package/src/modules/workspace/components/__tests__/FileRoute.test.tsx +23 -3
- package/src/modules/workspace/components/__tests__/FileViewer.test.tsx +330 -6
- package/src/modules/workspace/components/__tests__/KbPageHeader.test.tsx +17 -2
- package/src/modules/workspace/components/renderers/DocxRenderer.tsx +11 -16
- package/src/modules/workspace/components/renderers/DownloadFileButton.tsx +6 -0
- package/src/modules/workspace/components/renderers/EmailRenderer.tsx +23 -21
- package/src/modules/workspace/components/renderers/ImageRenderer.tsx +13 -29
- package/src/modules/workspace/components/renderers/KbMarkdownView.tsx +9 -2
- package/src/modules/workspace/components/renderers/MarkdownRenderer.tsx +8 -0
- package/src/modules/workspace/components/renderers/PdfRenderer.tsx +14 -19
- package/src/modules/workspace/components/renderers/PptxRenderer.tsx +11 -17
- package/src/modules/workspace/components/renderers/ToolRenderer.tsx +35 -7
- package/src/modules/workspace/components/renderers/XlsxRenderer.tsx +11 -17
- package/src/modules/workspace/components/renderers/__tests__/EmailRenderer.links.test.tsx +73 -0
- package/src/modules/workspace/components/renderers/__tests__/ToolRenderer.scaffold.test.tsx +64 -0
- package/src/modules/workspace/components/renderers/__tests__/ToolRenderer.surface.test.tsx +82 -0
- package/src/modules/workspace/components/renderers/__tests__/bridgeHarness.ts +99 -0
- package/src/modules/workspace/components/renderers/__tests__/htmlSandbox.test.ts +129 -35
- package/src/modules/workspace/components/renderers/__tests__/htmlViewsGuide.test.ts +149 -0
- package/src/modules/workspace/components/renderers/__tests__/kbMarkdownLinkPolicy.test.tsx +100 -0
- package/src/modules/workspace/components/renderers/htmlSandbox.ts +76 -20
- package/src/modules/workspace/components/renderers/index.ts +26 -0
- package/src/modules/workspace/components/renderers/kbMarkdownPipeline.tsx +51 -1
- package/src/modules/workspace/components/renderers/rendererRawRead.ts +53 -0
- package/src/modules/workspace/components/renderers/rendererSurface.ts +109 -0
- package/src/modules/workspace/components/renderers/rendererWorkspace.ts +8 -2
- package/src/modules/workspace/hooks/__tests__/useWorkspaceState.test.tsx +126 -21
- package/src/modules/workspace/hooks/useCreatePage.ts +116 -0
- package/src/modules/workspace/hooks/useWorkspaceImageResolver.ts +24 -7
- package/src/modules/workspace/hooks/useWorkspaceState.ts +42 -8
- package/src/modules/workspace/routing/__tests__/kb-routes.test.tsx +10 -0
- package/src/modules/workspace/routing/__tests__/md-links-parity.test.tsx +113 -0
- package/src/modules/workspace/routing/kb-routes.ts +66 -12
- package/src/modules/workspace/state/editable-page.ts +42 -0
- package/src/modules/workspace/state/workspace.context.ts +13 -4
- package/src/modules/workspace/utils/__tests__/display-file-name.test.ts +60 -0
- package/src/modules/workspace/utils/__tests__/fileTree.test.ts +75 -0
- package/src/modules/workspace/utils/__tests__/treeConfirm.test.ts +26 -14
- package/src/modules/workspace/utils/display-file-name.ts +102 -0
- package/src/modules/workspace/utils/fileTree.ts +49 -14
- package/src/modules/workspace/utils/treeConfirm.ts +22 -5
- package/src/shared/__tests__/no-builtin-confirm.test.ts +102 -0
- package/src/shared/components/ConfirmProvider.tsx +156 -0
- package/src/shared/components/Dialog.tsx +7 -0
- package/src/shared/components/__tests__/ConfirmProvider.test.tsx +198 -0
- package/src/shared/components/confirm-context.ts +94 -0
- package/src/shared/components/index.ts +3 -0
- package/src/shared/mcp/__tests__/connect-snippets.test.ts +2 -2
- package/src/shared/mcp/connect-snippets.ts +8 -5
- package/src/modules/onboarding/components/WelcomeRoute.tsx +0 -57
- package/src/modules/onboarding/welcome-state.ts +0 -36
|
@@ -39,13 +39,20 @@ export function ManifestButton({
|
|
|
39
39
|
kbDirName,
|
|
40
40
|
folder,
|
|
41
41
|
canWrite,
|
|
42
|
+
managed,
|
|
42
43
|
}: {
|
|
43
44
|
kbDirName: string | null;
|
|
44
45
|
folder: string;
|
|
45
46
|
canWrite: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* False for a plugin read from the bundle format: its manifest is
|
|
49
|
+
* `plugin.bundle.json`, edited in its own repository and read-only here, so
|
|
50
|
+
* there are no settings this button could open.
|
|
51
|
+
*/
|
|
52
|
+
managed: boolean;
|
|
46
53
|
}) {
|
|
47
54
|
const navigate = useNavigate();
|
|
48
|
-
if (!canWrite || !kbDirName) return null;
|
|
55
|
+
if (!managed || !canWrite || !kbDirName) return null;
|
|
49
56
|
return (
|
|
50
57
|
<Button
|
|
51
58
|
variant="quiet"
|
|
@@ -55,8 +62,9 @@ export function ManifestButton({
|
|
|
55
62
|
state: { rawFile: true },
|
|
56
63
|
})
|
|
57
64
|
}
|
|
65
|
+
title={PLUGIN_MANIFEST_FILE}
|
|
58
66
|
>
|
|
59
|
-
|
|
67
|
+
Edit plugin settings
|
|
60
68
|
</Button>
|
|
61
69
|
);
|
|
62
70
|
}
|
|
@@ -126,8 +134,17 @@ export function ManifestSection({
|
|
|
126
134
|
<span className="flex w-3 flex-none items-center justify-center">
|
|
127
135
|
<ChevronRight size={11} className={cn('transition-transform duration-150', open && 'rotate-90')} />
|
|
128
136
|
</span>
|
|
129
|
-
|
|
130
|
-
|
|
137
|
+
{/* The native manifest is the plugin's settings, by the name the
|
|
138
|
+
rest of the app gives it; the bundle dialect's file is a format
|
|
139
|
+
from elsewhere and keeps its technical label. */}
|
|
140
|
+
{managed ? (
|
|
141
|
+
<span title={file}>Plugin settings</span>
|
|
142
|
+
) : (
|
|
143
|
+
<>
|
|
144
|
+
Manifest
|
|
145
|
+
<span className="font-mono normal-case tracking-normal text-ink-faint">{file}</span>
|
|
146
|
+
</>
|
|
147
|
+
)}
|
|
131
148
|
</button>
|
|
132
149
|
{/* The panel is always in the tree, so the button's `aria-controls`
|
|
133
150
|
names an element that exists; only its CONTENT waits for `open`
|
|
@@ -143,7 +160,7 @@ export function ManifestSection({
|
|
|
143
160
|
: 'Read from the bundle format; it is edited in its own repository.'}
|
|
144
161
|
</p>
|
|
145
162
|
{current?.failed ? (
|
|
146
|
-
<p className="text-detail text-ink-muted">Couldn't read {file}.</p>
|
|
163
|
+
<p className="text-detail text-ink-muted">Couldn't read {managed ? 'the plugin settings' : file}.</p>
|
|
147
164
|
) : current?.text == null ? (
|
|
148
165
|
<p className="text-detail text-ink-faint">Loading…</p>
|
|
149
166
|
) : (
|
|
@@ -158,7 +175,7 @@ export function ManifestSection({
|
|
|
158
175
|
className="mt-2"
|
|
159
176
|
onClick={() => navigate(kbFileUrl(DEFAULT_BRANCH, path), { state: { rawFile: true } })}
|
|
160
177
|
>
|
|
161
|
-
Edit
|
|
178
|
+
Edit plugin settings
|
|
162
179
|
</Button>
|
|
163
180
|
)}
|
|
164
181
|
</>
|
|
@@ -381,7 +381,12 @@ export function PluginPage() {
|
|
|
381
381
|
</h1>
|
|
382
382
|
</div>
|
|
383
383
|
<div className="flex flex-none items-center gap-1">
|
|
384
|
-
<ManifestButton
|
|
384
|
+
<ManifestButton
|
|
385
|
+
kbDirName={kbDirName}
|
|
386
|
+
folder={folderBelowRoot}
|
|
387
|
+
canWrite={summary?.canWrite === true}
|
|
388
|
+
managed={summary?.linksAreManaged !== false}
|
|
389
|
+
/>
|
|
385
390
|
<PageActions
|
|
386
391
|
onShare={primaryFolder ? () => setManageFolder(primaryFolder) : undefined}
|
|
387
392
|
// The dialog needs both to mount (`addOpen && summary &&
|
|
@@ -12,7 +12,7 @@ import { libraryHomeForItemPath, pathForPlugin, LIBRARY_ROOT } from '../../route
|
|
|
12
12
|
import { useLibrary } from '../../state/library-data';
|
|
13
13
|
import { pluginHoldingPath, pluginLabel, pluginNameForPath } from '../../utils/plugin-summary';
|
|
14
14
|
import { readOAuthFragment } from '../../utils/oauth-fragment';
|
|
15
|
-
import type { ToolCapability } from '../../services/tools.api';
|
|
15
|
+
import type { HiddenTool, ToolCapability } from '../../services/tools.api';
|
|
16
16
|
import type { LibrarySkillSummary } from '../../services/library.api';
|
|
17
17
|
import { ToolConnectionSection } from './ToolConnectionSection';
|
|
18
18
|
import { ToolLogo } from '../ToolLogo';
|
|
@@ -277,6 +277,15 @@ export function ToolPage({
|
|
|
277
277
|
/>
|
|
278
278
|
)}
|
|
279
279
|
|
|
280
|
+
{/* Above the capabilities, because it is the one thing on this page that
|
|
281
|
+
asks the reader to act, and because a tool missing from the
|
|
282
|
+
assistant's list is read as a Hexis fault until this says otherwise.
|
|
283
|
+
The backend sends it only to a writer of this tool, so there is no
|
|
284
|
+
permission check here. */}
|
|
285
|
+
{page.detail && (page.detail.hiddenTools?.length ?? 0) > 0 && (
|
|
286
|
+
<HiddenToolsSection tools={page.detail.hiddenTools ?? []} />
|
|
287
|
+
)}
|
|
288
|
+
|
|
280
289
|
{page.detail && page.detail.capabilities.length > 0 && (
|
|
281
290
|
<CapabilitiesSection capabilities={page.detail.capabilities} />
|
|
282
291
|
)}
|
|
@@ -335,6 +344,41 @@ function SectionHeading({ children }: { children: ReactNode }) {
|
|
|
335
344
|
return <h2 className="mb-2.5 text-label font-semibold uppercase text-ink-faint">{children}</h2>;
|
|
336
345
|
}
|
|
337
346
|
|
|
347
|
+
/**
|
|
348
|
+
* The tools of this server no agent is offered, because their input schema is
|
|
349
|
+
* not valid JSON Schema as the server sent it.
|
|
350
|
+
*
|
|
351
|
+
* This is the whole reason the check exists. An AI client handed such a tool
|
|
352
|
+
* drops it and says nothing — the tool is simply missing for the agent — so
|
|
353
|
+
* without this section the only symptom is a capability that quietly does not
|
|
354
|
+
* work, with nothing anywhere to look at. Each entry names the tool and quotes
|
|
355
|
+
* the place in the schema and the reason, which is what the server's vendor
|
|
356
|
+
* needs to hear; Hexis does not rewrite the schema to make it valid.
|
|
357
|
+
*/
|
|
358
|
+
function HiddenToolsSection({ tools }: { tools: HiddenTool[] }) {
|
|
359
|
+
return (
|
|
360
|
+
<section className="mt-8">
|
|
361
|
+
<SectionHeading>Not offered to assistants</SectionHeading>
|
|
362
|
+
<Banner tone="urgent" role="note">
|
|
363
|
+
<ul className="space-y-1.5">
|
|
364
|
+
{tools.map((t) => (
|
|
365
|
+
<li key={t.name}>
|
|
366
|
+
<span className="font-semibold">{t.name}</span>
|
|
367
|
+
<span> — {t.marker}</span>
|
|
368
|
+
</li>
|
|
369
|
+
))}
|
|
370
|
+
</ul>
|
|
371
|
+
</Banner>
|
|
372
|
+
<p className="mt-2 text-detail text-ink-muted">
|
|
373
|
+
{tools.length === 1 ? 'This tool is' : 'These tools are'} absent from every assistant's tool
|
|
374
|
+
list until the server sends a valid schema. The rest of this server's tools are unaffected,
|
|
375
|
+
and nothing here is rewritten to make the schema valid. The check runs when the server's
|
|
376
|
+
tools are loaded, so a corrected schema clears this on its own.
|
|
377
|
+
</p>
|
|
378
|
+
</section>
|
|
379
|
+
);
|
|
380
|
+
}
|
|
381
|
+
|
|
338
382
|
function CapabilitiesSection({ capabilities }: { capabilities: ToolCapability[] }) {
|
|
339
383
|
return (
|
|
340
384
|
<section className="mt-8">
|
|
@@ -7,7 +7,7 @@ import { LibraryPage } from '../components/LibraryPage';
|
|
|
7
7
|
import { PluginPage } from '../components/PluginPage';
|
|
8
8
|
import { PersonalPluginPage } from '../components/PersonalPluginPage';
|
|
9
9
|
import { TeamRoute } from '../components/TeamRoute';
|
|
10
|
-
import {
|
|
10
|
+
import { WelcomePage } from '../../onboarding/components/WelcomePage';
|
|
11
11
|
import { WorkspaceItemRoute } from './WorkspaceItemRoute';
|
|
12
12
|
import { decodePluginSegment, LIBRARY_ROOT, pathForPlugin, urlForLibraryItem, urlForSkillFile } from './library-paths';
|
|
13
13
|
|
|
@@ -33,9 +33,10 @@ export function LibraryRoutes() {
|
|
|
33
33
|
<Routes>
|
|
34
34
|
<Route element={<LibraryLayout />}>
|
|
35
35
|
{/* The Library OPENS on Everything: plugins, skills and tools, the
|
|
36
|
-
whole catalog with the library-wide search
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
whole catalog with the library-wide search — or, for an admin
|
|
37
|
+
whose catalog is still empty, the creator welcome in its place
|
|
38
|
+
(see `LibraryPage`). `everything` is the same page at the URL
|
|
39
|
+
it used to have, so older links still land. */}
|
|
39
40
|
<Route index element={<LibraryPage filter={{ kind: 'all' }} />} />
|
|
40
41
|
<Route path="everything" element={<Navigate to={LIBRARY_ROOT} replace />} />
|
|
41
42
|
|
|
@@ -46,9 +47,9 @@ export function LibraryRoutes() {
|
|
|
46
47
|
|
|
47
48
|
{/* The connect-your-agent welcome — inside the layout, so the
|
|
48
49
|
sidebar (and the pill's selected state) is on screen with it.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
<Route path="welcome" element={<
|
|
50
|
+
Never reached automatically (see `RootLanding`): opened from
|
|
51
|
+
the pill, the Get set up list and by URL. */}
|
|
52
|
+
<Route path="welcome" element={<WelcomePage />} />
|
|
52
53
|
|
|
53
54
|
<Route path="owned" element={<LibraryPage filter={{ kind: 'owned' }} />} />
|
|
54
55
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { authFetch } from '../../../lib/api';
|
|
2
2
|
import { handleApiResponse } from '../../git/services/git.api';
|
|
3
|
+
import { notePluginCreated } from '../state/plugins-revision';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Plugin enumeration + join requests — the browser half of the backend's
|
|
@@ -141,7 +142,9 @@ export async function createPlugin(
|
|
|
141
142
|
const body = (await res.json().catch(() => ({}))) as { error?: string };
|
|
142
143
|
throw new Error(body.error ?? "Couldn't create that plugin.");
|
|
143
144
|
}
|
|
144
|
-
|
|
145
|
+
const created = (await res.json()) as { folder: string; name: string; displayName: string };
|
|
146
|
+
notePluginCreated();
|
|
147
|
+
return created;
|
|
145
148
|
}
|
|
146
149
|
|
|
147
150
|
/**
|
|
@@ -21,6 +21,26 @@ export interface ToolCapability {
|
|
|
21
21
|
description: string | null;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
* One tool of this server that Hexis keeps off every agent surface because its
|
|
26
|
+
* input schema is not valid JSON Schema as the server sent it.
|
|
27
|
+
*
|
|
28
|
+
* The backend sends these ONLY to a caller who may write the tool: the people
|
|
29
|
+
* who manage the server are the only ones who can get the schema fixed, and a
|
|
30
|
+
* reader has nothing to do with the knowledge. So the page may render whatever
|
|
31
|
+
* arrives, with no permission check of its own.
|
|
32
|
+
*/
|
|
33
|
+
export interface HiddenTool {
|
|
34
|
+
/** The name the tool would have been offered to agents under. */
|
|
35
|
+
name: string;
|
|
36
|
+
/** JSON Pointer to the place in the schema that is not valid. */
|
|
37
|
+
path: string;
|
|
38
|
+
/** Why that place is not valid, in the validator's own words. */
|
|
39
|
+
reason: string;
|
|
40
|
+
/** The sentence to show, built on the server so every surface says the same thing. */
|
|
41
|
+
marker: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
24
44
|
export interface ToolManualDetail {
|
|
25
45
|
slug: string;
|
|
26
46
|
name: string;
|
|
@@ -35,6 +55,13 @@ export interface ToolManualDetail {
|
|
|
35
55
|
* same "nothing to show" as a remote one.
|
|
36
56
|
*/
|
|
37
57
|
capabilities: ToolCapability[];
|
|
58
|
+
/**
|
|
59
|
+
* Hidden-for-an-invalid-schema findings about THIS tool's server. Empty for
|
|
60
|
+
* a healthy server, and empty for a caller who may not write the tool.
|
|
61
|
+
* Optional on the wire so the page still renders against a backend that does
|
|
62
|
+
* not serve the field yet.
|
|
63
|
+
*/
|
|
64
|
+
hiddenTools?: HiddenTool[];
|
|
38
65
|
}
|
|
39
66
|
|
|
40
67
|
async function unwrap(res: Response, fallback: string): Promise<never> {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useSyncExternalStore } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* How many plugins this tab has created — a signal for readers OUTSIDE the
|
|
5
|
+
* Library's provider (the Get set up column sits beside both apps) that need
|
|
6
|
+
* to hear "a plugin now exists" without asking `GET /api/plugins` on every
|
|
7
|
+
* navigation. Bumped by `createPlugin` once the server has made it.
|
|
8
|
+
*/
|
|
9
|
+
let revision = 0;
|
|
10
|
+
const listeners = new Set<() => void>();
|
|
11
|
+
|
|
12
|
+
function subscribe(listener: () => void): () => void {
|
|
13
|
+
listeners.add(listener);
|
|
14
|
+
return () => listeners.delete(listener);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const snapshot = () => revision;
|
|
18
|
+
|
|
19
|
+
/** A plugin was just created in this tab. */
|
|
20
|
+
export function notePluginCreated(): void {
|
|
21
|
+
revision++;
|
|
22
|
+
listeners.forEach((l) => l());
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** The current count, re-rendering the caller whenever it moves. */
|
|
26
|
+
export function usePluginsRevision(): number {
|
|
27
|
+
return useSyncExternalStore(subscribe, snapshot, snapshot);
|
|
28
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { fetchAgentConnection } from '../services/agent-connection.api';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `GET /api/onboarding/agent-connection`, read field by field: the two
|
|
6
|
+
* documented shapes come through, and anything else is a failure — never a
|
|
7
|
+
* quiet "not connected", and never a stray value steering the first-page
|
|
8
|
+
* step's links.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const { authFetchMock } = vi.hoisted(() => ({ authFetchMock: vi.fn() }));
|
|
12
|
+
vi.mock('../../../lib/api', () => ({ authFetch: authFetchMock }));
|
|
13
|
+
|
|
14
|
+
function answer(body: unknown, status = 200) {
|
|
15
|
+
authFetchMock.mockResolvedValueOnce({ ok: status < 400, status, json: async () => body } as Response);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
beforeEach(() => {
|
|
19
|
+
authFetchMock.mockReset();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
describe('fetchAgentConnection', () => {
|
|
23
|
+
it('reads "not yet"', async () => {
|
|
24
|
+
answer({ connected: false });
|
|
25
|
+
await expect(fetchAgentConnection()).resolves.toEqual({ connected: false });
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('reads "connected", with when, as what and through which kind of credential', async () => {
|
|
29
|
+
answer({ connected: true, at: '2026-10-07T12:00:00.000Z', client: 'Claude', kind: 'agent' });
|
|
30
|
+
await expect(fetchAgentConnection()).resolves.toEqual({
|
|
31
|
+
connected: true,
|
|
32
|
+
at: '2026-10-07T12:00:00.000Z',
|
|
33
|
+
client: 'Claude',
|
|
34
|
+
kind: 'agent',
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('throws on a refusal', async () => {
|
|
39
|
+
answer({ error: 'nope' }, 401);
|
|
40
|
+
await expect(fetchAgentConnection()).rejects.toThrow('agent-connection: 401');
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it.each([
|
|
44
|
+
['null', null],
|
|
45
|
+
['an array', []],
|
|
46
|
+
['no connected flag', { client: 'Claude' }],
|
|
47
|
+
['a connected flag that is not a boolean', { connected: 'yes' }],
|
|
48
|
+
['a non-string time', { connected: true, at: 1700000000000 }],
|
|
49
|
+
['a non-string client', { connected: true, client: { name: 'Claude' } }],
|
|
50
|
+
['an unknown kind', { connected: true, client: 'Claude', kind: 'oauth' }],
|
|
51
|
+
])('throws on a malformed body: %s', async (_label, body) => {
|
|
52
|
+
answer(body);
|
|
53
|
+
await expect(fetchAgentConnection()).rejects.toThrow('agent-connection: malformed body');
|
|
54
|
+
});
|
|
55
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
-
import { render,
|
|
2
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
3
3
|
import userEvent from '@testing-library/user-event';
|
|
4
4
|
import { MemoryRouter, Route, Routes, useLocation } from 'react-router-dom';
|
|
5
5
|
import type { ReactNode } from 'react';
|
|
@@ -9,11 +9,20 @@ import { authValue } from '../../library/__tests__/auth-harness';
|
|
|
9
9
|
import { LibraryContext } from '../../library/state/library-context';
|
|
10
10
|
import type { LibraryContextValue } from '../../library/state/library-data';
|
|
11
11
|
import { LibraryToastProvider } from '../../library/state/toast';
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
12
|
+
import { LibraryPage } from '../../library/components/LibraryPage';
|
|
13
|
+
import { LIBRARY_ROOT } from '../../library/routes/library-paths';
|
|
14
|
+
import type { LibraryFilter } from '../../library/utils/status';
|
|
15
|
+
import { WorkspaceContext } from '../../workspace/state/workspace.context';
|
|
16
|
+
import { makeWorkspaceFixture } from '../../workspace/__tests__/testFixtures';
|
|
15
17
|
import { resetOnboardingForTests } from '../state/onboarding';
|
|
16
18
|
|
|
19
|
+
/**
|
|
20
|
+
* The creator welcome: Skills & Tools' empty state for an admin. The page the
|
|
21
|
+
* Library opens on (Everything) offers a first plugin and a first skill in
|
|
22
|
+
* place of an empty gallery — only for an admin, only once both indexes have
|
|
23
|
+
* answered empty, and only there.
|
|
24
|
+
*/
|
|
25
|
+
|
|
17
26
|
const serviceMocks = vi.hoisted(() => ({
|
|
18
27
|
createPlugin: vi.fn(),
|
|
19
28
|
createEmptySkill: vi.fn(),
|
|
@@ -21,7 +30,8 @@ const serviceMocks = vi.hoisted(() => ({
|
|
|
21
30
|
|
|
22
31
|
vi.mock('../../library/services/plugins.api', async (importOriginal) => {
|
|
23
32
|
const actual = await importOriginal<typeof import('../../library/services/plugins.api')>();
|
|
24
|
-
|
|
33
|
+
// The gallery asks for join requests to show; nobody is asking here.
|
|
34
|
+
return { ...actual, createPlugin: serviceMocks.createPlugin, listJoinRequests: vi.fn().mockResolvedValue([]) };
|
|
25
35
|
});
|
|
26
36
|
|
|
27
37
|
vi.mock('../../library/services/library.api', async (importOriginal) => {
|
|
@@ -91,18 +101,19 @@ function providers(
|
|
|
91
101
|
})}
|
|
92
102
|
>
|
|
93
103
|
<AdminContext.Provider value={admin(options.admin)}>
|
|
94
|
-
<
|
|
95
|
-
<
|
|
96
|
-
|
|
104
|
+
<WorkspaceContext.Provider value={makeWorkspaceFixture()}>
|
|
105
|
+
<LibraryContext.Provider value={library(options.library)}>
|
|
106
|
+
<LibraryToastProvider>{children}</LibraryToastProvider>
|
|
107
|
+
</LibraryContext.Provider>
|
|
108
|
+
</WorkspaceContext.Provider>
|
|
97
109
|
</AdminContext.Provider>
|
|
98
110
|
</AuthContext.Provider>
|
|
99
111
|
);
|
|
100
112
|
}
|
|
101
113
|
|
|
102
114
|
interface WelcomeOptions {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
routeState?: Record<string, unknown>;
|
|
115
|
+
/** The Library view on screen; Everything, the page it opens on, unless said. */
|
|
116
|
+
filter?: LibraryFilter;
|
|
106
117
|
admin?: Partial<AdminContextValue>;
|
|
107
118
|
library?: Partial<LibraryContextValue>;
|
|
108
119
|
}
|
|
@@ -113,16 +124,12 @@ interface WelcomeOptions {
|
|
|
113
124
|
* hand-assembling a second copy that can drift from this one.
|
|
114
125
|
*/
|
|
115
126
|
function welcomeUi(options: WelcomeOptions = {}) {
|
|
116
|
-
const entry = options.greeted === false
|
|
117
|
-
? WELCOME_PATH
|
|
118
|
-
: { pathname: WELCOME_PATH, state: options.routeState ?? { greeting: true } };
|
|
119
|
-
|
|
120
127
|
return (
|
|
121
|
-
<MemoryRouter initialEntries={[
|
|
128
|
+
<MemoryRouter initialEntries={[LIBRARY_ROOT]}>
|
|
122
129
|
{providers(
|
|
123
130
|
<>
|
|
124
131
|
<Routes>
|
|
125
|
-
<Route path={
|
|
132
|
+
<Route path={LIBRARY_ROOT} element={<LibraryPage filter={options.filter ?? { kind: 'all' }} />} />
|
|
126
133
|
<Route path="/skills-and-tools/plugins/:plugin" element={<div>plugin page</div>} />
|
|
127
134
|
<Route path="/skills-and-tools/skills/:skill" element={<div>skill page</div>} />
|
|
128
135
|
</Routes>
|
|
@@ -138,9 +145,23 @@ function renderWelcome(options: WelcomeOptions = {}) {
|
|
|
138
145
|
return render(welcomeUi(options));
|
|
139
146
|
}
|
|
140
147
|
|
|
148
|
+
const ROADMAP_SKILL: LibraryContextValue['items'][number] = {
|
|
149
|
+
kind: 'skill',
|
|
150
|
+
id: 'roadmap',
|
|
151
|
+
name: 'roadmap',
|
|
152
|
+
description: 'Keeps the roadmap current.',
|
|
153
|
+
owned: true,
|
|
154
|
+
canWrite: true,
|
|
155
|
+
status: { state: 'ok', text: 'Ready' },
|
|
156
|
+
plugin: null,
|
|
157
|
+
path: 'Skills/roadmap',
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
const isCreatorWelcome = () => screen.queryByText(/Build the shared library/) !== null;
|
|
161
|
+
const isGallery = () => screen.queryByRole('heading', { name: 'Everything', level: 1 }) !== null;
|
|
162
|
+
|
|
141
163
|
beforeEach(() => {
|
|
142
164
|
resetOnboardingForTests();
|
|
143
|
-
setSidebarCollapsed(false, true);
|
|
144
165
|
serviceMocks.createPlugin.mockReset();
|
|
145
166
|
serviceMocks.createPlugin.mockResolvedValue({ folder: 'Design', name: 'design' });
|
|
146
167
|
serviceMocks.createEmptySkill.mockReset();
|
|
@@ -152,92 +173,76 @@ beforeEach(() => {
|
|
|
152
173
|
});
|
|
153
174
|
});
|
|
154
175
|
|
|
155
|
-
describe('creator welcome
|
|
156
|
-
it('welcomes an admin to build a truly empty library', () => {
|
|
176
|
+
describe('creator welcome: the empty state of Skills & Tools', () => {
|
|
177
|
+
it('welcomes an admin to build a truly empty library, in place of the gallery', () => {
|
|
157
178
|
renderWelcome();
|
|
158
179
|
|
|
159
180
|
expect(screen.getByRole('heading', { name: 'Welcome, Juan' })).toBeInTheDocument();
|
|
160
181
|
expect(screen.getByText(/Build the shared library/)).toBeInTheDocument();
|
|
161
182
|
expect(screen.getByRole('button', { name: 'Create a plugin' })).toBeInTheDocument();
|
|
162
183
|
expect(screen.getByRole('button', { name: 'Create a skill' })).toBeInTheDocument();
|
|
163
|
-
expect(
|
|
184
|
+
expect(isGallery()).toBe(false);
|
|
164
185
|
});
|
|
165
186
|
|
|
166
|
-
it('keeps the
|
|
187
|
+
it('keeps the gallery for members, whose job is not the shared structure', () => {
|
|
167
188
|
renderWelcome({ admin: { isAdmin: false } });
|
|
168
189
|
|
|
169
|
-
expect(
|
|
170
|
-
expect(
|
|
190
|
+
expect(isGallery()).toBe(true);
|
|
191
|
+
expect(isCreatorWelcome()).toBe(false);
|
|
171
192
|
});
|
|
172
193
|
|
|
173
|
-
it('keeps the
|
|
174
|
-
renderWelcome({
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
+
it('keeps the gallery once the catalog holds anything — a skill, or a plugin', () => {
|
|
195
|
+
const { rerender } = renderWelcome({ library: { items: [ROADMAP_SKILL] } });
|
|
196
|
+
expect(isGallery()).toBe(true);
|
|
197
|
+
expect(isCreatorWelcome()).toBe(false);
|
|
198
|
+
|
|
199
|
+
rerender(
|
|
200
|
+
welcomeUi({
|
|
201
|
+
library: {
|
|
202
|
+
pluginSummaries: [
|
|
203
|
+
{
|
|
204
|
+
name: 'GTM',
|
|
205
|
+
folders: ['Plugins/GTM'],
|
|
206
|
+
canRead: true,
|
|
207
|
+
canWrite: true,
|
|
208
|
+
isOwner: true,
|
|
209
|
+
skillCount: 0,
|
|
210
|
+
toolCount: 0,
|
|
211
|
+
owners: { roles: [], users: [] },
|
|
212
|
+
writers: { roles: [], users: [] },
|
|
213
|
+
readers: { roles: [], users: [], restricted: false },
|
|
214
|
+
hasRequested: false,
|
|
215
|
+
requestNumber: null,
|
|
216
|
+
},
|
|
217
|
+
],
|
|
218
|
+
},
|
|
219
|
+
}),
|
|
220
|
+
);
|
|
221
|
+
expect(isCreatorWelcome()).toBe(false);
|
|
194
222
|
});
|
|
195
223
|
|
|
196
|
-
it('does not mistake loading or failed
|
|
197
|
-
// While the ADMIN verdict is unknown the hold says nothing about a
|
|
198
|
-
// library — the reader may be headed for the agent welcome, where theirs
|
|
199
|
-
// is beside the point.
|
|
224
|
+
it('does not mistake an unsettled admin verdict, or loading or failed indexes, for an empty library', () => {
|
|
200
225
|
const { rerender } = renderWelcome({ admin: { isAdminLoading: true } });
|
|
201
|
-
expect(
|
|
226
|
+
expect(isCreatorWelcome()).toBe(false);
|
|
202
227
|
|
|
203
|
-
rerender(welcomeUi({ library: {
|
|
228
|
+
rerender(welcomeUi({ library: { loading: true } }));
|
|
229
|
+
expect(isCreatorWelcome()).toBe(false);
|
|
204
230
|
|
|
205
|
-
|
|
206
|
-
|
|
231
|
+
rerender(welcomeUi({ library: { pluginsLoading: true } }));
|
|
232
|
+
expect(isCreatorWelcome()).toBe(false);
|
|
207
233
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
expect(screen.getByText('Preparing your library…')).toBeInTheDocument();
|
|
211
|
-
});
|
|
234
|
+
rerender(welcomeUi({ library: { pluginsError: "Couldn't load plugins." } }));
|
|
235
|
+
expect(isCreatorWelcome()).toBe(false);
|
|
212
236
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
// admin would otherwise be routed to the creator page — and lose the page
|
|
216
|
-
// their SSO round-trip was carrying them to.
|
|
217
|
-
renderWelcome({
|
|
218
|
-
routeState: {
|
|
219
|
-
greeting: true,
|
|
220
|
-
returnTo: '/workspace/main/knowledge-base/KnowledgeBase/Start here.md',
|
|
221
|
-
},
|
|
222
|
-
});
|
|
223
|
-
expect(screen.getByRole('radiogroup', { name: 'Your agent' })).toBeInTheDocument();
|
|
224
|
-
expect(screen.getByRole('button', { name: /Continue to your link/ })).toBeInTheDocument();
|
|
225
|
-
expect(screen.queryByText(/Build the shared library/)).toBeNull();
|
|
237
|
+
rerender(welcomeUi({ library: { error: "Couldn't load the library." } }));
|
|
238
|
+
expect(isCreatorWelcome()).toBe(false);
|
|
226
239
|
});
|
|
227
240
|
|
|
228
|
-
it('
|
|
229
|
-
renderWelcome({
|
|
241
|
+
it('is the empty state of Everything alone, not of every view', () => {
|
|
242
|
+
renderWelcome({ filter: { kind: 'owned' } });
|
|
230
243
|
|
|
231
|
-
expect(screen.getByRole('
|
|
232
|
-
expect(
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
it('collapses the sidebar before the creator welcome is shown', () => {
|
|
236
|
-
renderWelcome();
|
|
237
|
-
expect(renderHook(() => useSidebar()).result.current).toMatchObject({
|
|
238
|
-
collapsed: true,
|
|
239
|
-
instant: true,
|
|
240
|
-
});
|
|
244
|
+
expect(screen.getByRole('heading', { name: 'Owned by me', level: 1 })).toBeInTheDocument();
|
|
245
|
+
expect(isCreatorWelcome()).toBe(false);
|
|
241
246
|
});
|
|
242
247
|
});
|
|
243
248
|
|