@kelpie/ui 0.21.0 → 0.23.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/resource.d.ts +12 -0
- package/dist/api/resource.d.ts.map +1 -1
- package/dist/api/resource.js +11 -0
- package/dist/api/resource.js.map +1 -1
- package/dist/api/resources/decisions.d.ts +31 -0
- package/dist/api/resources/decisions.d.ts.map +1 -1
- package/dist/api/resources/decisions.js +51 -1
- package/dist/api/resources/decisions.js.map +1 -1
- package/dist/api/resources/forms.d.ts +21 -7
- package/dist/api/resources/forms.d.ts.map +1 -1
- package/dist/api/resources/forms.js +39 -1
- package/dist/api/resources/forms.js.map +1 -1
- package/dist/api/resources/oauth.d.ts +2 -0
- package/dist/api/resources/oauth.d.ts.map +1 -1
- package/dist/api/resources/oauth.js +13 -1
- package/dist/api/resources/oauth.js.map +1 -1
- package/dist/api/resources/personIntake.d.ts +15 -3
- package/dist/api/resources/personIntake.d.ts.map +1 -1
- package/dist/api/resources/personIntake.js +38 -9
- package/dist/api/resources/personIntake.js.map +1 -1
- package/dist/api/resources/session.d.ts.map +1 -1
- package/dist/api/resources/session.js +4 -0
- package/dist/api/resources/session.js.map +1 -1
- package/dist/api/resources/tags.d.ts +20 -0
- package/dist/api/resources/tags.d.ts.map +1 -0
- package/dist/api/resources/tags.js +52 -0
- package/dist/api/resources/tags.js.map +1 -0
- package/dist/app/KelpieApp.d.ts.map +1 -1
- package/dist/app/KelpieApp.js +2 -1
- package/dist/app/KelpieApp.js.map +1 -1
- package/dist/components/AddRecordPanel.d.ts +35 -0
- package/dist/components/AddRecordPanel.d.ts.map +1 -0
- package/dist/components/AddRecordPanel.js +35 -0
- package/dist/components/AddRecordPanel.js.map +1 -0
- package/dist/components/AiDrawer.d.ts.map +1 -1
- package/dist/components/AiDrawer.js +29 -6
- package/dist/components/AiDrawer.js.map +1 -1
- package/dist/components/ApiKeysPanel.d.ts.map +1 -1
- package/dist/components/ApiKeysPanel.js +101 -44
- package/dist/components/ApiKeysPanel.js.map +1 -1
- package/dist/components/Chip.d.ts +5 -1
- package/dist/components/Chip.d.ts.map +1 -1
- package/dist/components/Chip.js +8 -2
- package/dist/components/Chip.js.map +1 -1
- package/dist/components/CustomFieldsPanel.d.ts.map +1 -1
- package/dist/components/CustomFieldsPanel.js +5 -2
- package/dist/components/CustomFieldsPanel.js.map +1 -1
- package/dist/components/DecisionProvenance.d.ts +27 -0
- package/dist/components/DecisionProvenance.d.ts.map +1 -0
- package/dist/components/DecisionProvenance.js +53 -0
- package/dist/components/DecisionProvenance.js.map +1 -0
- package/dist/components/DecisionsPanel.d.ts +3 -0
- package/dist/components/DecisionsPanel.d.ts.map +1 -1
- package/dist/components/DecisionsPanel.js +9 -5
- package/dist/components/DecisionsPanel.js.map +1 -1
- package/dist/components/MarkdownView.d.ts.map +1 -1
- package/dist/components/MarkdownView.js +18 -2
- package/dist/components/MarkdownView.js.map +1 -1
- package/dist/components/NotesPanel.d.ts.map +1 -1
- package/dist/components/NotesPanel.js +7 -3
- package/dist/components/NotesPanel.js.map +1 -1
- package/dist/components/OriginLabel.d.ts +5 -0
- package/dist/components/OriginLabel.d.ts.map +1 -0
- package/dist/components/OriginLabel.js +22 -0
- package/dist/components/OriginLabel.js.map +1 -0
- package/dist/components/Shell.d.ts.map +1 -1
- package/dist/components/Shell.js +17 -5
- package/dist/components/Shell.js.map +1 -1
- package/dist/components/TagInput.d.ts +29 -0
- package/dist/components/TagInput.d.ts.map +1 -0
- package/dist/components/TagInput.js +139 -0
- package/dist/components/TagInput.js.map +1 -0
- package/dist/components/aiDrawerState.d.ts +12 -0
- package/dist/components/aiDrawerState.d.ts.map +1 -1
- package/dist/components/aiDrawerState.js.map +1 -1
- package/dist/components/personIntakeTask.d.ts +15 -0
- package/dist/components/personIntakeTask.d.ts.map +1 -1
- package/dist/components/personIntakeTask.js +42 -0
- package/dist/components/personIntakeTask.js.map +1 -1
- package/dist/lib/personIntakeRunStorage.d.ts +15 -0
- package/dist/lib/personIntakeRunStorage.d.ts.map +1 -0
- package/dist/lib/personIntakeRunStorage.js +88 -0
- package/dist/lib/personIntakeRunStorage.js.map +1 -0
- package/dist/modules/PersonIntakeWizard.d.ts +1 -1
- package/dist/modules/PersonIntakeWizard.d.ts.map +1 -1
- package/dist/modules/PersonIntakeWizard.js +243 -29
- package/dist/modules/PersonIntakeWizard.js.map +1 -1
- package/dist/modules/ai.d.ts +1 -1
- package/dist/modules/ai.js +1 -1
- package/dist/pages/CompaniesPage.d.ts.map +1 -1
- package/dist/pages/CompaniesPage.js +13 -6
- package/dist/pages/CompaniesPage.js.map +1 -1
- package/dist/pages/CompanyDetail.d.ts.map +1 -1
- package/dist/pages/CompanyDetail.js +4 -3
- package/dist/pages/CompanyDetail.js.map +1 -1
- package/dist/pages/DealDetail.d.ts.map +1 -1
- package/dist/pages/DealDetail.js +4 -3
- package/dist/pages/DealDetail.js.map +1 -1
- package/dist/pages/DealsPage.d.ts.map +1 -1
- package/dist/pages/DealsPage.js +16 -8
- package/dist/pages/DealsPage.js.map +1 -1
- package/dist/pages/DecisionsPage.d.ts.map +1 -1
- package/dist/pages/DecisionsPage.js +7 -3
- package/dist/pages/DecisionsPage.js.map +1 -1
- package/dist/pages/EnquiriesPage.d.ts.map +1 -1
- package/dist/pages/EnquiriesPage.js +14 -6
- package/dist/pages/EnquiriesPage.js.map +1 -1
- package/dist/pages/EnquiryDetail.js +4 -4
- package/dist/pages/EnquiryDetail.js.map +1 -1
- package/dist/pages/EventDetail.js +4 -4
- package/dist/pages/EventDetail.js.map +1 -1
- package/dist/pages/FundraisingPage.d.ts.map +1 -1
- package/dist/pages/FundraisingPage.js +16 -11
- package/dist/pages/FundraisingPage.js.map +1 -1
- package/dist/pages/OpportunitiesPage.d.ts.map +1 -1
- package/dist/pages/OpportunitiesPage.js +14 -6
- package/dist/pages/OpportunitiesPage.js.map +1 -1
- package/dist/pages/OpportunityDetail.js +4 -4
- package/dist/pages/OpportunityDetail.js.map +1 -1
- package/dist/pages/PartnershipDetail.js +4 -4
- package/dist/pages/PartnershipDetail.js.map +1 -1
- package/dist/pages/PartnershipsPage.d.ts.map +1 -1
- package/dist/pages/PartnershipsPage.js +16 -11
- package/dist/pages/PartnershipsPage.js.map +1 -1
- package/dist/pages/PeoplePage.d.ts.map +1 -1
- package/dist/pages/PeoplePage.js +13 -8
- package/dist/pages/PeoplePage.js.map +1 -1
- package/dist/pages/PersonDetail.js +7 -7
- package/dist/pages/PersonDetail.js.map +1 -1
- package/dist/pages/RaiseDetail.js +4 -4
- package/dist/pages/RaiseDetail.js.map +1 -1
- package/dist/pages/SearchPage.d.ts.map +1 -1
- package/dist/pages/SearchPage.js +2 -1
- package/dist/pages/SearchPage.js.map +1 -1
- package/dist/pages/account/ConnectedAppsPage.d.ts +0 -5
- package/dist/pages/account/ConnectedAppsPage.d.ts.map +1 -1
- package/dist/pages/account/ConnectedAppsPage.js +38 -6
- package/dist/pages/account/ConnectedAppsPage.js.map +1 -1
- package/dist/pages/admin/AgentsPanel.d.ts +10 -0
- package/dist/pages/admin/AgentsPanel.d.ts.map +1 -0
- package/dist/pages/admin/AgentsPanel.js +81 -0
- package/dist/pages/admin/AgentsPanel.js.map +1 -0
- package/dist/pages/admin/AiAdminPage.d.ts.map +1 -1
- package/dist/pages/admin/AiAdminPage.js +9 -6
- package/dist/pages/admin/AiAdminPage.js.map +1 -1
- package/dist/pages/admin/AiPage.js +1 -1
- package/dist/pages/admin/TeamPage.d.ts.map +1 -1
- package/dist/pages/admin/TeamPage.js +16 -3
- package/dist/pages/admin/TeamPage.js.map +1 -1
- package/dist/pages/ai/AiAccessPage.d.ts +11 -0
- package/dist/pages/ai/AiAccessPage.d.ts.map +1 -0
- package/dist/pages/ai/AiAccessPage.js +16 -0
- package/dist/pages/ai/AiAccessPage.js.map +1 -0
- package/dist/pages/ai/McpPanel.d.ts +7 -0
- package/dist/pages/ai/McpPanel.d.ts.map +1 -0
- package/dist/pages/ai/McpPanel.js +86 -0
- package/dist/pages/ai/McpPanel.js.map +1 -0
- package/dist/pages/auth/nextPath.d.ts +6 -0
- package/dist/pages/auth/nextPath.d.ts.map +1 -1
- package/dist/pages/auth/nextPath.js +16 -1
- package/dist/pages/auth/nextPath.js.map +1 -1
- package/dist/pages/dashboard/sections.d.ts.map +1 -1
- package/dist/pages/dashboard/sections.js +4 -2
- package/dist/pages/dashboard/sections.js.map +1 -1
- package/dist/pages/forms/EmbedPanel.js +1 -1
- 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 +6 -7
- package/dist/pages/forms/FieldsEditor.js.map +1 -1
- package/dist/pages/forms/FormActions.d.ts.map +1 -1
- package/dist/pages/forms/FormActions.js +4 -11
- package/dist/pages/forms/FormActions.js.map +1 -1
- package/dist/pages/forms/FormEmails.d.ts.map +1 -1
- package/dist/pages/forms/FormEmails.js +6 -1
- package/dist/pages/forms/FormEmails.js.map +1 -1
- package/dist/pages/forms/FormSettings.d.ts.map +1 -1
- package/dist/pages/forms/FormSettings.js +6 -2
- 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 +26 -6
- 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 +81 -6
- package/dist/pages/forms/SubmissionsTable.js.map +1 -1
- package/dist/pages/forms/fieldList.d.ts +13 -5
- package/dist/pages/forms/fieldList.d.ts.map +1 -1
- package/dist/pages/forms/fieldList.js +12 -4
- package/dist/pages/forms/fieldList.js.map +1 -1
- package/dist/pages/oauth/ConsentPage.d.ts.map +1 -1
- package/dist/pages/oauth/ConsentPage.js +132 -15
- package/dist/pages/oauth/ConsentPage.js.map +1 -1
- package/dist/registry/contributions.d.ts +1 -1
- package/package.json +3 -3
- package/src/api/resource.ts +16 -0
- package/src/api/resources/decisions.ts +81 -1
- package/src/api/resources/forms.ts +68 -7
- package/src/api/resources/oauth.ts +15 -1
- package/src/api/resources/personIntake.ts +54 -13
- package/src/api/resources/session.ts +4 -0
- package/src/api/resources/tags.ts +71 -0
- package/src/app/KelpieApp.tsx +4 -2
- package/src/components/AddRecordPanel.tsx +143 -0
- package/src/components/AiDrawer.tsx +34 -7
- package/src/components/ApiKeysPanel.tsx +193 -75
- package/src/components/Chip.tsx +32 -1
- package/src/components/CustomFieldsPanel.tsx +15 -5
- package/src/components/DecisionProvenance.tsx +95 -0
- package/src/components/DecisionsPanel.tsx +30 -2
- package/src/components/MarkdownView.tsx +45 -11
- package/src/components/NotesPanel.tsx +15 -6
- package/src/components/OriginLabel.tsx +26 -0
- package/src/components/Shell.tsx +30 -6
- package/src/components/TagInput.tsx +285 -0
- package/src/components/aiDrawerState.ts +12 -0
- package/src/components/personIntakeTask.tsx +48 -0
- package/src/lib/personIntakeRunStorage.ts +97 -0
- package/src/modules/PersonIntakeWizard.tsx +391 -30
- package/src/modules/ai.tsx +1 -1
- package/src/pages/CompaniesPage.tsx +22 -5
- package/src/pages/CompanyDetail.tsx +6 -17
- package/src/pages/DealDetail.tsx +6 -17
- package/src/pages/DealsPage.tsx +25 -8
- package/src/pages/DecisionsPage.tsx +28 -1
- package/src/pages/EnquiriesPage.tsx +23 -5
- package/src/pages/EnquiryDetail.tsx +6 -18
- package/src/pages/EventDetail.tsx +6 -18
- package/src/pages/FundraisingPage.tsx +25 -11
- package/src/pages/OpportunitiesPage.tsx +23 -5
- package/src/pages/OpportunityDetail.tsx +6 -18
- package/src/pages/PartnershipDetail.tsx +6 -18
- package/src/pages/PartnershipsPage.tsx +25 -11
- package/src/pages/PeoplePage.tsx +22 -7
- package/src/pages/PersonDetail.tsx +11 -21
- package/src/pages/RaiseDetail.tsx +6 -18
- package/src/pages/SearchPage.tsx +3 -0
- package/src/pages/account/ConnectedAppsPage.tsx +97 -14
- package/src/pages/admin/{McpPanel.tsx → AgentsPanel.tsx} +11 -168
- package/src/pages/admin/AiAdminPage.tsx +16 -11
- package/src/pages/admin/AiPage.tsx +1 -1
- package/src/pages/admin/TeamPage.tsx +33 -0
- package/src/pages/ai/AiAccessPage.tsx +23 -0
- package/src/pages/ai/McpPanel.tsx +261 -0
- package/src/pages/auth/nextPath.ts +18 -1
- package/src/pages/dashboard/sections.tsx +4 -0
- package/src/pages/forms/EmbedPanel.tsx +3 -2
- package/src/pages/forms/FieldsEditor.tsx +6 -7
- package/src/pages/forms/FormActions.tsx +18 -20
- package/src/pages/forms/FormEmails.tsx +11 -2
- package/src/pages/forms/FormSettings.tsx +5 -0
- package/src/pages/forms/SubmissionDetail.tsx +47 -9
- package/src/pages/forms/SubmissionsTable.tsx +180 -5
- package/src/pages/forms/fieldList.ts +21 -7
- package/src/pages/oauth/ConsentPage.tsx +271 -33
- package/src/registry/contributions.ts +1 -1
package/src/pages/PeoplePage.tsx
CHANGED
|
@@ -5,6 +5,8 @@ import { useNavigate } from 'react-router'
|
|
|
5
5
|
|
|
6
6
|
import { useTimezone } from '../api/resources/account.ts'
|
|
7
7
|
import { useCreatePerson, usePeople } from '../api/resources/people.ts'
|
|
8
|
+
import { AddRecordPanel } from '../components/AddRecordPanel.tsx'
|
|
9
|
+
import type { AddRecordValues } from '../components/AddRecordPanel.tsx'
|
|
8
10
|
import { useAiDrawer } from '../components/aiDrawerState.ts'
|
|
9
11
|
import { Chip } from '../components/Chip.tsx'
|
|
10
12
|
import { SocialNetworkIcon } from '../components/SocialNetworkIcon.tsx'
|
|
@@ -64,12 +66,14 @@ export function PeoplePage(): React.JSX.Element {
|
|
|
64
66
|
const createPerson = useCreatePerson()
|
|
65
67
|
const aiDrawer = useAiDrawer()
|
|
66
68
|
|
|
67
|
-
|
|
68
|
-
// The same defaults the API applies, so a person created here and one
|
|
69
|
-
// created through the API are the same record.
|
|
70
|
-
const person = await createPerson.runAsync({ name: 'New person' })
|
|
69
|
+
const [adding, setAdding] = useState(false)
|
|
71
70
|
|
|
72
|
-
|
|
71
|
+
function addPerson(values: AddRecordValues): void {
|
|
72
|
+
createPerson
|
|
73
|
+
.runAsync({ name: values.name })
|
|
74
|
+
.then((record) => navigate(`/people/${record.id}`))
|
|
75
|
+
// The failure is shown from `createPerson.error` below.
|
|
76
|
+
.catch(() => undefined)
|
|
73
77
|
}
|
|
74
78
|
|
|
75
79
|
const columns: readonly Column<Person>[] = [
|
|
@@ -244,7 +248,7 @@ export function PeoplePage(): React.JSX.Element {
|
|
|
244
248
|
<PageHeader
|
|
245
249
|
title="People"
|
|
246
250
|
onAdd={() => {
|
|
247
|
-
|
|
251
|
+
setAdding(true)
|
|
248
252
|
}}
|
|
249
253
|
addLabel="Add person"
|
|
250
254
|
actions={
|
|
@@ -268,6 +272,17 @@ export function PeoplePage(): React.JSX.Element {
|
|
|
268
272
|
placeholder="Filter by name, position, company…"
|
|
269
273
|
/>
|
|
270
274
|
|
|
275
|
+
{adding && (
|
|
276
|
+
<AddRecordPanel
|
|
277
|
+
title="Add person"
|
|
278
|
+
isPending={createPerson.isPending}
|
|
279
|
+
onCancel={() => {
|
|
280
|
+
setAdding(false)
|
|
281
|
+
}}
|
|
282
|
+
onCreate={addPerson}
|
|
283
|
+
/>
|
|
284
|
+
)}
|
|
285
|
+
|
|
271
286
|
{createPerson.error !== null && (
|
|
272
287
|
<div className="mb-3">
|
|
273
288
|
<ErrorPanel error={createPerson.error} />
|
|
@@ -296,7 +311,7 @@ export function PeoplePage(): React.JSX.Element {
|
|
|
296
311
|
: {
|
|
297
312
|
label: 'Add person',
|
|
298
313
|
onClick: () => {
|
|
299
|
-
|
|
314
|
+
setAdding(true)
|
|
300
315
|
},
|
|
301
316
|
}
|
|
302
317
|
}
|
|
@@ -32,7 +32,6 @@ import {
|
|
|
32
32
|
import { AddressSidebarLink, AddressesField } from '../components/AddressesField.tsx'
|
|
33
33
|
import { ActivitiesPanel, LatestActivity } from '../components/ActivitiesPanel.tsx'
|
|
34
34
|
import { AgentTasks } from '../components/AgentTasks.tsx'
|
|
35
|
-
import { Chip } from '../components/Chip.tsx'
|
|
36
35
|
import { DecisionsPanel } from '../components/DecisionsPanel.tsx'
|
|
37
36
|
import { FormsPanel } from '../components/FormsPanel.tsx'
|
|
38
37
|
import { DeleteRecord } from '../components/DeleteRecord.tsx'
|
|
@@ -49,6 +48,7 @@ import { RecordTabs } from '../components/RecordTabs.tsx'
|
|
|
49
48
|
import type { RecordTabDescriptor } from '../components/RecordTabs.tsx'
|
|
50
49
|
import { SectionHeader } from '../components/SectionHeader.tsx'
|
|
51
50
|
import { SidebarField } from '../components/SidebarField.tsx'
|
|
51
|
+
import { TagInput } from '../components/TagInput.tsx'
|
|
52
52
|
import { SocialProfileIcons, SocialProfilesField } from '../components/SocialProfilesField.tsx'
|
|
53
53
|
import { TimezoneSearch } from '../components/TimezoneSearch.tsx'
|
|
54
54
|
import { PhonesField } from '../components/PhonesField.tsx'
|
|
@@ -61,7 +61,7 @@ import {
|
|
|
61
61
|
CandidateStageField,
|
|
62
62
|
CandidateStatusField,
|
|
63
63
|
} from './candidateFields.tsx'
|
|
64
|
-
import { toOptions
|
|
64
|
+
import { toOptions } from './fields.ts'
|
|
65
65
|
import { usePersonNames, useRoleTitles } from './hiringDirectory.ts'
|
|
66
66
|
|
|
67
67
|
/**
|
|
@@ -587,24 +587,12 @@ function PersonSidebar({
|
|
|
587
587
|
/>
|
|
588
588
|
</SidebarField>
|
|
589
589
|
<SidebarField label="Tags">
|
|
590
|
-
<
|
|
591
|
-
value={person.tags
|
|
592
|
-
|
|
593
|
-
|
|
590
|
+
<TagInput
|
|
591
|
+
value={person.tags}
|
|
592
|
+
targetType="person"
|
|
593
|
+
onChange={(tags) => {
|
|
594
|
+
patch({ tags })
|
|
594
595
|
}}
|
|
595
|
-
display={
|
|
596
|
-
person.tags.length > 0 ? (
|
|
597
|
-
<span className="flex flex-wrap gap-1">
|
|
598
|
-
{person.tags.map((tag) => (
|
|
599
|
-
<Chip key={tag}>
|
|
600
|
-
<span className="text-[10px]">{tag}</span>
|
|
601
|
-
</Chip>
|
|
602
|
-
))}
|
|
603
|
-
</span>
|
|
604
|
-
) : undefined
|
|
605
|
-
}
|
|
606
|
-
emptyLabel="Add tags…"
|
|
607
|
-
displayClassName="not-italic"
|
|
608
596
|
/>
|
|
609
597
|
</SidebarField>
|
|
610
598
|
</section>
|
|
@@ -850,7 +838,7 @@ function PersonConsents({ person }: { readonly person: Person }): React.JSX.Elem
|
|
|
850
838
|
) : (
|
|
851
839
|
person.consents.map((consent) => (
|
|
852
840
|
<SidebarField key={consent.purposeSlug} label={consent.purposeLabel}>
|
|
853
|
-
<div className="flex items-center gap-2">
|
|
841
|
+
<div className="flex flex-wrap items-center gap-x-2 gap-y-1">
|
|
854
842
|
<select
|
|
855
843
|
value={consent.inherited ? '' : consent.status}
|
|
856
844
|
onChange={(event) => {
|
|
@@ -867,7 +855,9 @@ function PersonConsents({ person }: { readonly person: Person }): React.JSX.Elem
|
|
|
867
855
|
<option value="withdrawn">Withdrawn</option>
|
|
868
856
|
</select>
|
|
869
857
|
{!consent.inherited && consent.source !== null && (
|
|
870
|
-
<span className="text-[10px] text-ink-faint">
|
|
858
|
+
<span className="min-w-0 break-all text-[10px] text-ink-faint">
|
|
859
|
+
via {consent.source}
|
|
860
|
+
</span>
|
|
871
861
|
)}
|
|
872
862
|
</div>
|
|
873
863
|
</SidebarField>
|
|
@@ -37,13 +37,13 @@ import { RecordTabs } from '../components/RecordTabs.tsx'
|
|
|
37
37
|
import type { RecordTabDescriptor } from '../components/RecordTabs.tsx'
|
|
38
38
|
import { SectionHeader } from '../components/SectionHeader.tsx'
|
|
39
39
|
import { SidebarField } from '../components/SidebarField.tsx'
|
|
40
|
+
import { TagInput } from '../components/TagInput.tsx'
|
|
40
41
|
import { SummaryBlock } from '../components/SummaryBlock.tsx'
|
|
41
42
|
import { formatDay } from '../lib/dates.ts'
|
|
42
43
|
import { formatMoney } from '../lib/money.ts'
|
|
43
44
|
import { useRecordTab } from '../lib/fragmentTarget.ts'
|
|
44
45
|
import { useRecordTabs } from '../registry/context.ts'
|
|
45
46
|
import { inSlotOrder } from '../registry/registry.ts'
|
|
46
|
-
import { toTags } from './fields.ts'
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
49
|
* One raise.
|
|
@@ -406,24 +406,12 @@ function RaiseSidebar({ raise }: { readonly raise: Raise }): React.JSX.Element {
|
|
|
406
406
|
</SidebarField>
|
|
407
407
|
)}
|
|
408
408
|
<SidebarField label="Tags">
|
|
409
|
-
<
|
|
410
|
-
value={raise.tags
|
|
411
|
-
|
|
412
|
-
|
|
409
|
+
<TagInput
|
|
410
|
+
value={raise.tags}
|
|
411
|
+
targetType="raise"
|
|
412
|
+
onChange={(tags) => {
|
|
413
|
+
patch({ tags })
|
|
413
414
|
}}
|
|
414
|
-
display={
|
|
415
|
-
raise.tags.length > 0 ? (
|
|
416
|
-
<span className="flex flex-wrap gap-1">
|
|
417
|
-
{raise.tags.map((tag) => (
|
|
418
|
-
<Chip key={tag}>
|
|
419
|
-
<span className="text-[10px]">{tag}</span>
|
|
420
|
-
</Chip>
|
|
421
|
-
))}
|
|
422
|
-
</span>
|
|
423
|
-
) : undefined
|
|
424
|
-
}
|
|
425
|
-
emptyLabel="Add tags…"
|
|
426
|
-
displayClassName="not-italic"
|
|
427
415
|
/>
|
|
428
416
|
</SidebarField>
|
|
429
417
|
</section>
|
package/src/pages/SearchPage.tsx
CHANGED
|
@@ -2,6 +2,7 @@ import type { SearchCollection, SearchResult, SearchResultGroup } from '@kelpie/
|
|
|
2
2
|
import { Link, useSearchParams } from 'react-router'
|
|
3
3
|
|
|
4
4
|
import { useSearch } from '../api/resources/search.ts'
|
|
5
|
+
import { Chip } from '../components/Chip.tsx'
|
|
5
6
|
import { ErrorPanel, LoadingPanel } from '../components/QueryState.tsx'
|
|
6
7
|
import { PageHeader } from '../components/PageHeader.tsx'
|
|
7
8
|
import { attachedHref } from '../lib/recordLinks.ts'
|
|
@@ -140,6 +141,8 @@ function ResultRow({
|
|
|
140
141
|
>
|
|
141
142
|
<div className="flex items-center justify-between gap-3">
|
|
142
143
|
<span className="min-w-0 flex-1 truncate text-[13px] font-medium text-ink">{item.title}</span>
|
|
144
|
+
{/* A Decision no member has confirmed is not a commitment yet. */}
|
|
145
|
+
{item.decision !== null && item.decision.confirmedAt === null && <Chip tone="warning">Proposed</Chip>}
|
|
143
146
|
{item.subtitle !== null && item.subtitle.length > 0 && (
|
|
144
147
|
<span className="max-w-[45%] truncate text-[11px] text-ink-faint">{item.subtitle}</span>
|
|
145
148
|
)}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { API_KEY_SCOPE_LABELS } from '@kelpie/schemas'
|
|
1
|
+
import { API_KEY_SCOPE_LABELS, isSensitiveApiKeyScope } from '@kelpie/schemas'
|
|
2
2
|
import type { OAuthGrant } from '@kelpie/schemas'
|
|
3
3
|
import { useState } from 'react'
|
|
4
4
|
|
|
5
5
|
import { useTimezone } from '../../api/resources/account.ts'
|
|
6
|
-
import { useOAuthGrants, useRevokeOAuthGrant } from '../../api/resources/oauth.ts'
|
|
6
|
+
import { useOAuthGrants, useRevokeOAuthConnection, useRevokeOAuthGrant } from '../../api/resources/oauth.ts'
|
|
7
|
+
import { Chip } from '../../components/Chip.tsx'
|
|
7
8
|
import { PageHeader } from '../../components/PageHeader.tsx'
|
|
8
9
|
import { ErrorPanel, LoadingPanel } from '../../components/QueryState.tsx'
|
|
9
10
|
import { formatDate } from '../../lib/dates.ts'
|
|
@@ -12,20 +13,38 @@ import { formatDate } from '../../lib/dates.ts'
|
|
|
12
13
|
* MCP clients this person connected through OAuth, across every workspace they
|
|
13
14
|
* belong to. Private to them, as personal API keys are: an admin's control is
|
|
14
15
|
* removing the member, which ends every connection in that workspace.
|
|
16
|
+
*
|
|
17
|
+
* One row for each workspace of a connection, so a person can disconnect one
|
|
18
|
+
* workspace and keep the others. Workspaces that were approved together are
|
|
19
|
+
* listed together, and the first of them carries the action that ends them all.
|
|
15
20
|
*/
|
|
21
|
+
|
|
22
|
+
/** A connection's rows next to each other, in the order the connections arrived. */
|
|
23
|
+
function byConnection(grants: readonly OAuthGrant[]): readonly (readonly OAuthGrant[])[] {
|
|
24
|
+
const groups = new Map<string, OAuthGrant[]>()
|
|
25
|
+
|
|
26
|
+
for (const grant of grants) {
|
|
27
|
+
groups.set(grant.connectionId, [...(groups.get(grant.connectionId) ?? []), grant])
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return [...groups.values()]
|
|
31
|
+
}
|
|
32
|
+
|
|
16
33
|
export function ConnectedAppsPage(): React.JSX.Element {
|
|
17
34
|
const { grants, isLoading, error } = useOAuthGrants()
|
|
18
35
|
const revoke = useRevokeOAuthGrant()
|
|
36
|
+
const revokeConnection = useRevokeOAuthConnection()
|
|
19
37
|
|
|
20
38
|
return (
|
|
21
39
|
<div className="animate-slide-in space-y-4">
|
|
22
40
|
<PageHeader
|
|
23
41
|
title="Connected apps"
|
|
24
|
-
description="Apps you connected through MCP sign-in. Each one acts as you, in
|
|
42
|
+
description="Apps you connected through MCP sign-in. Each one acts as you, in the workspaces you approved."
|
|
25
43
|
/>
|
|
26
44
|
|
|
27
45
|
{error !== null && <ErrorPanel error={error} />}
|
|
28
46
|
{revoke.error !== null && <ErrorPanel error={revoke.error} />}
|
|
47
|
+
{revokeConnection.error !== null && <ErrorPanel error={revokeConnection.error} />}
|
|
29
48
|
|
|
30
49
|
{isLoading ? (
|
|
31
50
|
<LoadingPanel label="Loading connected apps…" />
|
|
@@ -47,16 +66,24 @@ export function ConnectedAppsPage(): React.JSX.Element {
|
|
|
47
66
|
</tr>
|
|
48
67
|
</thead>
|
|
49
68
|
<tbody>
|
|
50
|
-
{grants.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
69
|
+
{byConnection(grants).flatMap((group) =>
|
|
70
|
+
group.map((grant, index) => (
|
|
71
|
+
<GrantRow
|
|
72
|
+
key={grant.id}
|
|
73
|
+
grant={grant}
|
|
74
|
+
// Only a connection with more than one workspace needs the
|
|
75
|
+
// second action: with one, Disconnect already ends it.
|
|
76
|
+
connectionSize={index === 0 ? group.length : 0}
|
|
77
|
+
onRevoke={(id) => {
|
|
78
|
+
revoke.run(id)
|
|
79
|
+
}}
|
|
80
|
+
onRevokeConnection={(id) => {
|
|
81
|
+
revokeConnection.run(id)
|
|
82
|
+
}}
|
|
83
|
+
isRevoking={revoke.isPending || revokeConnection.isPending}
|
|
84
|
+
/>
|
|
85
|
+
)),
|
|
86
|
+
)}
|
|
60
87
|
</tbody>
|
|
61
88
|
</table>
|
|
62
89
|
</div>
|
|
@@ -67,14 +94,20 @@ export function ConnectedAppsPage(): React.JSX.Element {
|
|
|
67
94
|
|
|
68
95
|
function GrantRow({
|
|
69
96
|
grant,
|
|
97
|
+
connectionSize,
|
|
70
98
|
onRevoke,
|
|
99
|
+
onRevokeConnection,
|
|
71
100
|
isRevoking,
|
|
72
101
|
}: {
|
|
73
102
|
readonly grant: OAuthGrant
|
|
103
|
+
/** How many workspaces the connection covers, on its first row. Zero on the others. */
|
|
104
|
+
readonly connectionSize: number
|
|
74
105
|
readonly onRevoke: (id: string) => void
|
|
106
|
+
readonly onRevokeConnection: (connectionId: string) => void
|
|
75
107
|
readonly isRevoking: boolean
|
|
76
108
|
}): React.JSX.Element {
|
|
77
109
|
const [isConfirming, setIsConfirming] = useState(false)
|
|
110
|
+
const [isConfirmingAll, setIsConfirmingAll] = useState(false)
|
|
78
111
|
const timezone = useTimezone()
|
|
79
112
|
|
|
80
113
|
return (
|
|
@@ -82,10 +115,60 @@ function GrantRow({
|
|
|
82
115
|
<td className="px-4 py-3">
|
|
83
116
|
<div className="font-medium">{grant.clientName}</div>
|
|
84
117
|
<div className="font-mono text-[11px] text-ink-muted">{grant.clientHost}</div>
|
|
118
|
+
{connectionSize > 1 &&
|
|
119
|
+
(isConfirmingAll ? (
|
|
120
|
+
<span className="mt-1 inline-flex items-center gap-3">
|
|
121
|
+
<button
|
|
122
|
+
type="button"
|
|
123
|
+
onClick={() => {
|
|
124
|
+
setIsConfirmingAll(false)
|
|
125
|
+
}}
|
|
126
|
+
className="text-[12px] font-medium text-ink-muted hover:text-ink"
|
|
127
|
+
>
|
|
128
|
+
Cancel
|
|
129
|
+
</button>
|
|
130
|
+
<button
|
|
131
|
+
type="button"
|
|
132
|
+
disabled={isRevoking}
|
|
133
|
+
onClick={() => {
|
|
134
|
+
onRevokeConnection(grant.connectionId)
|
|
135
|
+
}}
|
|
136
|
+
className="text-[12px] font-medium text-danger hover:underline disabled:opacity-50"
|
|
137
|
+
>
|
|
138
|
+
Disconnect all {connectionSize} workspaces
|
|
139
|
+
</button>
|
|
140
|
+
</span>
|
|
141
|
+
) : (
|
|
142
|
+
<button
|
|
143
|
+
type="button"
|
|
144
|
+
onClick={() => {
|
|
145
|
+
setIsConfirmingAll(true)
|
|
146
|
+
}}
|
|
147
|
+
className="mt-1 block text-[12px] font-medium text-danger hover:underline"
|
|
148
|
+
>
|
|
149
|
+
Disconnect all
|
|
150
|
+
</button>
|
|
151
|
+
))}
|
|
85
152
|
</td>
|
|
86
153
|
<td className="px-4 py-3 text-ink-muted">{grant.workspaceName}</td>
|
|
87
154
|
<td className="px-4 py-3 text-ink-muted">
|
|
88
|
-
{grant.scopes
|
|
155
|
+
{grant.scopes
|
|
156
|
+
// A sensitive scope is named by its chip below, under whatever
|
|
157
|
+
// names gave it. "Write all" stays here: it is more than its chip.
|
|
158
|
+
.filter((scope) => !isSensitiveApiKeyScope(scope) || scope === 'write:all')
|
|
159
|
+
.map((scope) => API_KEY_SCOPE_LABELS[scope])
|
|
160
|
+
.join(', ')}
|
|
161
|
+
{grant.extraScopes.length > 0 && (
|
|
162
|
+
// Apart from the list, so a person can see at a glance which
|
|
163
|
+
// connection has a power that is not part of the default access.
|
|
164
|
+
<ul aria-label="Extra permissions" className="mt-1 flex flex-wrap gap-1">
|
|
165
|
+
{grant.extraScopes.map((scope) => (
|
|
166
|
+
<li key={scope}>
|
|
167
|
+
<Chip tone="warning">{API_KEY_SCOPE_LABELS[scope]}</Chip>
|
|
168
|
+
</li>
|
|
169
|
+
))}
|
|
170
|
+
</ul>
|
|
171
|
+
)}
|
|
89
172
|
</td>
|
|
90
173
|
<td className="px-4 py-3 text-ink-muted">{formatDate(grant.createdAt, timezone)}</td>
|
|
91
174
|
<td className="px-4 py-3 text-ink-muted">
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AGENT_RUN_STATUS_LABELS } from '@kelpie/schemas'
|
|
2
|
-
import type { AgentRun
|
|
2
|
+
import type { AgentRun } from '@kelpie/schemas'
|
|
3
3
|
import { useMemo, useState } from 'react'
|
|
4
4
|
import { Link } from 'react-router'
|
|
5
5
|
|
|
@@ -11,127 +11,30 @@ import {
|
|
|
11
11
|
useCreateAgent,
|
|
12
12
|
useDeleteAgent,
|
|
13
13
|
} from '../../api/resources/agentTasks.ts'
|
|
14
|
-
import { useMcpTools } from '../../api/resources/mcpTools.ts'
|
|
15
14
|
import { ErrorPanel, LoadingPanel } from '../../components/QueryState.tsx'
|
|
16
|
-
import { CopyButton } from '../../components/CopyButton.tsx'
|
|
17
15
|
import { formatRelativeTime } from '../../lib/dates.ts'
|
|
18
|
-
import { mcpClientConfig, mcpEndpoint } from '../../lib/mcpConfig.ts'
|
|
19
16
|
|
|
20
17
|
/**
|
|
21
|
-
*
|
|
18
|
+
* The Agents tab on Admin → AI: the bring-your-own agents that Run dispatches
|
|
19
|
+
* to, and the log of those dispatches.
|
|
22
20
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* comes from `/v1/mcp/tools`, which reads the registry the endpoint itself
|
|
27
|
-
* dispatches against: a module that adds a resource shows up here without anyone
|
|
28
|
-
* editing this file.
|
|
29
|
-
*
|
|
30
|
-
* Registered agents and their run log live here too, under the connection
|
|
31
|
-
* details, where the mockup put them: an agent is something you connect, and
|
|
32
|
-
* this is the connections page.
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Matches a tool on its name or its description, so "csv" finds the import and
|
|
37
|
-
* export tools and "pinned" finds the note list that filters on it.
|
|
21
|
+
* Core, so every install has it. It sits under Admin because registering an
|
|
22
|
+
* agent is configuration and the API holds the writes to admins. How a client
|
|
23
|
+
* connects over MCP is not configuration, and is on the AI page at `/ai`.
|
|
38
24
|
*/
|
|
39
|
-
function
|
|
40
|
-
const needle = term.trim().toLowerCase()
|
|
41
|
-
|
|
42
|
-
if (needle.length === 0) {
|
|
43
|
-
return true
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return (
|
|
47
|
-
tool.name.toLowerCase().includes(needle) ||
|
|
48
|
-
tool.description.toLowerCase().includes(needle)
|
|
49
|
-
)
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/** The MCP tab on Admin → AI. Core, so every install has it. */
|
|
53
|
-
export function McpPanel(): React.JSX.Element {
|
|
54
|
-
const endpoint = mcpEndpoint()
|
|
55
|
-
const config = mcpClientConfig(endpoint, 'kp_live_…')
|
|
56
|
-
|
|
25
|
+
export function AgentsPanel(): React.JSX.Element {
|
|
57
26
|
return (
|
|
58
27
|
<div className="space-y-6">
|
|
59
|
-
<section className="rounded-md border border-border p-5">
|
|
60
|
-
<h2 className="text-[15px] font-semibold text-ink">How agents use Kelpie</h2>
|
|
61
|
-
<p className="mt-2 max-w-2xl text-[13px] leading-relaxed text-ink-muted">
|
|
62
|
-
Kelpie is a CRM and a company brain. Every REST operation is also an MCP tool over
|
|
63
|
-
Streamable HTTP, so an agent reads and writes the same records the app does, through the
|
|
64
|
-
same API. Point Claude, Cursor, or any MCP client at this workspace: bring your own agent.
|
|
65
|
-
An install with the AI module can also run tasks on your own OpenAI or Anthropic key.
|
|
66
|
-
</p>
|
|
67
|
-
<ul className="mt-4 space-y-2 text-[13px] text-ink">
|
|
68
|
-
<li className="flex gap-2">
|
|
69
|
-
<span className="text-accent">→</span>
|
|
70
|
-
An API key is bound to one workspace, so a client sees that workspace and no other.
|
|
71
|
-
</li>
|
|
72
|
-
<li className="flex gap-2">
|
|
73
|
-
<span className="text-accent">→</span>
|
|
74
|
-
A tool refuses exactly what the endpoint behind it refuses, with the same message.
|
|
75
|
-
</li>
|
|
76
|
-
<li className="flex gap-2">
|
|
77
|
-
<span className="text-accent">→</span>
|
|
78
|
-
A browser session does not work here. The endpoint takes an API key, or a token from
|
|
79
|
-
OAuth sign-in.
|
|
80
|
-
</li>
|
|
81
|
-
</ul>
|
|
82
|
-
</section>
|
|
83
|
-
|
|
84
|
-
<section className="rounded-md border border-border p-5">
|
|
85
|
-
<div className="flex items-center justify-between gap-3">
|
|
86
|
-
<h2 className="text-[13px] font-semibold text-ink">Streamable HTTP endpoint</h2>
|
|
87
|
-
<CopyButton value={endpoint} label="Copy the endpoint URL" />
|
|
88
|
-
</div>
|
|
89
|
-
<code className="mt-3 block rounded-md border border-border bg-surface px-3 py-2.5 font-mono text-[13px] break-all text-ink">
|
|
90
|
-
{endpoint}
|
|
91
|
-
</code>
|
|
92
|
-
</section>
|
|
93
|
-
|
|
94
|
-
<section className="rounded-md border border-border p-5">
|
|
95
|
-
<h2 className="text-[13px] font-semibold text-ink">Sign in with OAuth</h2>
|
|
96
|
-
<p className="mt-1 max-w-2xl text-[12px] text-ink-muted">
|
|
97
|
-
A client that supports MCP sign-in, such as a Claude.ai connector, needs only the endpoint
|
|
98
|
-
URL above. It opens a Kelpie page where you choose a workspace and approve the access. You
|
|
99
|
-
can disconnect it at any time under{' '}
|
|
100
|
-
<Link to="/account/connected-apps" className="text-accent hover:underline">
|
|
101
|
-
Connected apps
|
|
102
|
-
</Link>
|
|
103
|
-
.
|
|
104
|
-
</p>
|
|
105
|
-
</section>
|
|
106
|
-
|
|
107
|
-
<section className="rounded-md border border-border p-5">
|
|
108
|
-
<div className="flex items-center justify-between gap-3">
|
|
109
|
-
<h2 className="text-[13px] font-semibold text-ink">Claude / Cursor config</h2>
|
|
110
|
-
<CopyButton value={config} label="Copy the client config" />
|
|
111
|
-
</div>
|
|
112
|
-
<p className="mt-1 text-[12px] text-ink-muted">
|
|
113
|
-
Paste into your MCP client config, and replace the bearer token with a workspace key from{' '}
|
|
114
|
-
<Link to="/admin/api-keys" className="text-accent hover:underline">
|
|
115
|
-
API keys
|
|
116
|
-
</Link>
|
|
117
|
-
.
|
|
118
|
-
</p>
|
|
119
|
-
<pre className="bg-code-bg text-code-fg mt-3 overflow-x-auto rounded-md border border-border p-4 font-mono text-[12px] leading-relaxed">
|
|
120
|
-
{config}
|
|
121
|
-
</pre>
|
|
122
|
-
</section>
|
|
123
|
-
|
|
124
28
|
<RegisteredAgents />
|
|
125
29
|
<RecentRuns />
|
|
126
|
-
<ToolCatalog />
|
|
127
30
|
</div>
|
|
128
31
|
)
|
|
129
32
|
}
|
|
130
33
|
|
|
131
34
|
/**
|
|
132
|
-
* Bring-your-own agents that Run dispatches to. Any member
|
|
133
|
-
* the Run dialog on every record page is built from it
|
|
134
|
-
* writes to admins
|
|
35
|
+
* Bring-your-own agents that Run dispatches to. Any member can read this list
|
|
36
|
+
* through the API (the Run dialog on every record page is built from it), and
|
|
37
|
+
* the API holds writes to admins.
|
|
135
38
|
*/
|
|
136
39
|
function RegisteredAgents(): React.JSX.Element {
|
|
137
40
|
const { records, isLoading, error } = useAgents()
|
|
@@ -178,7 +81,7 @@ function RegisteredAgents(): React.JSX.Element {
|
|
|
178
81
|
</div>
|
|
179
82
|
<p className="mt-1 max-w-2xl text-[12px] text-ink-muted">
|
|
180
83
|
Run on any record dispatches the resolved task to one of these endpoints as JSON. The agent
|
|
181
|
-
still reads and writes through the API
|
|
84
|
+
still reads and writes through the public API. The auth header is stored encrypted and never
|
|
182
85
|
shown again.
|
|
183
86
|
</p>
|
|
184
87
|
|
|
@@ -364,63 +267,3 @@ function RecentRuns(): React.JSX.Element {
|
|
|
364
267
|
</section>
|
|
365
268
|
)
|
|
366
269
|
}
|
|
367
|
-
|
|
368
|
-
/**
|
|
369
|
-
* What this deployment actually registered, read from the endpoint's own registry.
|
|
370
|
-
*
|
|
371
|
-
* A flat list rather than a grouped one. Tool names are resource-then-verb, so
|
|
372
|
-
* sorting by name already puts a resource's five together, and every rule for
|
|
373
|
-
* grouping them turned out to be a lexical guess that read `webhooks_rotate_secret`
|
|
374
|
-
* as a resource called `webhooks_rotate`.
|
|
375
|
-
*/
|
|
376
|
-
function ToolCatalog(): React.JSX.Element {
|
|
377
|
-
const { records, isLoading, error } = useMcpTools()
|
|
378
|
-
const [term, setTerm] = useState('')
|
|
379
|
-
const shown = useMemo(
|
|
380
|
-
() => [...records].filter((tool) => matches(tool, term)).sort((left, right) => left.name.localeCompare(right.name)),
|
|
381
|
-
[records, term],
|
|
382
|
-
)
|
|
383
|
-
|
|
384
|
-
return (
|
|
385
|
-
<section className="rounded-md border border-border p-5">
|
|
386
|
-
<div className="flex flex-wrap items-center justify-between gap-3">
|
|
387
|
-
<h2 className="text-[13px] font-semibold text-ink">Tools</h2>
|
|
388
|
-
{records.length > 0 && (
|
|
389
|
-
<input
|
|
390
|
-
type="search"
|
|
391
|
-
value={term}
|
|
392
|
-
onChange={(event) => {
|
|
393
|
-
setTerm(event.target.value)
|
|
394
|
-
}}
|
|
395
|
-
placeholder="Filter tools"
|
|
396
|
-
aria-label="Filter tools"
|
|
397
|
-
className="rounded-md border border-border bg-surface px-2.5 py-1 text-[12px] text-ink outline-none focus:border-border-strong"
|
|
398
|
-
/>
|
|
399
|
-
)}
|
|
400
|
-
</div>
|
|
401
|
-
<p className="mt-1 max-w-2xl text-[12px] text-ink-muted">
|
|
402
|
-
{isLoading
|
|
403
|
-
? 'Reading what this deployment exposes.'
|
|
404
|
-
: `${String(records.length)} tools, mirroring the REST API one for one. Arguments and results are snake_case JSON.`}
|
|
405
|
-
</p>
|
|
406
|
-
|
|
407
|
-
{error !== null && <div className="mt-4">{<ErrorPanel error={error} />}</div>}
|
|
408
|
-
{isLoading && <LoadingPanel label="Loading tools…" />}
|
|
409
|
-
|
|
410
|
-
{records.length > 0 && shown.length === 0 && (
|
|
411
|
-
<p className="mt-4 text-[12px] text-ink-faint">No tool matches “{term}”.</p>
|
|
412
|
-
)}
|
|
413
|
-
|
|
414
|
-
{shown.length > 0 && (
|
|
415
|
-
<ul className="mt-4 divide-y divide-border rounded-md border border-border">
|
|
416
|
-
{shown.map((tool) => (
|
|
417
|
-
<li key={tool.name} className="px-3 py-2.5">
|
|
418
|
-
<code className="font-mono text-[12px] text-accent">{tool.name}</code>
|
|
419
|
-
<p className="mt-0.5 text-[12px] leading-relaxed text-ink-muted">{tool.description}</p>
|
|
420
|
-
</li>
|
|
421
|
-
))}
|
|
422
|
-
</ul>
|
|
423
|
-
)}
|
|
424
|
-
</section>
|
|
425
|
-
)
|
|
426
|
-
}
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import type { ReactNode } from 'react'
|
|
2
|
-
import { useSearchParams } from 'react-router'
|
|
2
|
+
import { Navigate, useSearchParams } from 'react-router'
|
|
3
3
|
|
|
4
4
|
import { PageHeader } from '../../components/PageHeader.tsx'
|
|
5
5
|
import { RecordTabs } from '../../components/RecordTabs.tsx'
|
|
6
6
|
import { useAdminTabs } from '../../registry/context.ts'
|
|
7
7
|
import { inSlotOrder } from '../../registry/registry.ts'
|
|
8
|
-
import {
|
|
8
|
+
import { AgentsPanel } from './AgentsPanel.tsx'
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* Admin → AI at `/admin/ai`:
|
|
11
|
+
* Admin → AI at `/admin/ai`: the AI configuration of this workspace.
|
|
12
12
|
*
|
|
13
|
-
* Core owns the page and its
|
|
13
|
+
* Core owns the page and its Agents tab, so every install has both. The optional
|
|
14
14
|
* `ai` module adds Kelpie AI's Settings and Run log tabs through `adminTab`,
|
|
15
|
-
* ordered before
|
|
15
|
+
* ordered before Agents. Without that module the page is Agents alone.
|
|
16
16
|
*
|
|
17
|
-
* The open tab is `?tab=`, so a link can open one
|
|
18
|
-
*
|
|
17
|
+
* The open tab is `?tab=`, so a link can open one. With no `tab`, or one no
|
|
18
|
+
* module provides, the first tab opens. MCP was a tab here and is now the AI
|
|
19
|
+
* page at `/ai`, which every member can open, so `?tab=mcp` redirects there.
|
|
19
20
|
*/
|
|
20
21
|
|
|
21
22
|
interface PageTab {
|
|
@@ -25,18 +26,22 @@ interface PageTab {
|
|
|
25
26
|
readonly render: () => ReactNode
|
|
26
27
|
}
|
|
27
28
|
|
|
28
|
-
const
|
|
29
|
+
const AGENTS_TAB: PageTab = { id: 'agents', label: 'Agents', order: 300, render: () => <AgentsPanel /> }
|
|
29
30
|
|
|
30
31
|
export function AiAdminPage(): React.JSX.Element {
|
|
31
32
|
const moduleTabs = useAdminTabs('ai')
|
|
32
|
-
const tabs = inSlotOrder<PageTab>([...moduleTabs,
|
|
33
|
+
const tabs = inSlotOrder<PageTab>([...moduleTabs, AGENTS_TAB])
|
|
33
34
|
const [searchParams, setSearchParams] = useSearchParams()
|
|
34
35
|
const requested = searchParams.get('tab')
|
|
35
|
-
const active = tabs.find((tab) => tab.id === requested) ?? tabs[0] ??
|
|
36
|
+
const active = tabs.find((tab) => tab.id === requested) ?? tabs[0] ?? AGENTS_TAB
|
|
37
|
+
|
|
38
|
+
if (requested === 'mcp') {
|
|
39
|
+
return <Navigate to="/ai" replace />
|
|
40
|
+
}
|
|
36
41
|
|
|
37
42
|
return (
|
|
38
43
|
<div className="animate-slide-in mx-auto max-w-4xl space-y-6">
|
|
39
|
-
<PageHeader title="AI" description="
|
|
44
|
+
<PageHeader title="AI" description="Register agents, and configure how agent tasks run." />
|
|
40
45
|
<RecordTabs
|
|
41
46
|
tabs={tabs.map((tab) => ({ id: tab.id, label: tab.label }))}
|
|
42
47
|
active={active.id}
|
|
@@ -16,7 +16,7 @@ import { targetHref } from '../../lib/recordLinks.ts'
|
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* The optional `ai` module's two tabs on Admin → AI, the core page at
|
|
19
|
-
* `/admin/ai` (`AiAdminPage`), beside core's
|
|
19
|
+
* `/admin/ai` (`AiAdminPage`), beside core's Agents tab.
|
|
20
20
|
*
|
|
21
21
|
* Settings for Kelpie AI in this workspace, and its run log. Both read the
|
|
22
22
|
* same `/v1/ai/*` endpoints an agent would use.
|