@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
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import {
|
|
2
|
+
personIntakeApplyResultSchema,
|
|
3
|
+
personIntakeCandidateBody,
|
|
4
|
+
personIntakeIdentifyResultSchema,
|
|
5
|
+
personIntakeItemBody,
|
|
6
|
+
personIntakeResearchResultSchema,
|
|
7
|
+
} from '@kelpie/schemas'
|
|
8
|
+
import type {
|
|
9
|
+
PersonIntakeApplyResult,
|
|
10
|
+
PersonIntakeCandidate,
|
|
11
|
+
PersonIntakeIdentifyResult,
|
|
12
|
+
PersonIntakeItem,
|
|
13
|
+
PersonIntakeResearchResult,
|
|
14
|
+
} from '@kelpie/schemas'
|
|
15
|
+
import { useMutation, useQueryClient } from '@tanstack/react-query'
|
|
16
|
+
|
|
17
|
+
import { useApiClient } from '../context.ts'
|
|
18
|
+
import type { MutationResult } from '../resource.ts'
|
|
19
|
+
import { asMutationResult } from './mutation.ts'
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* `/v1/ai/person-intake/*`, from the optional `ai` module. Only the module's
|
|
23
|
+
* wizard calls these, and only an assembly that lists the module serves them.
|
|
24
|
+
*
|
|
25
|
+
* `identify` and `research` each record an AI run, so both refresh the run
|
|
26
|
+
* log. `apply` can touch every record type the wizard offers, so it refreshes
|
|
27
|
+
* all of them.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
const RUN_LOG_KEY = ['ai_runs'] as const
|
|
31
|
+
|
|
32
|
+
const WRITTEN_RESOURCES = ['people', 'companies', 'positions', 'notes', 'partnerships', 'deals', 'enquiries'] as const
|
|
33
|
+
|
|
34
|
+
export function useIdentifyPerson(): MutationResult<string, PersonIntakeIdentifyResult> {
|
|
35
|
+
const client = useApiClient()
|
|
36
|
+
const cache = useQueryClient()
|
|
37
|
+
const mutation = useMutation({
|
|
38
|
+
mutationFn: (text: string) =>
|
|
39
|
+
client.post('/ai/person-intake/identify', { text }, personIntakeIdentifyResultSchema.parse),
|
|
40
|
+
onSettled: () => {
|
|
41
|
+
void cache.invalidateQueries({ queryKey: RUN_LOG_KEY })
|
|
42
|
+
},
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
return asMutationResult(mutation)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface ResearchPersonInput {
|
|
49
|
+
readonly text: string
|
|
50
|
+
readonly candidate: PersonIntakeCandidate
|
|
51
|
+
/** The Person to add to, or null to create a new one. */
|
|
52
|
+
readonly existingPersonId: string | null
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function useResearchPerson(): MutationResult<ResearchPersonInput, PersonIntakeResearchResult> {
|
|
56
|
+
const client = useApiClient()
|
|
57
|
+
const cache = useQueryClient()
|
|
58
|
+
const mutation = useMutation({
|
|
59
|
+
mutationFn: (input: ResearchPersonInput) =>
|
|
60
|
+
client.post(
|
|
61
|
+
'/ai/person-intake/research',
|
|
62
|
+
{
|
|
63
|
+
text: input.text,
|
|
64
|
+
candidate: personIntakeCandidateBody(input.candidate),
|
|
65
|
+
existing_person_id: input.existingPersonId,
|
|
66
|
+
},
|
|
67
|
+
personIntakeResearchResultSchema.parse,
|
|
68
|
+
),
|
|
69
|
+
onSettled: () => {
|
|
70
|
+
void cache.invalidateQueries({ queryKey: RUN_LOG_KEY })
|
|
71
|
+
},
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
return asMutationResult(mutation)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function useApplyPersonIntake(): MutationResult<readonly PersonIntakeItem[], PersonIntakeApplyResult> {
|
|
78
|
+
const client = useApiClient()
|
|
79
|
+
const cache = useQueryClient()
|
|
80
|
+
const mutation = useMutation({
|
|
81
|
+
mutationFn: (items: readonly PersonIntakeItem[]) =>
|
|
82
|
+
client.post(
|
|
83
|
+
'/ai/person-intake/apply',
|
|
84
|
+
{ items: items.map(personIntakeItemBody) },
|
|
85
|
+
personIntakeApplyResultSchema.parse,
|
|
86
|
+
),
|
|
87
|
+
onSettled: () => {
|
|
88
|
+
for (const name of WRITTEN_RESOURCES) {
|
|
89
|
+
void cache.invalidateQueries({ queryKey: [name] })
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
return asMutationResult(mutation)
|
|
95
|
+
}
|
package/src/app/KelpieApp.tsx
CHANGED
|
@@ -41,11 +41,11 @@ import { PersonalApiKeysPage } from '../pages/account/PersonalApiKeysPage.tsx'
|
|
|
41
41
|
import { PreferencesPage } from '../pages/account/PreferencesPage.tsx'
|
|
42
42
|
import { ProfilePage } from '../pages/account/ProfilePage.tsx'
|
|
43
43
|
import { SecurityPage } from '../pages/account/SecurityPage.tsx'
|
|
44
|
+
import { AiAdminPage } from '../pages/admin/AiAdminPage.tsx'
|
|
44
45
|
import { ApiKeysPage } from '../pages/admin/ApiKeysPage.tsx'
|
|
45
46
|
import { DataPage } from '../pages/admin/DataPage.tsx'
|
|
46
47
|
import { FieldsPage } from '../pages/admin/FieldsPage.tsx'
|
|
47
48
|
import { PrivacyPage } from '../pages/admin/PrivacyPage.tsx'
|
|
48
|
-
import { McpPage } from '../pages/admin/McpPage.tsx'
|
|
49
49
|
import { ModulesPage } from '../pages/admin/ModulesPage.tsx'
|
|
50
50
|
import { TeamPage } from '../pages/admin/TeamPage.tsx'
|
|
51
51
|
import { WebhooksPage } from '../pages/admin/WebhooksPage.tsx'
|
|
@@ -200,7 +200,9 @@ function AppRoutes(): React.JSX.Element {
|
|
|
200
200
|
<Route path="admin/privacy" element={<PrivacyPage />} />
|
|
201
201
|
<Route path="admin/data" element={<DataPage />} />
|
|
202
202
|
<Route path="admin/api-keys" element={<ApiKeysPage />} />
|
|
203
|
-
<Route path="admin/
|
|
203
|
+
<Route path="admin/ai" element={<AiAdminPage />} />
|
|
204
|
+
{/* MCP moved to a tab on Admin → AI. */}
|
|
205
|
+
<Route path="admin/mcp" element={<Navigate to="/admin/ai?tab=mcp" replace />} />
|
|
204
206
|
<Route path="admin/webhooks" element={<WebhooksPage />} />
|
|
205
207
|
<Route path="admin/modules" element={<ModulesPage />} />
|
|
206
208
|
{/* The mockup's own shape: /account opens the first tab. */}
|
|
@@ -41,7 +41,7 @@ const NO_RUNNER: AgentRunner = {
|
|
|
41
41
|
id: 'none',
|
|
42
42
|
useAvailability: () => ({
|
|
43
43
|
status: 'unavailable',
|
|
44
|
-
reason: 'Running needs
|
|
44
|
+
reason: 'Running needs the AI module, which this deployment does not include. Use Preview to dispatch to a registered agent.',
|
|
45
45
|
}),
|
|
46
46
|
useProgress: () => undefined,
|
|
47
47
|
}
|
|
@@ -254,7 +254,7 @@ export function AgentTasks({
|
|
|
254
254
|
? 'A task is running.'
|
|
255
255
|
: null
|
|
256
256
|
: availability.status === 'loading'
|
|
257
|
-
? 'Checking
|
|
257
|
+
? 'Checking AI…'
|
|
258
258
|
: availability.reason,
|
|
259
259
|
activeTaskId: directRun?.taskId ?? null,
|
|
260
260
|
status: directStatus,
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { PERSON_INTAKE_MAX_TEXT } from '@kelpie/schemas'
|
|
2
|
+
import { useEffect, useState } from 'react'
|
|
3
|
+
import type { ReactNode } from 'react'
|
|
4
|
+
|
|
5
|
+
import { useResolveAgentTask } from '../api/resources/agentTasks.ts'
|
|
6
|
+
import { useWorkspace } from '../api/resources/workspace.ts'
|
|
7
|
+
import type { AgentRunnerAvailability, PersonIntakeProvider } from '../registry/contributions.ts'
|
|
8
|
+
import { usePersonIntakeProvider } from '../registry/context.ts'
|
|
9
|
+
import { ErrorPanel, LoadingPanel } from './QueryState.tsx'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* People's **Add from notes**: a second way to add a person, from what the
|
|
13
|
+
* user already knows.
|
|
14
|
+
*
|
|
15
|
+
* Core owns the button and this dialog. When a module provides a wizard and
|
|
16
|
+
* it is ready (Kelpie AI enabled, with a key), the dialog renders it. Without
|
|
17
|
+
* one, the dialog still works: it builds the `workspace.add_person` prompt
|
|
18
|
+
* with the user's notes appended, for the user to paste into their own agent.
|
|
19
|
+
* That is the same pattern as the Log transcript task.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
const ADD_PERSON_TASK = 'workspace.add_person'
|
|
23
|
+
|
|
24
|
+
export function AddFromNotesButton({ onClick }: { readonly onClick: () => void }): React.JSX.Element {
|
|
25
|
+
return (
|
|
26
|
+
<button
|
|
27
|
+
type="button"
|
|
28
|
+
onClick={onClick}
|
|
29
|
+
title="Add a person from notes"
|
|
30
|
+
className="inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-border px-2.5 text-[12px] font-medium text-ink transition hover:border-border-strong hover:bg-surface-sunken"
|
|
31
|
+
>
|
|
32
|
+
<span aria-hidden="true" className="text-accent">
|
|
33
|
+
✦
|
|
34
|
+
</span>
|
|
35
|
+
Add from notes
|
|
36
|
+
</button>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface PersonIntakeDialogProps {
|
|
41
|
+
readonly onClose: () => void
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function PersonIntakeDialog({ onClose }: PersonIntakeDialogProps): React.JSX.Element {
|
|
45
|
+
const provider = usePersonIntakeProvider()
|
|
46
|
+
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
function onKey(event: KeyboardEvent): void {
|
|
49
|
+
if (event.key === 'Escape') onClose()
|
|
50
|
+
}
|
|
51
|
+
window.addEventListener('keydown', onKey)
|
|
52
|
+
return () => {
|
|
53
|
+
window.removeEventListener('keydown', onKey)
|
|
54
|
+
}
|
|
55
|
+
}, [onClose])
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<div
|
|
59
|
+
className="fixed inset-0 z-40 flex items-end justify-center bg-ink/30 p-4 sm:items-center"
|
|
60
|
+
role="dialog"
|
|
61
|
+
aria-modal="true"
|
|
62
|
+
aria-label="Add a person from notes"
|
|
63
|
+
onClick={onClose}
|
|
64
|
+
>
|
|
65
|
+
<div
|
|
66
|
+
className="flex max-h-[90vh] w-full max-w-2xl flex-col overflow-hidden rounded-lg border border-border bg-surface"
|
|
67
|
+
onClick={(event) => {
|
|
68
|
+
event.stopPropagation()
|
|
69
|
+
}}
|
|
70
|
+
>
|
|
71
|
+
<div className="flex items-start justify-between gap-3 border-b border-border px-4 py-3">
|
|
72
|
+
<div>
|
|
73
|
+
<div className="text-[14px] font-semibold text-ink">Add a person from notes</div>
|
|
74
|
+
<div className="mt-0.5 text-[12px] text-ink-muted">
|
|
75
|
+
Paste what you know. Kelpie builds the record from it.
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
<button type="button" className="text-[12px] font-medium text-ink-muted hover:text-ink" onClick={onClose}>
|
|
79
|
+
Close
|
|
80
|
+
</button>
|
|
81
|
+
</div>
|
|
82
|
+
{provider === undefined ? (
|
|
83
|
+
<CopyPromptIntake reason="The AI module is not part of this install." />
|
|
84
|
+
) : (
|
|
85
|
+
<ProvidedIntake provider={provider} onClose={onClose} />
|
|
86
|
+
)}
|
|
87
|
+
</div>
|
|
88
|
+
</div>
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** Split out so `useAvailability` is only called when a provider exists. */
|
|
93
|
+
function ProvidedIntake({
|
|
94
|
+
provider,
|
|
95
|
+
onClose,
|
|
96
|
+
}: {
|
|
97
|
+
readonly provider: PersonIntakeProvider
|
|
98
|
+
readonly onClose: () => void
|
|
99
|
+
}): React.JSX.Element {
|
|
100
|
+
const availability: AgentRunnerAvailability = provider.useAvailability({ enabled: true })
|
|
101
|
+
|
|
102
|
+
if (availability.status === 'loading') {
|
|
103
|
+
return <LoadingPanel label="Checking AI…" />
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (availability.status === 'unavailable') {
|
|
107
|
+
return <CopyPromptIntake reason={availability.reason} />
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const Wizard = provider.Wizard
|
|
111
|
+
|
|
112
|
+
return <Wizard onClose={onClose} />
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** The dialog body and footer, the same frame the wizard's steps use. */
|
|
116
|
+
export function IntakeFrame({
|
|
117
|
+
children,
|
|
118
|
+
footer,
|
|
119
|
+
}: {
|
|
120
|
+
readonly children: ReactNode
|
|
121
|
+
readonly footer: ReactNode
|
|
122
|
+
}): React.JSX.Element {
|
|
123
|
+
return (
|
|
124
|
+
<>
|
|
125
|
+
<div className="min-h-0 flex-1 overflow-y-auto px-4 py-3">{children}</div>
|
|
126
|
+
<div className="flex flex-wrap items-center justify-end gap-2 border-t border-border px-4 py-3">{footer}</div>
|
|
127
|
+
</>
|
|
128
|
+
)
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export function NotesField({
|
|
132
|
+
value,
|
|
133
|
+
onChange,
|
|
134
|
+
disabled = false,
|
|
135
|
+
}: {
|
|
136
|
+
readonly value: string
|
|
137
|
+
readonly onChange: (value: string) => void
|
|
138
|
+
readonly disabled?: boolean
|
|
139
|
+
}): React.JSX.Element {
|
|
140
|
+
return (
|
|
141
|
+
<label className="block text-[12px] font-medium text-ink-muted">
|
|
142
|
+
What do you know about this person?
|
|
143
|
+
<textarea
|
|
144
|
+
value={value}
|
|
145
|
+
onChange={(event) => {
|
|
146
|
+
onChange(event.target.value)
|
|
147
|
+
}}
|
|
148
|
+
disabled={disabled}
|
|
149
|
+
rows={9}
|
|
150
|
+
maxLength={PERSON_INTAKE_MAX_TEXT}
|
|
151
|
+
autoFocus
|
|
152
|
+
placeholder={'Names, emails, a LinkedIn URL, an email signature, meeting notes…\n\nDana Reyes, dana@brightline.health. Met at HLTH; asked about a pilot.'}
|
|
153
|
+
className="mt-1 block w-full resize-y rounded-md border border-border bg-surface px-2.5 py-2 text-[13px] font-normal text-ink outline-none placeholder:text-ink-faint focus:border-accent disabled:opacity-60"
|
|
154
|
+
/>
|
|
155
|
+
<span className="mt-1 block font-normal text-ink-faint">
|
|
156
|
+
LinkedIn pages cannot be read without signing in. For the full profile, open it in your own browser, select
|
|
157
|
+
all, copy, and paste it here.
|
|
158
|
+
</span>
|
|
159
|
+
</label>
|
|
160
|
+
)
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/** The fallback: the add-person agent task's prompt with the notes appended. */
|
|
164
|
+
function CopyPromptIntake({ reason }: { readonly reason: string }): React.JSX.Element {
|
|
165
|
+
const { workspace } = useWorkspace()
|
|
166
|
+
const resolve = useResolveAgentTask()
|
|
167
|
+
const [text, setText] = useState('')
|
|
168
|
+
const [copied, setCopied] = useState(false)
|
|
169
|
+
const [clipboardFailed, setClipboardFailed] = useState(false)
|
|
170
|
+
|
|
171
|
+
async function copy(): Promise<void> {
|
|
172
|
+
if (workspace === undefined) return
|
|
173
|
+
|
|
174
|
+
setClipboardFailed(false)
|
|
175
|
+
const resolved = await resolve.runAsync({ taskId: ADD_PERSON_TASK, targetType: 'workspace', targetId: workspace.id })
|
|
176
|
+
const prompt = `${resolved.prompt}\n\n## Notes about the person\n\n${text.trim()}\n`
|
|
177
|
+
|
|
178
|
+
try {
|
|
179
|
+
await navigator.clipboard.writeText(prompt)
|
|
180
|
+
setCopied(true)
|
|
181
|
+
} catch {
|
|
182
|
+
setClipboardFailed(true)
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
return (
|
|
187
|
+
<IntakeFrame
|
|
188
|
+
footer={
|
|
189
|
+
<button
|
|
190
|
+
type="button"
|
|
191
|
+
disabled={text.trim().length === 0 || resolve.isPending || workspace === undefined}
|
|
192
|
+
onClick={() => {
|
|
193
|
+
void copy().catch(() => undefined)
|
|
194
|
+
}}
|
|
195
|
+
className="rounded-md bg-accent px-3 py-1.5 text-[12px] font-semibold text-accent-fg hover:bg-accent-hover disabled:opacity-50"
|
|
196
|
+
>
|
|
197
|
+
{resolve.isPending ? 'Preparing…' : copied ? 'Copied' : 'Copy prompt for your agent'}
|
|
198
|
+
</button>
|
|
199
|
+
}
|
|
200
|
+
>
|
|
201
|
+
<div className="mb-3 rounded-md border border-border bg-surface-sunken px-3 py-2 text-[12px] text-ink-muted">
|
|
202
|
+
<p className="font-medium text-ink">AI cannot run this for you now.</p>
|
|
203
|
+
<p className="mt-0.5">{reason}</p>
|
|
204
|
+
<p className="mt-1">
|
|
205
|
+
You can still copy a prompt with your notes in it. Paste it into an agent connected to Kelpie over MCP
|
|
206
|
+
(Claude, Cursor, …), and the agent creates the records.
|
|
207
|
+
</p>
|
|
208
|
+
</div>
|
|
209
|
+
<NotesField
|
|
210
|
+
value={text}
|
|
211
|
+
onChange={(value) => {
|
|
212
|
+
setText(value)
|
|
213
|
+
setCopied(false)
|
|
214
|
+
}}
|
|
215
|
+
/>
|
|
216
|
+
{resolve.error !== null && (
|
|
217
|
+
<div className="mt-3">
|
|
218
|
+
<ErrorPanel error={resolve.error} />
|
|
219
|
+
</div>
|
|
220
|
+
)}
|
|
221
|
+
{clipboardFailed && (
|
|
222
|
+
<p className="mt-2 text-[12px] text-danger">The browser did not allow Kelpie to copy to the clipboard.</p>
|
|
223
|
+
)}
|
|
224
|
+
</IntakeFrame>
|
|
225
|
+
)
|
|
226
|
+
}
|
package/src/components/Shell.tsx
CHANGED
|
@@ -29,7 +29,7 @@ const CORE_ADMIN_NAV: readonly NavItem[] = [
|
|
|
29
29
|
{ id: 'data', label: 'Data', to: '/admin/data', order: 300 },
|
|
30
30
|
{ id: 'api-keys', label: 'API keys', to: '/admin/api-keys', order: 350 },
|
|
31
31
|
{ id: 'webhooks', label: 'Webhooks', to: '/admin/webhooks', order: 400 },
|
|
32
|
-
{ id: '
|
|
32
|
+
{ id: 'ai', label: 'AI', to: '/admin/ai', order: 500 },
|
|
33
33
|
{ id: 'modules', label: 'Modules', to: '/admin/modules', order: 600 },
|
|
34
34
|
]
|
|
35
35
|
|
package/src/index.ts
CHANGED
|
@@ -208,15 +208,19 @@ export type { ThemePreference } from './lib/theme.ts'
|
|
|
208
208
|
|
|
209
209
|
export { EXTENSIBLE_RECORD_TYPES, NAV_SLOTS } from './registry/contributions.ts'
|
|
210
210
|
export type {
|
|
211
|
+
AdminTab,
|
|
211
212
|
AgentRunner,
|
|
212
213
|
AgentRunnerAvailability,
|
|
213
214
|
AgentRunnerProgress,
|
|
214
215
|
AuthMethod,
|
|
215
216
|
AuthMethodContext,
|
|
216
217
|
DashboardCard,
|
|
218
|
+
ExtensibleAdminPage,
|
|
217
219
|
ExtensibleRecordType,
|
|
218
220
|
NavItem,
|
|
219
221
|
NavSlot,
|
|
222
|
+
PersonIntakeProvider,
|
|
223
|
+
PersonIntakeWizardProps,
|
|
220
224
|
RecordContext,
|
|
221
225
|
RecordSidebarCard,
|
|
222
226
|
RecordTab,
|
|
@@ -230,12 +234,14 @@ export { NO_UI_MODULES, UiModuleError, inSlotOrder, registerUiModules } from './
|
|
|
230
234
|
export type { UiExtensions, UiModule, UiModuleContext } from './registry/registry.ts'
|
|
231
235
|
|
|
232
236
|
export {
|
|
237
|
+
useAdminTabs,
|
|
233
238
|
useAgentRunner,
|
|
234
239
|
useAuthMethods,
|
|
235
240
|
useDashboardCards,
|
|
236
241
|
useModuleRoutes,
|
|
237
242
|
useNavItems,
|
|
238
243
|
useOverridable,
|
|
244
|
+
usePersonIntakeProvider,
|
|
239
245
|
useRecordSidebarCards,
|
|
240
246
|
useRecordTabs,
|
|
241
247
|
useUiExtensions,
|
|
@@ -247,5 +253,5 @@ export type { UiExtensionProviderProps } from './registry/UiExtensionProvider.ts
|
|
|
247
253
|
// The optional `ai` module's UI. An assembly that lists `createAiModule()` on
|
|
248
254
|
// the server lists `aiUi` in its `uiModules`.
|
|
249
255
|
export { aiUi } from './modules/ai.tsx'
|
|
250
|
-
export {
|
|
256
|
+
export { AiRunLogTab, AiSettingsTab } from './pages/admin/AiPage.tsx'
|
|
251
257
|
export { useAiRuns, useAiSettings, useDisableAi, useSaveAiSettings } from './api/resources/ai.ts'
|