@kelpie/ui 0.16.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/client.d.ts +1 -1
- package/dist/api/resources/ai.d.ts +21 -0
- package/dist/api/resources/ai.d.ts.map +1 -0
- package/dist/api/resources/ai.js +101 -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/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/api/resources/session.d.ts.map +1 -1
- package/dist/api/resources/session.js +3 -1
- 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.js +2 -2
- 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/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/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/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/Shell.js.map +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/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/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 +14 -0
- package/dist/modules/ai.d.ts.map +1 -0
- package/dist/modules/ai.js +26 -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 +68 -0
- package/dist/modules/aiRunner.js.map +1 -0
- 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/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/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/FormsPage.js +4 -4
- package/dist/pages/FormsPage.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/PeoplePage.d.ts.map +1 -1
- package/dist/pages/PeoplePage.js +7 -1
- package/dist/pages/PeoplePage.js.map +1 -1
- package/dist/pages/PersonDetail.d.ts.map +1 -1
- package/dist/pages/PersonDetail.js +2 -1
- 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/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 +5 -0
- package/dist/pages/admin/AiPage.d.ts.map +1 -0
- package/dist/pages/admin/AiPage.js +196 -0
- package/dist/pages/admin/AiPage.js.map +1 -0
- package/dist/pages/admin/McpPage.js +2 -2
- package/dist/pages/admin/McpPage.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/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/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/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/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/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/onboardingRerun.d.ts +9 -0
- package/dist/pages/onboarding/onboardingRerun.d.ts.map +1 -1
- package/dist/pages/onboarding/onboardingRerun.js +11 -0
- package/dist/pages/onboarding/onboardingRerun.js.map +1 -1
- package/dist/registry/context.d.ts +7 -1
- package/dist/registry/context.d.ts.map +1 -1
- package/dist/registry/context.js +12 -0
- package/dist/registry/context.js.map +1 -1
- package/dist/registry/contributions.d.ts +70 -1
- package/dist/registry/contributions.d.ts.map +1 -1
- package/dist/registry/registry.d.ts +12 -1
- package/dist/registry/registry.d.ts.map +1 -1
- package/dist/registry/registry.js +21 -0
- package/dist/registry/registry.js.map +1 -1
- package/package.json +2 -2
- package/src/api/client.ts +1 -1
- package/src/api/resources/ai.ts +120 -0
- package/src/api/resources/conversions.ts +1 -1
- package/src/api/resources/forms.ts +56 -0
- package/src/api/resources/personIntake.ts +95 -0
- package/src/api/resources/session.ts +3 -1
- package/src/api/resources/workspace.ts +4 -4
- package/src/app/KelpieApp.tsx +4 -2
- package/src/components/ActivitiesPanel.tsx +39 -10
- package/src/components/ActivityAction.tsx +33 -0
- package/src/components/AgentTasks.tsx +138 -10
- 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/PersonIntakeDialog.tsx +226 -0
- package/src/components/PlanPanel.tsx +9 -1
- package/src/components/RecordLinkTextarea.tsx +257 -0
- package/src/components/Shell.tsx +1 -1
- package/src/components/WorkspaceSwitcher.tsx +15 -1
- package/src/index.ts +16 -0
- package/src/lib/fragmentTarget.ts +96 -0
- package/src/lib/recordLinks.ts +57 -0
- package/src/lib/recordReferences.ts +139 -0
- package/src/modules/PersonIntakeWizard.tsx +633 -0
- package/src/modules/ai.tsx +27 -0
- package/src/modules/aiRunner.ts +83 -0
- package/src/modules/personIntakeSelection.ts +24 -0
- package/src/pages/CompanyDetail.tsx +2 -1
- package/src/pages/DealDetail.tsx +2 -1
- package/src/pages/EnquiryDetail.tsx +2 -1
- package/src/pages/EventDetail.tsx +2 -1
- package/src/pages/FormsPage.tsx +4 -4
- package/src/pages/OpportunityDetail.tsx +2 -1
- package/src/pages/PartnershipDetail.tsx +2 -1
- package/src/pages/PeoplePage.tsx +21 -5
- package/src/pages/PersonDetail.tsx +2 -1
- package/src/pages/RaiseDetail.tsx +2 -1
- package/src/pages/SearchPage.tsx +30 -15
- package/src/pages/admin/AiAdminPage.tsx +52 -0
- package/src/pages/admin/AiPage.tsx +457 -0
- package/src/pages/admin/{McpPage.tsx → McpPanel.tsx} +15 -11
- package/src/pages/admin/PrivacyPage.tsx +42 -0
- package/src/pages/admin/WorkspaceSettingsPage.tsx +13 -28
- package/src/pages/dashboard/attention.ts +1 -24
- package/src/pages/dashboard/sections.tsx +9 -4
- 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/pages/handbook/HandbookPage.tsx +5 -6
- package/src/pages/onboarding/WorkspaceStepPage.tsx +19 -43
- package/src/pages/onboarding/onboardingRerun.ts +14 -0
- package/src/registry/context.ts +19 -0
- package/src/registry/contributions.ts +64 -1
- package/src/registry/registry.ts +48 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { AI_SERVICE_LABELS } from '@kelpie/schemas'
|
|
2
|
+
|
|
3
|
+
import { ApiError } from '../api/client.ts'
|
|
4
|
+
import { useAiRunForAgentRun, useAiSettings } from '../api/resources/ai.ts'
|
|
5
|
+
import { useAgents } from '../api/resources/agentTasks.ts'
|
|
6
|
+
import type { AgentRunner, AgentRunnerAvailability, AgentRunnerProgress } from '../registry/contributions.ts'
|
|
7
|
+
|
|
8
|
+
/** The `managed_by` value the server module writes on its agent row. */
|
|
9
|
+
const AI_MODULE_ID = 'ai'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Kelpie AI as the Agent menu's runner.
|
|
13
|
+
*
|
|
14
|
+
* Ready only when the workspace can run a task now: the module answers (so it
|
|
15
|
+
* is in the assembly and switched on), AI is enabled, a provider and key are
|
|
16
|
+
* available (the workspace's own, or the deployment's), and the agent row the
|
|
17
|
+
* module manages exists to dispatch to.
|
|
18
|
+
*/
|
|
19
|
+
function useAvailability(options: { readonly enabled: boolean }): AgentRunnerAvailability {
|
|
20
|
+
const settings = useAiSettings({ enabled: options.enabled })
|
|
21
|
+
const agents = useAgents({ enabled: options.enabled })
|
|
22
|
+
|
|
23
|
+
if (settings.isLoading || agents.isLoading || !options.enabled) {
|
|
24
|
+
return { status: 'loading' }
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (settings.error !== null) {
|
|
28
|
+
// The runtime answers 403 or 404 when the module is switched off.
|
|
29
|
+
return settings.error instanceof ApiError && (settings.error.status === 403 || settings.error.status === 404)
|
|
30
|
+
? { status: 'unavailable', reason: 'AI is switched off for this workspace.' }
|
|
31
|
+
: { status: 'unavailable', reason: 'AI settings could not be read.' }
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const record = settings.record
|
|
35
|
+
const label = record === undefined ? 'AI' : AI_SERVICE_LABELS[record.service]
|
|
36
|
+
|
|
37
|
+
if (record === undefined || !record.enabled) {
|
|
38
|
+
return { status: 'unavailable', reason: `${label} is not enabled. An admin can enable it under Admin → AI.` }
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (!record.configured) {
|
|
42
|
+
return {
|
|
43
|
+
status: 'unavailable',
|
|
44
|
+
reason: `${label} has no provider key. An admin can add one under Admin → AI.`,
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const agent = agents.records.find((candidate) => candidate.managedBy === AI_MODULE_ID)
|
|
49
|
+
|
|
50
|
+
if (agent === undefined) {
|
|
51
|
+
return {
|
|
52
|
+
status: 'unavailable',
|
|
53
|
+
reason: `The ${label} agent is missing. An admin can save Admin → AI again to restore it.`,
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return { status: 'ready', agentId: agent.id }
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function useProgress(agentRunId: string | undefined): AgentRunnerProgress | undefined {
|
|
61
|
+
const run = useAiRunForAgentRun(agentRunId)
|
|
62
|
+
|
|
63
|
+
if (agentRunId === undefined) {
|
|
64
|
+
return undefined
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
switch (run?.status) {
|
|
68
|
+
case 'succeeded':
|
|
69
|
+
return { status: 'succeeded' }
|
|
70
|
+
case 'failed':
|
|
71
|
+
return { status: 'failed', reason: run.failureReason ?? 'no reason recorded' }
|
|
72
|
+
case 'queued':
|
|
73
|
+
case 'running':
|
|
74
|
+
case undefined:
|
|
75
|
+
return { status: 'running' }
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export const aiRunner: AgentRunner = {
|
|
80
|
+
id: AI_MODULE_ID,
|
|
81
|
+
useAvailability,
|
|
82
|
+
useProgress,
|
|
83
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { personIntakeDependencies } from '@kelpie/schemas'
|
|
2
|
+
import type { PersonIntakeItem } from '@kelpie/schemas'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The items that can be written given what is ticked: an item whose
|
|
6
|
+
* dependency is unticked, or cannot be written, drops out too.
|
|
7
|
+
*/
|
|
8
|
+
export function effectiveSelection(items: readonly PersonIntakeItem[], ticked: ReadonlySet<string>): ReadonlySet<string> {
|
|
9
|
+
const keys = new Set(items.map((item) => item.key))
|
|
10
|
+
const effective = new Set([...ticked].filter((key) => keys.has(key)))
|
|
11
|
+
let changed = true
|
|
12
|
+
|
|
13
|
+
while (changed) {
|
|
14
|
+
changed = false
|
|
15
|
+
for (const item of items) {
|
|
16
|
+
if (effective.has(item.key) && personIntakeDependencies(item).some((key) => !effective.has(key))) {
|
|
17
|
+
effective.delete(item.key)
|
|
18
|
+
changed = true
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return effective
|
|
24
|
+
}
|
|
@@ -56,6 +56,7 @@ import { SidebarField } from '../components/SidebarField.tsx'
|
|
|
56
56
|
import { SummaryBlock } from '../components/SummaryBlock.tsx'
|
|
57
57
|
import { useRecordTabs } from '../registry/context.ts'
|
|
58
58
|
import { inSlotOrder } from '../registry/registry.ts'
|
|
59
|
+
import { useRecordTab } from '../lib/fragmentTarget.ts'
|
|
59
60
|
import { toOptions, toTags } from './fields.ts'
|
|
60
61
|
|
|
61
62
|
/**
|
|
@@ -87,7 +88,7 @@ export function CompanyDetail(): React.JSX.Element {
|
|
|
87
88
|
const moduleTabs = inSlotOrder(useRecordTabs('company'))
|
|
88
89
|
const hasCustomFields = useHasCustomFields('company')
|
|
89
90
|
const eventsEnabled = useModuleEnabled('events')
|
|
90
|
-
const [activeTab, setActiveTab] =
|
|
91
|
+
const [activeTab, setActiveTab] = useRecordTab()
|
|
91
92
|
const formSubmissions = useFormSubmissionsForRecord('company', id)
|
|
92
93
|
|
|
93
94
|
if (isNotFound) {
|
package/src/pages/DealDetail.tsx
CHANGED
|
@@ -42,6 +42,7 @@ import { SidebarField } from '../components/SidebarField.tsx'
|
|
|
42
42
|
import { SummaryBlock } from '../components/SummaryBlock.tsx'
|
|
43
43
|
import { formatDay } from '../lib/dates.ts'
|
|
44
44
|
import { formatMoney } from '../lib/money.ts'
|
|
45
|
+
import { useRecordTab } from '../lib/fragmentTarget.ts'
|
|
45
46
|
import { useRecordTabs } from '../registry/context.ts'
|
|
46
47
|
import { inSlotOrder } from '../registry/registry.ts'
|
|
47
48
|
import { toTags } from './fields.ts'
|
|
@@ -68,7 +69,7 @@ export function DealDetail(): React.JSX.Element {
|
|
|
68
69
|
const moduleTabs = inSlotOrder(useRecordTabs('deal'))
|
|
69
70
|
const hasCustomFields = useHasCustomFields('deal')
|
|
70
71
|
const eventsEnabled = useModuleEnabled('events')
|
|
71
|
-
const [activeTab, setActiveTab] =
|
|
72
|
+
const [activeTab, setActiveTab] = useRecordTab()
|
|
72
73
|
const [showConvert, setShowConvert] = useState(false)
|
|
73
74
|
const formSubmissions = useFormSubmissionsForRecord('deal', id)
|
|
74
75
|
|
|
@@ -46,6 +46,7 @@ import { SidebarField } from '../components/SidebarField.tsx'
|
|
|
46
46
|
import { SummaryBlock } from '../components/SummaryBlock.tsx'
|
|
47
47
|
import { useRecordTabs } from '../registry/context.ts'
|
|
48
48
|
import { inSlotOrder } from '../registry/registry.ts'
|
|
49
|
+
import { useRecordTab } from '../lib/fragmentTarget.ts'
|
|
49
50
|
import { toTags } from './fields.ts'
|
|
50
51
|
|
|
51
52
|
/**
|
|
@@ -71,7 +72,7 @@ export function EnquiryDetail(): React.JSX.Element {
|
|
|
71
72
|
const moduleTabs = inSlotOrder(useRecordTabs('enquiry'))
|
|
72
73
|
const hasCustomFields = useHasCustomFields('enquiry')
|
|
73
74
|
const eventsEnabled = useModuleEnabled('events')
|
|
74
|
-
const [activeTab, setActiveTab] =
|
|
75
|
+
const [activeTab, setActiveTab] = useRecordTab()
|
|
75
76
|
const [showConvert, setShowConvert] = useState(false)
|
|
76
77
|
const formSubmissions = useFormSubmissionsForRecord('enquiry', id)
|
|
77
78
|
|
|
@@ -64,6 +64,7 @@ import { SidebarField } from '../components/SidebarField.tsx'
|
|
|
64
64
|
import { SummaryBlock } from '../components/SummaryBlock.tsx'
|
|
65
65
|
import { TimezoneSearch } from '../components/TimezoneSearch.tsx'
|
|
66
66
|
import { formatDateTime } from '../lib/dates.ts'
|
|
67
|
+
import { useRecordTab } from '../lib/fragmentTarget.ts'
|
|
67
68
|
import { useRecordTabs } from '../registry/context.ts'
|
|
68
69
|
import { inSlotOrder } from '../registry/registry.ts'
|
|
69
70
|
import { toTags } from './fields.ts'
|
|
@@ -106,7 +107,7 @@ export function EventDetail(): React.JSX.Element {
|
|
|
106
107
|
const deleteEvent = useDeleteEvent()
|
|
107
108
|
const moduleTabs = inSlotOrder(useRecordTabs('event'))
|
|
108
109
|
const hasCustomFields = useHasCustomFields('event')
|
|
109
|
-
const [activeTab, setActiveTab] =
|
|
110
|
+
const [activeTab, setActiveTab] = useRecordTab()
|
|
110
111
|
|
|
111
112
|
if (isNotFound) {
|
|
112
113
|
return <NotFoundPanel label="Event" backTo="/events" />
|
package/src/pages/FormsPage.tsx
CHANGED
|
@@ -136,11 +136,11 @@ export function FormsPage(): React.JSX.Element {
|
|
|
136
136
|
),
|
|
137
137
|
},
|
|
138
138
|
{
|
|
139
|
-
key: '
|
|
140
|
-
header: '
|
|
141
|
-
getSortValue: (form) => form.
|
|
139
|
+
key: 'slug',
|
|
140
|
+
header: 'Slug',
|
|
141
|
+
getSortValue: (form) => form.slug,
|
|
142
142
|
render: (form) => (
|
|
143
|
-
<span className="font-mono text-[12px] text-ink-muted">{form.
|
|
143
|
+
<span className="font-mono text-[12px] text-ink-muted">{form.slug}</span>
|
|
144
144
|
),
|
|
145
145
|
},
|
|
146
146
|
{
|
|
@@ -45,6 +45,7 @@ import { SectionHeader } from '../components/SectionHeader.tsx'
|
|
|
45
45
|
import { SidebarField } from '../components/SidebarField.tsx'
|
|
46
46
|
import { SummaryBlock } from '../components/SummaryBlock.tsx'
|
|
47
47
|
import { formatDay } from '../lib/dates.ts'
|
|
48
|
+
import { useRecordTab } from '../lib/fragmentTarget.ts'
|
|
48
49
|
import { useRecordTabs } from '../registry/context.ts'
|
|
49
50
|
import { inSlotOrder } from '../registry/registry.ts'
|
|
50
51
|
import { toTags } from './fields.ts'
|
|
@@ -73,7 +74,7 @@ export function OpportunityDetail(): React.JSX.Element {
|
|
|
73
74
|
const moduleTabs = inSlotOrder(useRecordTabs('opportunity'))
|
|
74
75
|
const hasCustomFields = useHasCustomFields('opportunity')
|
|
75
76
|
const eventsEnabled = useModuleEnabled('events')
|
|
76
|
-
const [activeTab, setActiveTab] =
|
|
77
|
+
const [activeTab, setActiveTab] = useRecordTab()
|
|
77
78
|
const [showConvert, setShowConvert] = useState(false)
|
|
78
79
|
const formSubmissions = useFormSubmissionsForRecord('opportunity', id)
|
|
79
80
|
|
|
@@ -45,6 +45,7 @@ import { SectionHeader } from '../components/SectionHeader.tsx'
|
|
|
45
45
|
import { SidebarField } from '../components/SidebarField.tsx'
|
|
46
46
|
import { SummaryBlock } from '../components/SummaryBlock.tsx'
|
|
47
47
|
import { formatDay } from '../lib/dates.ts'
|
|
48
|
+
import { useRecordTab } from '../lib/fragmentTarget.ts'
|
|
48
49
|
import { useRecordTabs } from '../registry/context.ts'
|
|
49
50
|
import { inSlotOrder } from '../registry/registry.ts'
|
|
50
51
|
import { toTags } from './fields.ts'
|
|
@@ -73,7 +74,7 @@ export function PartnershipDetail(): React.JSX.Element {
|
|
|
73
74
|
const moduleTabs = inSlotOrder(useRecordTabs('partnership'))
|
|
74
75
|
const hasCustomFields = useHasCustomFields('partnership')
|
|
75
76
|
const eventsEnabled = useModuleEnabled('events')
|
|
76
|
-
const [activeTab, setActiveTab] =
|
|
77
|
+
const [activeTab, setActiveTab] = useRecordTab()
|
|
77
78
|
const [showConvert, setShowConvert] = useState(false)
|
|
78
79
|
const formSubmissions = useFormSubmissionsForRecord('partnership', id)
|
|
79
80
|
|
package/src/pages/PeoplePage.tsx
CHANGED
|
@@ -9,6 +9,7 @@ import { Chip } from '../components/Chip.tsx'
|
|
|
9
9
|
import { SocialNetworkIcon } from '../components/SocialNetworkIcon.tsx'
|
|
10
10
|
import { ColumnPicker } from '../components/ColumnPicker.tsx'
|
|
11
11
|
import { DataTable } from '../components/DataTable.tsx'
|
|
12
|
+
import { AddFromNotesButton, PersonIntakeDialog } from '../components/PersonIntakeDialog.tsx'
|
|
12
13
|
import type { Column } from '../components/DataTable.tsx'
|
|
13
14
|
import { FilterBar, PageHeader } from '../components/PageHeader.tsx'
|
|
14
15
|
import { Paginator } from '../components/Paginator.tsx'
|
|
@@ -59,6 +60,7 @@ export function PeoplePage(): React.JSX.Element {
|
|
|
59
60
|
})
|
|
60
61
|
const directory = usePeopleDirectory(people.records.map((person) => person.id))
|
|
61
62
|
const createPerson = useCreatePerson()
|
|
63
|
+
const [intakeOpen, setIntakeOpen] = useState(false)
|
|
62
64
|
|
|
63
65
|
async function addPerson(): Promise<void> {
|
|
64
66
|
// The same defaults the API applies, so a person created here and one
|
|
@@ -242,13 +244,27 @@ export function PeoplePage(): React.JSX.Element {
|
|
|
242
244
|
}}
|
|
243
245
|
addLabel="Add person"
|
|
244
246
|
actions={
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
247
|
+
<>
|
|
248
|
+
<ColumnPicker
|
|
249
|
+
options={pickerOptions}
|
|
250
|
+
visibleKeys={listView.visibleKeys}
|
|
251
|
+
onChange={listView.setVisibleKeys}
|
|
252
|
+
/>
|
|
253
|
+
<AddFromNotesButton
|
|
254
|
+
onClick={() => {
|
|
255
|
+
setIntakeOpen(true)
|
|
256
|
+
}}
|
|
257
|
+
/>
|
|
258
|
+
</>
|
|
250
259
|
}
|
|
251
260
|
/>
|
|
261
|
+
{intakeOpen && (
|
|
262
|
+
<PersonIntakeDialog
|
|
263
|
+
onClose={() => {
|
|
264
|
+
setIntakeOpen(false)
|
|
265
|
+
}}
|
|
266
|
+
/>
|
|
267
|
+
)}
|
|
252
268
|
<FilterBar
|
|
253
269
|
value={term}
|
|
254
270
|
onChange={setTerm}
|
|
@@ -55,6 +55,7 @@ import { PhonesField } from '../components/PhonesField.tsx'
|
|
|
55
55
|
import { SummaryBlock } from '../components/SummaryBlock.tsx'
|
|
56
56
|
import { useRecordTabs } from '../registry/context.ts'
|
|
57
57
|
import { inSlotOrder } from '../registry/registry.ts'
|
|
58
|
+
import { useRecordTab } from '../lib/fragmentTarget.ts'
|
|
58
59
|
import {
|
|
59
60
|
CandidateReferrerField,
|
|
60
61
|
CandidateStageField,
|
|
@@ -91,7 +92,7 @@ export function PersonDetail(): React.JSX.Element {
|
|
|
91
92
|
const moduleTabs = inSlotOrder(useRecordTabs('person'))
|
|
92
93
|
const hasCustomFields = useHasCustomFields('person')
|
|
93
94
|
const eventsEnabled = useModuleEnabled('events')
|
|
94
|
-
const [activeTab, setActiveTab] =
|
|
95
|
+
const [activeTab, setActiveTab] = useRecordTab()
|
|
95
96
|
const candidacies = useCandidates({ personIds: id === undefined ? [] : [id] }, {
|
|
96
97
|
enabled: id !== undefined,
|
|
97
98
|
})
|
|
@@ -40,6 +40,7 @@ import { SidebarField } from '../components/SidebarField.tsx'
|
|
|
40
40
|
import { SummaryBlock } from '../components/SummaryBlock.tsx'
|
|
41
41
|
import { formatDay } from '../lib/dates.ts'
|
|
42
42
|
import { formatMoney } from '../lib/money.ts'
|
|
43
|
+
import { useRecordTab } from '../lib/fragmentTarget.ts'
|
|
43
44
|
import { useRecordTabs } from '../registry/context.ts'
|
|
44
45
|
import { inSlotOrder } from '../registry/registry.ts'
|
|
45
46
|
import { toTags } from './fields.ts'
|
|
@@ -72,7 +73,7 @@ export function RaiseDetail(): React.JSX.Element {
|
|
|
72
73
|
const moduleTabs = inSlotOrder(useRecordTabs('raise'))
|
|
73
74
|
const hasCustomFields = useHasCustomFields('raise')
|
|
74
75
|
const eventsEnabled = useModuleEnabled('events')
|
|
75
|
-
const [activeTab, setActiveTab] =
|
|
76
|
+
const [activeTab, setActiveTab] = useRecordTab()
|
|
76
77
|
const [showConvert, setShowConvert] = useState(false)
|
|
77
78
|
|
|
78
79
|
if (isNotFound) {
|
package/src/pages/SearchPage.tsx
CHANGED
|
@@ -4,6 +4,7 @@ import { Link, useSearchParams } from 'react-router'
|
|
|
4
4
|
import { useSearch } from '../api/resources/search.ts'
|
|
5
5
|
import { ErrorPanel, LoadingPanel } from '../components/QueryState.tsx'
|
|
6
6
|
import { PageHeader } from '../components/PageHeader.tsx'
|
|
7
|
+
import { attachedHref } from '../lib/recordLinks.ts'
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* `/search?q=`, the destination of the box in the application shell.
|
|
@@ -13,21 +14,35 @@ import { PageHeader } from '../components/PageHeader.tsx'
|
|
|
13
14
|
* renderer, and the only thing it still owns is where a result links to.
|
|
14
15
|
*/
|
|
15
16
|
|
|
17
|
+
/**
|
|
18
|
+
* Where a Decision, Note or Plan item result opens: the page of the record it is
|
|
19
|
+
* on, at the item. With no record to open, the fallback.
|
|
20
|
+
*/
|
|
21
|
+
function onItsRecord(fallback: string): (item: SearchResult) => string {
|
|
22
|
+
return (item) => (item.target === null ? fallback : (attachedHref(item.id, item.target) ?? fallback))
|
|
23
|
+
}
|
|
24
|
+
|
|
16
25
|
/** What each collection is called on screen, and where one of its results lives. */
|
|
17
|
-
const COLLECTIONS: Readonly<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
const COLLECTIONS: Readonly<
|
|
27
|
+
Record<SearchCollection, { label: string; path: (item: SearchResult) => string }>
|
|
28
|
+
> = {
|
|
29
|
+
handbook_page: { label: 'Handbook', path: (item) => `/handbook/${item.id}` },
|
|
30
|
+
person: { label: 'People', path: (item) => `/people/${item.id}` },
|
|
31
|
+
role: { label: 'Roles', path: (item) => `/hiring/${item.id}` },
|
|
32
|
+
company: { label: 'Companies', path: (item) => `/companies/${item.id}` },
|
|
33
|
+
enquiry: { label: 'Enquiries', path: (item) => `/enquiries/${item.id}` },
|
|
34
|
+
deal: { label: 'Deals', path: (item) => `/deals/${item.id}` },
|
|
35
|
+
opportunity: { label: 'Opportunities', path: (item) => `/opportunities/${item.id}` },
|
|
36
|
+
raise: { label: 'Fundraising', path: (item) => `/fundraising/${item.id}` },
|
|
37
|
+
partnership: { label: 'Partnerships', path: (item) => `/partnerships/${item.id}` },
|
|
38
|
+
event: { label: 'Events', path: (item) => `/events/${item.id}` },
|
|
39
|
+
// Decisions, Notes and Plan items have no page of their own. Each opens on the
|
|
40
|
+
// record it is on; the global list is where a decision with none is read.
|
|
41
|
+
decision: { label: 'Decisions', path: onItsRecord('/decisions') },
|
|
42
|
+
note: { label: 'Notes', path: onItsRecord('/dashboard') },
|
|
43
|
+
plan_item: { label: 'Plan items', path: onItsRecord('/planning') },
|
|
44
|
+
list: { label: 'Lists', path: (item) => `/lists/${item.id}` },
|
|
45
|
+
form: { label: 'Forms', path: (item) => `/forms/${item.id}` },
|
|
31
46
|
}
|
|
32
47
|
|
|
33
48
|
export function SearchPage(): React.JSX.Element {
|
|
@@ -120,7 +135,7 @@ function ResultRow({
|
|
|
120
135
|
}): React.JSX.Element {
|
|
121
136
|
return (
|
|
122
137
|
<Link
|
|
123
|
-
to={COLLECTIONS[collection].path(item
|
|
138
|
+
to={COLLECTIONS[collection].path(item)}
|
|
124
139
|
className="block px-4 py-2.5 transition hover:bg-accent-soft/30"
|
|
125
140
|
>
|
|
126
141
|
<div className="flex items-center justify-between gap-3">
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ReactNode } from 'react'
|
|
2
|
+
import { useSearchParams } from 'react-router'
|
|
3
|
+
|
|
4
|
+
import { PageHeader } from '../../components/PageHeader.tsx'
|
|
5
|
+
import { RecordTabs } from '../../components/RecordTabs.tsx'
|
|
6
|
+
import { useAdminTabs } from '../../registry/context.ts'
|
|
7
|
+
import { inSlotOrder } from '../../registry/registry.ts'
|
|
8
|
+
import { McpPanel } from './McpPanel.tsx'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Admin → AI at `/admin/ai`: how agents reach this workspace.
|
|
12
|
+
*
|
|
13
|
+
* Core owns the page and its MCP tab, so every install has both. The optional
|
|
14
|
+
* `ai` module adds Kelpie AI's Settings and Run log tabs through `adminTab`,
|
|
15
|
+
* ordered before MCP. Without that module the page is MCP alone.
|
|
16
|
+
*
|
|
17
|
+
* The open tab is `?tab=`, so a link can open one; `/admin/mcp` redirects to
|
|
18
|
+
* `?tab=mcp`. With no `tab`, or one no module provides, the first tab opens.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
interface PageTab {
|
|
22
|
+
readonly id: string
|
|
23
|
+
readonly label: string
|
|
24
|
+
readonly order?: number
|
|
25
|
+
readonly render: () => ReactNode
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const MCP_TAB: PageTab = { id: 'mcp', label: 'MCP', order: 300, render: () => <McpPanel /> }
|
|
29
|
+
|
|
30
|
+
export function AiAdminPage(): React.JSX.Element {
|
|
31
|
+
const moduleTabs = useAdminTabs('ai')
|
|
32
|
+
const tabs = inSlotOrder<PageTab>([...moduleTabs, MCP_TAB])
|
|
33
|
+
const [searchParams, setSearchParams] = useSearchParams()
|
|
34
|
+
const requested = searchParams.get('tab')
|
|
35
|
+
const active = tabs.find((tab) => tab.id === requested) ?? tabs[0] ?? MCP_TAB
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<div className="animate-slide-in mx-auto max-w-4xl space-y-6">
|
|
39
|
+
<PageHeader title="AI" description="Connect agents to this workspace, and run agent tasks." />
|
|
40
|
+
<RecordTabs
|
|
41
|
+
tabs={tabs.map((tab) => ({ id: tab.id, label: tab.label }))}
|
|
42
|
+
active={active.id}
|
|
43
|
+
onChange={(id) => {
|
|
44
|
+
setSearchParams({ tab: id }, { replace: true })
|
|
45
|
+
}}
|
|
46
|
+
ariaLabel="AI sections"
|
|
47
|
+
>
|
|
48
|
+
{active.render()}
|
|
49
|
+
</RecordTabs>
|
|
50
|
+
</div>
|
|
51
|
+
)
|
|
52
|
+
}
|