@kelpie/ui 0.17.0 → 0.18.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/resources/ai.d.ts +5 -0
- package/dist/api/resources/ai.d.ts.map +1 -1
- package/dist/api/resources/ai.js +9 -1
- package/dist/api/resources/ai.js.map +1 -1
- package/dist/api/resources/forms.d.ts +8 -0
- package/dist/api/resources/forms.d.ts.map +1 -1
- package/dist/api/resources/forms.js +39 -0
- package/dist/api/resources/forms.js.map +1 -1
- package/dist/api/resources/personIntake.d.ts +12 -0
- package/dist/api/resources/personIntake.d.ts.map +1 -0
- package/dist/api/resources/personIntake.js +54 -0
- package/dist/api/resources/personIntake.js.map +1 -0
- package/dist/app/KelpieApp.js +2 -2
- package/dist/app/KelpieApp.js.map +1 -1
- package/dist/components/AgentTasks.js +2 -2
- package/dist/components/AgentTasks.js.map +1 -1
- package/dist/components/PersonIntakeDialog.d.ts +19 -0
- package/dist/components/PersonIntakeDialog.d.ts.map +1 -0
- package/dist/components/PersonIntakeDialog.js +87 -0
- package/dist/components/PersonIntakeDialog.js.map +1 -0
- package/dist/components/Shell.js +1 -1
- package/dist/components/Shell.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/modules/PersonIntakeWizard.d.ts +3 -0
- package/dist/modules/PersonIntakeWizard.d.ts.map +1 -0
- package/dist/modules/PersonIntakeWizard.js +223 -0
- package/dist/modules/PersonIntakeWizard.js.map +1 -0
- package/dist/modules/ai.d.ts +4 -3
- package/dist/modules/ai.d.ts.map +1 -1
- package/dist/modules/ai.js +10 -6
- package/dist/modules/ai.js.map +1 -1
- package/dist/modules/aiRunner.d.ts.map +1 -1
- package/dist/modules/aiRunner.js +7 -5
- package/dist/modules/aiRunner.js.map +1 -1
- package/dist/modules/personIntakeSelection.d.ts +7 -0
- package/dist/modules/personIntakeSelection.d.ts.map +1 -0
- package/dist/modules/personIntakeSelection.js +21 -0
- package/dist/modules/personIntakeSelection.js.map +1 -0
- package/dist/pages/FormsPage.js +4 -4
- package/dist/pages/FormsPage.js.map +1 -1
- package/dist/pages/PeoplePage.d.ts.map +1 -1
- package/dist/pages/PeoplePage.js +7 -1
- package/dist/pages/PeoplePage.js.map +1 -1
- package/dist/pages/admin/AiAdminPage.d.ts +2 -0
- package/dist/pages/admin/AiAdminPage.d.ts.map +1 -0
- package/dist/pages/admin/AiAdminPage.js +19 -0
- package/dist/pages/admin/AiAdminPage.js.map +1 -0
- package/dist/pages/admin/AiPage.d.ts +4 -1
- package/dist/pages/admin/AiPage.d.ts.map +1 -1
- package/dist/pages/admin/AiPage.js +77 -15
- package/dist/pages/admin/AiPage.js.map +1 -1
- package/dist/pages/admin/McpPanel.d.ts +3 -0
- package/dist/pages/admin/McpPanel.d.ts.map +1 -0
- package/dist/pages/admin/McpPanel.js +123 -0
- package/dist/pages/admin/McpPanel.js.map +1 -0
- package/dist/pages/admin/PrivacyPage.js +19 -3
- package/dist/pages/admin/PrivacyPage.js.map +1 -1
- package/dist/pages/forms/EmbedPanel.js +5 -2
- package/dist/pages/forms/EmbedPanel.js.map +1 -1
- package/dist/pages/forms/FieldsEditor.d.ts.map +1 -1
- package/dist/pages/forms/FieldsEditor.js +90 -8
- package/dist/pages/forms/FieldsEditor.js.map +1 -1
- package/dist/pages/forms/FormSettings.d.ts.map +1 -1
- package/dist/pages/forms/FormSettings.js +73 -6
- package/dist/pages/forms/FormSettings.js.map +1 -1
- package/dist/pages/forms/SubmissionDetail.d.ts.map +1 -1
- package/dist/pages/forms/SubmissionDetail.js +2 -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 +2 -1
- package/dist/pages/forms/SubmissionsTable.js.map +1 -1
- package/dist/pages/forms/fieldList.d.ts +2 -2
- package/dist/pages/forms/fieldList.d.ts.map +1 -1
- package/dist/pages/forms/fieldList.js +38 -10
- package/dist/pages/forms/fieldList.js.map +1 -1
- package/dist/pages/forms/template.d.ts.map +1 -1
- package/dist/pages/forms/template.js +13 -0
- package/dist/pages/forms/template.js.map +1 -1
- package/dist/registry/context.d.ts +5 -1
- package/dist/registry/context.d.ts.map +1 -1
- package/dist/registry/context.js +8 -0
- package/dist/registry/context.js.map +1 -1
- package/dist/registry/contributions.d.ts +32 -1
- package/dist/registry/contributions.d.ts.map +1 -1
- package/dist/registry/registry.d.ts +8 -1
- package/dist/registry/registry.d.ts.map +1 -1
- package/dist/registry/registry.js +13 -0
- package/dist/registry/registry.js.map +1 -1
- package/package.json +2 -2
- package/src/api/resources/ai.ts +11 -1
- package/src/api/resources/forms.ts +56 -0
- package/src/api/resources/personIntake.ts +95 -0
- package/src/app/KelpieApp.tsx +4 -2
- package/src/components/AgentTasks.tsx +2 -2
- package/src/components/PersonIntakeDialog.tsx +226 -0
- package/src/components/Shell.tsx +1 -1
- package/src/index.ts +7 -1
- package/src/modules/PersonIntakeWizard.tsx +633 -0
- package/src/modules/ai.tsx +10 -6
- package/src/modules/aiRunner.ts +8 -5
- package/src/modules/personIntakeSelection.ts +24 -0
- package/src/pages/FormsPage.tsx +4 -4
- package/src/pages/PeoplePage.tsx +21 -5
- package/src/pages/admin/AiAdminPage.tsx +52 -0
- package/src/pages/admin/AiPage.tsx +136 -32
- package/src/pages/admin/{McpPage.tsx → McpPanel.tsx} +4 -6
- package/src/pages/admin/PrivacyPage.tsx +42 -0
- package/src/pages/forms/EmbedPanel.tsx +5 -1
- package/src/pages/forms/FieldsEditor.tsx +204 -15
- package/src/pages/forms/FormSettings.tsx +156 -9
- package/src/pages/forms/SubmissionDetail.tsx +2 -1
- package/src/pages/forms/SubmissionsTable.tsx +2 -1
- package/src/pages/forms/fieldList.ts +39 -10
- package/src/pages/forms/template.ts +13 -0
- package/src/registry/context.ts +13 -0
- package/src/registry/contributions.ts +34 -1
- package/src/registry/registry.ts +30 -0
package/src/registry/context.ts
CHANGED
|
@@ -2,12 +2,15 @@ import { createContext, useContext } from 'react'
|
|
|
2
2
|
import type { ComponentType } from 'react'
|
|
3
3
|
|
|
4
4
|
import type {
|
|
5
|
+
AdminTab,
|
|
5
6
|
AgentRunner,
|
|
6
7
|
AuthMethod,
|
|
7
8
|
DashboardCard,
|
|
9
|
+
ExtensibleAdminPage,
|
|
8
10
|
ExtensibleRecordType,
|
|
9
11
|
NavItem,
|
|
10
12
|
NavSlot,
|
|
13
|
+
PersonIntakeProvider,
|
|
11
14
|
RecordSidebarCard,
|
|
12
15
|
RecordTab,
|
|
13
16
|
RouteContribution,
|
|
@@ -51,6 +54,11 @@ export function useRecordSidebarCards(objectType: ExtensibleRecordType): readonl
|
|
|
51
54
|
return useUiExtensions().recordSidebarCards(objectType)
|
|
52
55
|
}
|
|
53
56
|
|
|
57
|
+
/** Module tabs for an admin page, in order. The page merges its own tabs in. */
|
|
58
|
+
export function useAdminTabs(page: ExtensibleAdminPage): readonly AdminTab[] {
|
|
59
|
+
return useUiExtensions().adminTabs(page)
|
|
60
|
+
}
|
|
61
|
+
|
|
54
62
|
export function useDashboardCards(): readonly DashboardCard[] {
|
|
55
63
|
return useUiExtensions().dashboardCards()
|
|
56
64
|
}
|
|
@@ -65,6 +73,11 @@ export function useAgentRunner(): AgentRunner | undefined {
|
|
|
65
73
|
return useUiExtensions().agentRunner()
|
|
66
74
|
}
|
|
67
75
|
|
|
76
|
+
/** The wizard behind People's Add from notes, when a module provides one. */
|
|
77
|
+
export function usePersonIntakeProvider(): PersonIntakeProvider | undefined {
|
|
78
|
+
return useUiExtensions().personIntake()
|
|
79
|
+
}
|
|
80
|
+
|
|
68
81
|
/**
|
|
69
82
|
* The component to render for an overridable: a module's replacement, or core's
|
|
70
83
|
* own. Core calls this instead of rendering its component directly.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ExtensibleRecordType } from '@kelpie/schemas'
|
|
2
|
-
import type { ReactNode } from 'react'
|
|
2
|
+
import type { ComponentType, ReactNode } from 'react'
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* What a UI module may add to the shell.
|
|
@@ -82,6 +82,20 @@ export interface RecordTab {
|
|
|
82
82
|
readonly render: (context: RecordContext) => ReactNode
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
/**
|
|
86
|
+
* An admin page whose tabs modules may add to. `ai` is Admin → AI: core owns
|
|
87
|
+
* the page and its MCP tab, and the optional `ai` module adds Kelpie AI's
|
|
88
|
+
* settings and run log.
|
|
89
|
+
*/
|
|
90
|
+
export type ExtensibleAdminPage = 'ai'
|
|
91
|
+
|
|
92
|
+
export interface AdminTab {
|
|
93
|
+
readonly id: string
|
|
94
|
+
readonly label: string
|
|
95
|
+
readonly order?: number
|
|
96
|
+
readonly render: () => ReactNode
|
|
97
|
+
}
|
|
98
|
+
|
|
85
99
|
export interface RecordSidebarCard {
|
|
86
100
|
readonly id: string
|
|
87
101
|
readonly order?: number
|
|
@@ -124,3 +138,22 @@ export interface AgentRunner {
|
|
|
124
138
|
/** Progress for the core agent run `agentRunId`. `undefined` polls nothing. */
|
|
125
139
|
readonly useProgress: (agentRunId: string | undefined) => AgentRunnerProgress | undefined
|
|
126
140
|
}
|
|
141
|
+
|
|
142
|
+
export interface PersonIntakeWizardProps {
|
|
143
|
+
/** Closes the dialog the wizard sits in. */
|
|
144
|
+
readonly onClose: () => void
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* The model-driven wizard behind People's **Add from notes**.
|
|
149
|
+
*
|
|
150
|
+
* Core owns the button and the dialog, and with no provider (or one that is
|
|
151
|
+
* not ready) the dialog offers a copy-prompt for the user's own agent. A
|
|
152
|
+
* provider replaces that with a wizard that identifies, researches and
|
|
153
|
+
* creates. `useAvailability` is a hook, with the runner's shape and rules.
|
|
154
|
+
*/
|
|
155
|
+
export interface PersonIntakeProvider {
|
|
156
|
+
readonly id: string
|
|
157
|
+
readonly useAvailability: (options: { readonly enabled: boolean }) => AgentRunnerAvailability
|
|
158
|
+
readonly Wizard: ComponentType<PersonIntakeWizardProps>
|
|
159
|
+
}
|
package/src/registry/registry.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { ComponentType } from 'react'
|
|
2
2
|
|
|
3
3
|
import type {
|
|
4
|
+
AdminTab,
|
|
4
5
|
AgentRunner,
|
|
5
6
|
AuthMethod,
|
|
7
|
+
PersonIntakeProvider,
|
|
6
8
|
DashboardCard,
|
|
9
|
+
ExtensibleAdminPage,
|
|
7
10
|
ExtensibleRecordType,
|
|
8
11
|
NavItem,
|
|
9
12
|
NavSlot,
|
|
@@ -32,11 +35,15 @@ export interface UiModuleContext {
|
|
|
32
35
|
route(route: RouteContribution): void
|
|
33
36
|
recordTab(objectType: ExtensibleRecordType, tab: RecordTab): void
|
|
34
37
|
recordSidebarCard(objectType: ExtensibleRecordType, card: RecordSidebarCard): void
|
|
38
|
+
/** A tab on an admin page core owns, beside core's own tabs. */
|
|
39
|
+
adminTab(page: ExtensibleAdminPage, tab: AdminTab): void
|
|
35
40
|
dashboardCard(card: DashboardCard): void
|
|
36
41
|
/** Another way to sign in, rendered beside the password form on `/login` and `/signup`. */
|
|
37
42
|
authMethod(method: AuthMethod): void
|
|
38
43
|
/** The agent the Agent menu's Run button dispatches to. One per assembly. */
|
|
39
44
|
agentRunner(runner: AgentRunner): void
|
|
45
|
+
/** The wizard behind People's Add from notes. One per assembly. */
|
|
46
|
+
personIntake(provider: PersonIntakeProvider): void
|
|
40
47
|
/** Replaces a core component. Prefer a slot. */
|
|
41
48
|
override<Props>(token: Overridable<Props>, component: ComponentType<Props>): void
|
|
42
49
|
}
|
|
@@ -52,10 +59,13 @@ export interface UiExtensions {
|
|
|
52
59
|
routes(): readonly RouteContribution[]
|
|
53
60
|
recordTabs(objectType: ExtensibleRecordType): readonly RecordTab[]
|
|
54
61
|
recordSidebarCards(objectType: ExtensibleRecordType): readonly RecordSidebarCard[]
|
|
62
|
+
adminTabs(page: ExtensibleAdminPage): readonly AdminTab[]
|
|
55
63
|
dashboardCards(): readonly DashboardCard[]
|
|
56
64
|
authMethods(): readonly AuthMethod[]
|
|
57
65
|
/** The registered runner, or `undefined` when no module provides one. */
|
|
58
66
|
agentRunner(): AgentRunner | undefined
|
|
67
|
+
/** The registered intake wizard, or `undefined` when no module provides one. */
|
|
68
|
+
personIntake(): PersonIntakeProvider | undefined
|
|
59
69
|
componentFor<Props>(token: Overridable<Props>): ComponentType<Props>
|
|
60
70
|
}
|
|
61
71
|
|
|
@@ -75,10 +85,12 @@ export function inSlotOrder<T extends { readonly order?: number }>(items: readon
|
|
|
75
85
|
|
|
76
86
|
interface Accumulator {
|
|
77
87
|
agentRunner?: AgentRunner
|
|
88
|
+
personIntake?: PersonIntakeProvider
|
|
78
89
|
readonly nav: Map<NavSlot, NavItem[]>
|
|
79
90
|
readonly routes: RouteContribution[]
|
|
80
91
|
readonly recordTabs: Map<ExtensibleRecordType, RecordTab[]>
|
|
81
92
|
readonly recordSidebarCards: Map<ExtensibleRecordType, RecordSidebarCard[]>
|
|
93
|
+
readonly adminTabs: Map<ExtensibleAdminPage, AdminTab[]>
|
|
82
94
|
readonly dashboardCards: DashboardCard[]
|
|
83
95
|
readonly authMethods: AuthMethod[]
|
|
84
96
|
readonly overrides: OverrideStore
|
|
@@ -140,6 +152,11 @@ function createModuleContext(
|
|
|
140
152
|
pushInto(accumulator.recordSidebarCards, objectType, card)
|
|
141
153
|
},
|
|
142
154
|
|
|
155
|
+
adminTab(page, tab) {
|
|
156
|
+
claim(taken, module.id, `admin.tabs.${page}`, tab.id)
|
|
157
|
+
pushInto(accumulator.adminTabs, page, tab)
|
|
158
|
+
},
|
|
159
|
+
|
|
143
160
|
dashboardCard(card) {
|
|
144
161
|
claim(taken, module.id, 'dashboard.cards', card.id)
|
|
145
162
|
accumulator.dashboardCards.push(card)
|
|
@@ -161,6 +178,16 @@ function createModuleContext(
|
|
|
161
178
|
accumulator.agentRunner = runner
|
|
162
179
|
},
|
|
163
180
|
|
|
181
|
+
personIntake(provider) {
|
|
182
|
+
if (accumulator.personIntake !== undefined) {
|
|
183
|
+
throw new UiModuleError(
|
|
184
|
+
`module "${module.id}" contributes person intake "${provider.id}", but "${accumulator.personIntake.id}" is already registered`,
|
|
185
|
+
)
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
accumulator.personIntake = provider
|
|
189
|
+
},
|
|
190
|
+
|
|
164
191
|
override(token, component) {
|
|
165
192
|
if (accumulator.overrides.has(token.key)) {
|
|
166
193
|
throw new UiModuleError(
|
|
@@ -184,6 +211,7 @@ export function registerUiModules(modules: readonly UiModule[]): UiExtensions {
|
|
|
184
211
|
routes: [],
|
|
185
212
|
recordTabs: new Map(),
|
|
186
213
|
recordSidebarCards: new Map(),
|
|
214
|
+
adminTabs: new Map(),
|
|
187
215
|
dashboardCards: [],
|
|
188
216
|
authMethods: [],
|
|
189
217
|
overrides: createOverrideStore(),
|
|
@@ -206,9 +234,11 @@ export function registerUiModules(modules: readonly UiModule[]): UiExtensions {
|
|
|
206
234
|
recordTabs: (objectType) => inSlotOrder(accumulator.recordTabs.get(objectType) ?? []),
|
|
207
235
|
recordSidebarCards: (objectType) =>
|
|
208
236
|
inSlotOrder(accumulator.recordSidebarCards.get(objectType) ?? []),
|
|
237
|
+
adminTabs: (page) => inSlotOrder(accumulator.adminTabs.get(page) ?? []),
|
|
209
238
|
dashboardCards: () => inSlotOrder(accumulator.dashboardCards),
|
|
210
239
|
authMethods: () => inSlotOrder(accumulator.authMethods),
|
|
211
240
|
agentRunner: () => accumulator.agentRunner,
|
|
241
|
+
personIntake: () => accumulator.personIntake,
|
|
212
242
|
componentFor: (token) => accumulator.overrides.get(token),
|
|
213
243
|
}
|
|
214
244
|
}
|