@kelpie/ui 0.15.0 → 0.17.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/dist/api/client.d.ts +6 -5
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +2 -2
- package/dist/api/client.js.map +1 -1
- package/dist/api/resource.d.ts +4 -4
- package/dist/api/resource.d.ts.map +1 -1
- package/dist/api/resource.js +4 -5
- package/dist/api/resource.js.map +1 -1
- package/dist/api/resources/ai.d.ts +16 -0
- package/dist/api/resources/ai.d.ts.map +1 -0
- package/dist/api/resources/ai.js +93 -0
- package/dist/api/resources/ai.js.map +1 -0
- package/dist/api/resources/conversions.js +1 -1
- package/dist/api/resources/conversions.js.map +1 -1
- package/dist/api/resources/members.d.ts +2 -2
- package/dist/api/resources/oauth.d.ts +21 -0
- package/dist/api/resources/oauth.d.ts.map +1 -0
- package/dist/api/resources/oauth.js +74 -0
- package/dist/api/resources/oauth.js.map +1 -0
- package/dist/api/resources/planItems.d.ts +1 -1
- package/dist/api/resources/planItems.d.ts.map +1 -1
- package/dist/api/resources/planItems.js +1 -1
- package/dist/api/resources/planItems.js.map +1 -1
- package/dist/api/resources/session.d.ts +1 -1
- package/dist/api/resources/session.d.ts.map +1 -1
- package/dist/api/resources/session.js +4 -2
- package/dist/api/resources/session.js.map +1 -1
- package/dist/api/resources/workspace.d.ts +2 -2
- package/dist/api/resources/workspace.js +2 -2
- package/dist/app/KelpieApp.d.ts.map +1 -1
- package/dist/app/KelpieApp.js +3 -1
- package/dist/app/KelpieApp.js.map +1 -1
- package/dist/components/ActivitiesPanel.d.ts +7 -4
- package/dist/components/ActivitiesPanel.d.ts.map +1 -1
- package/dist/components/ActivitiesPanel.js +12 -2
- package/dist/components/ActivitiesPanel.js.map +1 -1
- package/dist/components/ActivityAction.d.ts +15 -0
- package/dist/components/ActivityAction.d.ts.map +1 -0
- package/dist/components/ActivityAction.js +20 -0
- package/dist/components/ActivityAction.js.map +1 -0
- package/dist/components/AgentTasks.d.ts +5 -0
- package/dist/components/AgentTasks.d.ts.map +1 -1
- package/dist/components/AgentTasks.js +88 -10
- package/dist/components/AgentTasks.js.map +1 -1
- package/dist/components/ApiKeysPanel.d.ts.map +1 -1
- package/dist/components/ApiKeysPanel.js +4 -1
- package/dist/components/ApiKeysPanel.js.map +1 -1
- package/dist/components/DecisionsPanel.d.ts.map +1 -1
- package/dist/components/DecisionsPanel.js +3 -1
- package/dist/components/DecisionsPanel.js.map +1 -1
- package/dist/components/LinkedText.d.ts +12 -0
- package/dist/components/LinkedText.d.ts.map +1 -0
- package/dist/components/LinkedText.js +25 -0
- package/dist/components/LinkedText.js.map +1 -0
- package/dist/components/MarkdownView.d.ts +3 -1
- package/dist/components/MarkdownView.d.ts.map +1 -1
- package/dist/components/MarkdownView.js +17 -3
- package/dist/components/MarkdownView.js.map +1 -1
- package/dist/components/NotesPanel.d.ts +2 -1
- package/dist/components/NotesPanel.d.ts.map +1 -1
- package/dist/components/NotesPanel.js +6 -7
- package/dist/components/NotesPanel.js.map +1 -1
- package/dist/components/Paginator.d.ts +1 -1
- package/dist/components/PlanPanel.d.ts.map +1 -1
- package/dist/components/PlanPanel.js +3 -1
- package/dist/components/PlanPanel.js.map +1 -1
- package/dist/components/RecordLinkTextarea.d.ts +12 -0
- package/dist/components/RecordLinkTextarea.d.ts.map +1 -0
- package/dist/components/RecordLinkTextarea.js +142 -0
- package/dist/components/RecordLinkTextarea.js.map +1 -0
- package/dist/components/Shell.js +1 -1
- package/dist/components/SummaryBlock.d.ts +1 -1
- package/dist/components/SummaryBlock.js +1 -1
- package/dist/components/WorkspaceSwitcher.d.ts +2 -1
- package/dist/components/WorkspaceSwitcher.d.ts.map +1 -1
- package/dist/components/WorkspaceSwitcher.js +7 -2
- package/dist/components/WorkspaceSwitcher.js.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/fragmentTarget.d.ts +18 -0
- package/dist/lib/fragmentTarget.d.ts.map +1 -0
- package/dist/lib/fragmentTarget.js +73 -0
- package/dist/lib/fragmentTarget.js.map +1 -0
- package/dist/lib/mcpConfig.d.ts +10 -0
- package/dist/lib/mcpConfig.d.ts.map +1 -0
- package/dist/lib/mcpConfig.js +23 -0
- package/dist/lib/mcpConfig.js.map +1 -0
- package/dist/lib/money.d.ts +2 -2
- package/dist/lib/money.js +2 -2
- package/dist/lib/recordLinks.d.ts +17 -0
- package/dist/lib/recordLinks.d.ts.map +1 -0
- package/dist/lib/recordLinks.js +48 -0
- package/dist/lib/recordLinks.js.map +1 -0
- package/dist/lib/recordReferences.d.ts +41 -0
- package/dist/lib/recordReferences.d.ts.map +1 -0
- package/dist/lib/recordReferences.js +92 -0
- package/dist/lib/recordReferences.js.map +1 -0
- package/dist/modules/ai.d.ts +13 -0
- package/dist/modules/ai.d.ts.map +1 -0
- package/dist/modules/ai.js +22 -0
- package/dist/modules/ai.js.map +1 -0
- package/dist/modules/aiRunner.d.ts +3 -0
- package/dist/modules/aiRunner.d.ts.map +1 -0
- package/dist/modules/aiRunner.js +66 -0
- package/dist/modules/aiRunner.js.map +1 -0
- package/dist/pages/CompanyDetail.d.ts.map +1 -1
- package/dist/pages/CompanyDetail.js +2 -1
- package/dist/pages/CompanyDetail.js.map +1 -1
- package/dist/pages/DealDetail.d.ts.map +1 -1
- package/dist/pages/DealDetail.js +2 -1
- package/dist/pages/DealDetail.js.map +1 -1
- package/dist/pages/DealsPage.js +1 -1
- package/dist/pages/DealsPage.js.map +1 -1
- package/dist/pages/DecisionsPage.d.ts.map +1 -1
- package/dist/pages/DecisionsPage.js +5 -3
- package/dist/pages/DecisionsPage.js.map +1 -1
- package/dist/pages/EnquiryDetail.d.ts.map +1 -1
- package/dist/pages/EnquiryDetail.js +2 -1
- package/dist/pages/EnquiryDetail.js.map +1 -1
- package/dist/pages/EventDetail.d.ts.map +1 -1
- package/dist/pages/EventDetail.js +2 -1
- package/dist/pages/EventDetail.js.map +1 -1
- package/dist/pages/FundraisingPage.js +1 -1
- package/dist/pages/FundraisingPage.js.map +1 -1
- package/dist/pages/OpportunitiesPage.js +1 -1
- package/dist/pages/OpportunitiesPage.js.map +1 -1
- package/dist/pages/OpportunityDetail.d.ts.map +1 -1
- package/dist/pages/OpportunityDetail.js +2 -1
- package/dist/pages/OpportunityDetail.js.map +1 -1
- package/dist/pages/PartnershipDetail.d.ts.map +1 -1
- package/dist/pages/PartnershipDetail.js +2 -1
- package/dist/pages/PartnershipDetail.js.map +1 -1
- package/dist/pages/PartnershipsPage.js +1 -1
- package/dist/pages/PartnershipsPage.js.map +1 -1
- package/dist/pages/PersonDetail.d.ts.map +1 -1
- package/dist/pages/PersonDetail.js +4 -3
- package/dist/pages/PersonDetail.js.map +1 -1
- package/dist/pages/RaiseDetail.d.ts.map +1 -1
- package/dist/pages/RaiseDetail.js +2 -1
- package/dist/pages/RaiseDetail.js.map +1 -1
- package/dist/pages/SearchPage.d.ts.map +1 -1
- package/dist/pages/SearchPage.js +26 -14
- package/dist/pages/SearchPage.js.map +1 -1
- package/dist/pages/account/AccountLayout.d.ts.map +1 -1
- package/dist/pages/account/AccountLayout.js +2 -1
- package/dist/pages/account/AccountLayout.js.map +1 -1
- package/dist/pages/account/ConnectedAppsPage.d.ts +7 -0
- package/dist/pages/account/ConnectedAppsPage.d.ts.map +1 -0
- package/dist/pages/account/ConnectedAppsPage.js +32 -0
- package/dist/pages/account/ConnectedAppsPage.js.map +1 -0
- package/dist/pages/admin/AiPage.d.ts +2 -0
- package/dist/pages/admin/AiPage.d.ts.map +1 -0
- package/dist/pages/admin/AiPage.js +134 -0
- package/dist/pages/admin/AiPage.js.map +1 -0
- package/dist/pages/admin/McpPage.d.ts.map +1 -1
- package/dist/pages/admin/McpPage.js +7 -15
- package/dist/pages/admin/McpPage.js.map +1 -1
- package/dist/pages/admin/ModulesPage.d.ts.map +1 -1
- package/dist/pages/admin/ModulesPage.js +5 -4
- package/dist/pages/admin/ModulesPage.js.map +1 -1
- package/dist/pages/admin/WorkspaceSettingsPage.d.ts +5 -6
- package/dist/pages/admin/WorkspaceSettingsPage.d.ts.map +1 -1
- package/dist/pages/admin/WorkspaceSettingsPage.js +12 -17
- package/dist/pages/admin/WorkspaceSettingsPage.js.map +1 -1
- package/dist/pages/auth/AuthLayout.d.ts +1 -1
- package/dist/pages/auth/AuthLayout.d.ts.map +1 -1
- package/dist/pages/auth/AuthLayout.js +1 -1
- package/dist/pages/auth/AuthLayout.js.map +1 -1
- package/dist/pages/auth/SignUpPage.d.ts +1 -1
- package/dist/pages/auth/SignUpPage.js +1 -1
- package/dist/pages/dashboard/attention.d.ts +0 -5
- package/dist/pages/dashboard/attention.d.ts.map +1 -1
- package/dist/pages/dashboard/attention.js +1 -21
- package/dist/pages/dashboard/attention.js.map +1 -1
- package/dist/pages/dashboard/sections.d.ts.map +1 -1
- package/dist/pages/dashboard/sections.js +6 -3
- package/dist/pages/dashboard/sections.js.map +1 -1
- package/dist/pages/forms/SubmissionDetail.js +1 -1
- package/dist/pages/forms/SubmissionDetail.js.map +1 -1
- package/dist/pages/forms/SubmissionsTable.d.ts.map +1 -1
- package/dist/pages/forms/SubmissionsTable.js +4 -3
- package/dist/pages/forms/SubmissionsTable.js.map +1 -1
- package/dist/pages/handbook/HandbookPage.d.ts.map +1 -1
- package/dist/pages/handbook/HandbookPage.js +2 -3
- package/dist/pages/handbook/HandbookPage.js.map +1 -1
- package/dist/pages/hiringDirectory.js +2 -2
- package/dist/pages/hiringDirectory.js.map +1 -1
- package/dist/pages/oauth/ConsentPage.d.ts +14 -0
- package/dist/pages/oauth/ConsentPage.d.ts.map +1 -0
- package/dist/pages/oauth/ConsentPage.js +87 -0
- package/dist/pages/oauth/ConsentPage.js.map +1 -0
- package/dist/pages/onboarding/WorkspaceStepPage.d.ts.map +1 -1
- package/dist/pages/onboarding/WorkspaceStepPage.js +9 -27
- package/dist/pages/onboarding/WorkspaceStepPage.js.map +1 -1
- package/dist/pages/onboarding/onboardingModules.d.ts +1 -1
- package/dist/pages/onboarding/onboardingRerun.d.ts +10 -1
- package/dist/pages/onboarding/onboardingRerun.d.ts.map +1 -1
- package/dist/pages/onboarding/onboardingRerun.js +12 -1
- package/dist/pages/onboarding/onboardingRerun.js.map +1 -1
- package/dist/pages/positionDirectory.js +2 -2
- package/dist/pages/positionDirectory.js.map +1 -1
- package/dist/registry/context.d.ts +3 -1
- package/dist/registry/context.d.ts.map +1 -1
- package/dist/registry/context.js +4 -0
- package/dist/registry/context.js.map +1 -1
- package/dist/registry/contributions.d.ts +39 -1
- package/dist/registry/contributions.d.ts.map +1 -1
- package/dist/registry/contributions.js +1 -1
- package/dist/registry/overridable.d.ts +1 -1
- package/dist/registry/registry.d.ts +8 -4
- package/dist/registry/registry.d.ts.map +1 -1
- package/dist/registry/registry.js +9 -1
- package/dist/registry/registry.js.map +1 -1
- package/package.json +2 -2
- package/src/api/client.ts +7 -6
- package/src/api/resource.ts +6 -7
- package/src/api/resources/ai.ts +110 -0
- package/src/api/resources/conversions.ts +1 -1
- package/src/api/resources/members.ts +2 -2
- package/src/api/resources/oauth.ts +112 -0
- package/src/api/resources/planItems.ts +1 -1
- package/src/api/resources/session.ts +4 -2
- package/src/api/resources/workspace.ts +4 -4
- package/src/app/KelpieApp.tsx +6 -0
- package/src/components/ActivitiesPanel.tsx +39 -10
- package/src/components/ActivityAction.tsx +33 -0
- package/src/components/AgentTasks.tsx +138 -10
- package/src/components/ApiKeysPanel.tsx +17 -0
- package/src/components/DecisionsPanel.tsx +9 -1
- package/src/components/LinkedText.tsx +51 -0
- package/src/components/MarkdownView.tsx +37 -7
- package/src/components/NotesPanel.tsx +18 -12
- package/src/components/Paginator.tsx +1 -1
- package/src/components/PlanPanel.tsx +9 -1
- package/src/components/RecordLinkTextarea.tsx +257 -0
- package/src/components/Shell.tsx +1 -1
- package/src/components/SummaryBlock.tsx +1 -1
- package/src/components/WorkspaceSwitcher.tsx +15 -1
- package/src/index.ts +10 -0
- package/src/lib/fragmentTarget.ts +96 -0
- package/src/lib/mcpConfig.ts +24 -0
- package/src/lib/money.ts +2 -2
- package/src/lib/recordLinks.ts +57 -0
- package/src/lib/recordReferences.ts +139 -0
- package/src/modules/ai.tsx +23 -0
- package/src/modules/aiRunner.ts +80 -0
- package/src/pages/CompanyDetail.tsx +2 -1
- package/src/pages/DealDetail.tsx +2 -1
- package/src/pages/DealsPage.tsx +1 -1
- package/src/pages/DecisionsPage.tsx +5 -3
- package/src/pages/EnquiryDetail.tsx +2 -1
- package/src/pages/EventDetail.tsx +2 -1
- package/src/pages/FormsPage.tsx +1 -1
- package/src/pages/FundraisingPage.tsx +1 -1
- package/src/pages/OpportunitiesPage.tsx +1 -1
- package/src/pages/OpportunityDetail.tsx +2 -1
- package/src/pages/PartnershipDetail.tsx +2 -1
- package/src/pages/PartnershipsPage.tsx +1 -1
- package/src/pages/PersonDetail.tsx +4 -3
- package/src/pages/RaiseDetail.tsx +2 -1
- package/src/pages/SearchPage.tsx +30 -15
- package/src/pages/account/AccountLayout.tsx +2 -1
- package/src/pages/account/ConnectedAppsPage.tsx +131 -0
- package/src/pages/admin/AiPage.tsx +353 -0
- package/src/pages/admin/McpPage.tsx +48 -27
- package/src/pages/admin/ModulesPage.tsx +5 -4
- package/src/pages/admin/WorkspaceSettingsPage.tsx +13 -28
- package/src/pages/auth/AuthLayout.tsx +1 -1
- package/src/pages/auth/SignUpPage.tsx +1 -1
- package/src/pages/dashboard/attention.ts +1 -24
- package/src/pages/dashboard/sections.tsx +9 -4
- package/src/pages/forms/SubmissionDetail.tsx +1 -1
- package/src/pages/forms/SubmissionsTable.tsx +4 -3
- package/src/pages/handbook/HandbookPage.tsx +5 -6
- package/src/pages/hiringDirectory.ts +2 -2
- package/src/pages/oauth/ConsentPage.tsx +219 -0
- package/src/pages/onboarding/InvitesStepPage.tsx +1 -1
- package/src/pages/onboarding/WorkspaceStepPage.tsx +19 -43
- package/src/pages/onboarding/onboardingModules.ts +1 -1
- package/src/pages/onboarding/onboardingRerun.ts +15 -1
- package/src/pages/positionDirectory.ts +2 -2
- package/src/registry/context.ts +6 -0
- package/src/registry/contributions.ts +31 -1
- package/src/registry/overridable.ts +1 -1
- package/src/registry/registry.ts +21 -3
|
@@ -19,10 +19,24 @@ export function isOnboardingRerun(searchParams: URLSearchParams): boolean {
|
|
|
19
19
|
return searchParams.get(ONBOARDING_RERUN_PARAM) === ONBOARDING_RERUN_VALUE
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* An account that already has a workspace can add another from the workspace
|
|
24
|
+
* menu. `?new=1` shows the create form on step 1 instead of "ready". The new
|
|
25
|
+
* workspace then walks the whole wizard, handbook seeding included.
|
|
26
|
+
*/
|
|
27
|
+
export const ONBOARDING_NEW_PARAM = 'new'
|
|
28
|
+
|
|
29
|
+
/** Entry URL the workspace menu opens to add a workspace. */
|
|
30
|
+
export const ONBOARDING_NEW_WORKSPACE_ENTRY = `/onboarding/workspace?${ONBOARDING_NEW_PARAM}=1`
|
|
31
|
+
|
|
32
|
+
export function isNewWorkspace(searchParams: URLSearchParams): boolean {
|
|
33
|
+
return searchParams.get(ONBOARDING_NEW_PARAM) === '1'
|
|
34
|
+
}
|
|
35
|
+
|
|
22
36
|
/**
|
|
23
37
|
* Keep the rerun flag and the organisation type when moving between onboarding
|
|
24
38
|
* routes. `org` is how the modules step knows which defaults to offer; nothing
|
|
25
|
-
* else is held in the browser
|
|
39
|
+
* else is held in the browser.
|
|
26
40
|
*/
|
|
27
41
|
export function onboardingPath(path: string, rerun: boolean, org?: string | null): string {
|
|
28
42
|
const params = new URLSearchParams()
|
|
@@ -7,7 +7,7 @@ import { usePositions } from '../api/resources/positions.ts'
|
|
|
7
7
|
* Titles and company names for the people on screen, and head counts for the
|
|
8
8
|
* companies on screen.
|
|
9
9
|
*
|
|
10
|
-
* A list row needs data from three resources, and
|
|
10
|
+
* A list row needs data from three resources, and the API has no
|
|
11
11
|
* include-expansion. What it does have is repeatable id filters, so each of
|
|
12
12
|
* these asks about exactly the rows the page is rendering: two extra requests
|
|
13
13
|
* for the page, not one per row, and no cap that a real workspace could grow
|
|
@@ -18,7 +18,7 @@ import { usePositions } from '../api/resources/positions.ts'
|
|
|
18
18
|
* answer rather than a slow one.
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
/**
|
|
21
|
+
/** `?limit=` and an id filter both max out at 200 (`docs/agents/api-and-webhooks.md`). */
|
|
22
22
|
const MAX_PAGE = 200
|
|
23
23
|
|
|
24
24
|
export interface PeopleDirectory {
|
package/src/registry/context.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { createContext, useContext } from 'react'
|
|
|
2
2
|
import type { ComponentType } from 'react'
|
|
3
3
|
|
|
4
4
|
import type {
|
|
5
|
+
AgentRunner,
|
|
5
6
|
AuthMethod,
|
|
6
7
|
DashboardCard,
|
|
7
8
|
ExtensibleRecordType,
|
|
@@ -59,6 +60,11 @@ export function useAuthMethods(): readonly AuthMethod[] {
|
|
|
59
60
|
return useUiExtensions().authMethods()
|
|
60
61
|
}
|
|
61
62
|
|
|
63
|
+
/** The agent the Agent menu's Run button dispatches to, when a module provides one. */
|
|
64
|
+
export function useAgentRunner(): AgentRunner | undefined {
|
|
65
|
+
return useUiExtensions().agentRunner()
|
|
66
|
+
}
|
|
67
|
+
|
|
62
68
|
/**
|
|
63
69
|
* The component to render for an overridable: a module's replacement, or core's
|
|
64
70
|
* own. Core calls this instead of rendering its component directly.
|
|
@@ -2,7 +2,7 @@ import type { ExtensibleRecordType } from '@kelpie/schemas'
|
|
|
2
2
|
import type { ReactNode } from 'react'
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* What a UI module may add to the shell
|
|
5
|
+
* What a UI module may add to the shell.
|
|
6
6
|
*
|
|
7
7
|
* Every slot renders nothing when empty. A core page has to look finished with
|
|
8
8
|
* no modules loaded at all, because the open-source assembly is exactly that.
|
|
@@ -94,3 +94,33 @@ export interface DashboardCard {
|
|
|
94
94
|
readonly render: () => ReactNode
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Whether the runner can take a task now, for the workspace the viewer is in.
|
|
100
|
+
* `reason` is a sentence the Agent menu shows on its disabled Run button.
|
|
101
|
+
*/
|
|
102
|
+
export type AgentRunnerAvailability =
|
|
103
|
+
| { readonly status: 'loading' }
|
|
104
|
+
| { readonly status: 'unavailable'; readonly reason: string }
|
|
105
|
+
| { readonly status: 'ready'; readonly agentId: string }
|
|
106
|
+
|
|
107
|
+
/** Where a dispatched run got to, once core has handed it to the runner's agent. */
|
|
108
|
+
export type AgentRunnerProgress =
|
|
109
|
+
| { readonly status: 'running' }
|
|
110
|
+
| { readonly status: 'succeeded' }
|
|
111
|
+
| { readonly status: 'failed'; readonly reason: string }
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* The agent the Agent menu's Run button dispatches to, with no dialog.
|
|
115
|
+
*
|
|
116
|
+
* Core has no model of its own, so with no runner registered Run stays
|
|
117
|
+
* disabled and Preview is the way to reach a registered agent. Both members are
|
|
118
|
+
* React hooks: the menu calls them on every render, so they follow the Rules of
|
|
119
|
+
* Hooks, and `enabled` lets the menu defer the fetch until it opens.
|
|
120
|
+
*/
|
|
121
|
+
export interface AgentRunner {
|
|
122
|
+
readonly id: string
|
|
123
|
+
readonly useAvailability: (options: { readonly enabled: boolean }) => AgentRunnerAvailability
|
|
124
|
+
/** Progress for the core agent run `agentRunId`. `undefined` polls nothing. */
|
|
125
|
+
readonly useProgress: (agentRunId: string | undefined) => AgentRunnerProgress | undefined
|
|
126
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ComponentType } from 'react'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* The override escape hatch
|
|
4
|
+
* The override escape hatch: a module replaces a core
|
|
5
5
|
* component outright. Prefer a slot; this is for the cases a slot cannot reach.
|
|
6
6
|
*
|
|
7
7
|
* A core component is replaceable only if it hands out a token, and the token
|
package/src/registry/registry.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ComponentType } from 'react'
|
|
2
2
|
|
|
3
3
|
import type {
|
|
4
|
+
AgentRunner,
|
|
4
5
|
AuthMethod,
|
|
5
6
|
DashboardCard,
|
|
6
7
|
ExtensibleRecordType,
|
|
@@ -14,7 +15,7 @@ import { createOverrideStore } from './overridable.ts'
|
|
|
14
15
|
import type { Overridable, OverrideStore } from './overridable.ts'
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
|
-
* The build-time UI extension registry
|
|
18
|
+
* The build-time UI extension registry.
|
|
18
19
|
*
|
|
19
20
|
* Composition is build-time, like the server runtime: an assembly lists its UI
|
|
20
21
|
* modules and this collects what they contribute. Nothing is loaded at runtime,
|
|
@@ -34,7 +35,9 @@ export interface UiModuleContext {
|
|
|
34
35
|
dashboardCard(card: DashboardCard): void
|
|
35
36
|
/** Another way to sign in, rendered beside the password form on `/login` and `/signup`. */
|
|
36
37
|
authMethod(method: AuthMethod): void
|
|
37
|
-
/**
|
|
38
|
+
/** The agent the Agent menu's Run button dispatches to. One per assembly. */
|
|
39
|
+
agentRunner(runner: AgentRunner): void
|
|
40
|
+
/** Replaces a core component. Prefer a slot. */
|
|
38
41
|
override<Props>(token: Overridable<Props>, component: ComponentType<Props>): void
|
|
39
42
|
}
|
|
40
43
|
|
|
@@ -51,6 +54,8 @@ export interface UiExtensions {
|
|
|
51
54
|
recordSidebarCards(objectType: ExtensibleRecordType): readonly RecordSidebarCard[]
|
|
52
55
|
dashboardCards(): readonly DashboardCard[]
|
|
53
56
|
authMethods(): readonly AuthMethod[]
|
|
57
|
+
/** The registered runner, or `undefined` when no module provides one. */
|
|
58
|
+
agentRunner(): AgentRunner | undefined
|
|
54
59
|
componentFor<Props>(token: Overridable<Props>): ComponentType<Props>
|
|
55
60
|
}
|
|
56
61
|
|
|
@@ -69,6 +74,7 @@ export function inSlotOrder<T extends { readonly order?: number }>(items: readon
|
|
|
69
74
|
}
|
|
70
75
|
|
|
71
76
|
interface Accumulator {
|
|
77
|
+
agentRunner?: AgentRunner
|
|
72
78
|
readonly nav: Map<NavSlot, NavItem[]>
|
|
73
79
|
readonly routes: RouteContribution[]
|
|
74
80
|
readonly recordTabs: Map<ExtensibleRecordType, RecordTab[]>
|
|
@@ -144,6 +150,17 @@ function createModuleContext(
|
|
|
144
150
|
accumulator.authMethods.push(method)
|
|
145
151
|
},
|
|
146
152
|
|
|
153
|
+
agentRunner(runner) {
|
|
154
|
+
// One button, one agent: a second runner would silently win or lose.
|
|
155
|
+
if (accumulator.agentRunner !== undefined) {
|
|
156
|
+
throw new UiModuleError(
|
|
157
|
+
`module "${module.id}" contributes agent runner "${runner.id}", but "${accumulator.agentRunner.id}" is already registered`,
|
|
158
|
+
)
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
accumulator.agentRunner = runner
|
|
162
|
+
},
|
|
163
|
+
|
|
147
164
|
override(token, component) {
|
|
148
165
|
if (accumulator.overrides.has(token.key)) {
|
|
149
166
|
throw new UiModuleError(
|
|
@@ -191,6 +208,7 @@ export function registerUiModules(modules: readonly UiModule[]): UiExtensions {
|
|
|
191
208
|
inSlotOrder(accumulator.recordSidebarCards.get(objectType) ?? []),
|
|
192
209
|
dashboardCards: () => inSlotOrder(accumulator.dashboardCards),
|
|
193
210
|
authMethods: () => inSlotOrder(accumulator.authMethods),
|
|
211
|
+
agentRunner: () => accumulator.agentRunner,
|
|
194
212
|
componentFor: (token) => accumulator.overrides.get(token),
|
|
195
213
|
}
|
|
196
214
|
}
|
|
@@ -200,6 +218,6 @@ export function registerUiModules(modules: readonly UiModule[]): UiExtensions {
|
|
|
200
218
|
* tree without a provider sees.
|
|
201
219
|
*
|
|
202
220
|
* Every slot is empty and every overridable renders its core fallback, which is
|
|
203
|
-
* the state
|
|
221
|
+
* the state core pages are required to look finished in.
|
|
204
222
|
*/
|
|
205
223
|
export const NO_UI_MODULES: UiExtensions = registerUiModules([])
|