@kelpie/ui 0.15.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/client.d.ts +6 -5
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +2 -2
- package/dist/api/client.js.map +1 -1
- package/dist/api/resource.d.ts +4 -4
- package/dist/api/resource.d.ts.map +1 -1
- package/dist/api/resource.js +4 -5
- package/dist/api/resource.js.map +1 -1
- package/dist/api/resources/ai.d.ts +16 -0
- package/dist/api/resources/ai.d.ts.map +1 -0
- package/dist/api/resources/ai.js +93 -0
- package/dist/api/resources/ai.js.map +1 -0
- package/dist/api/resources/conversions.js +1 -1
- package/dist/api/resources/conversions.js.map +1 -1
- package/dist/api/resources/members.d.ts +2 -2
- package/dist/api/resources/oauth.d.ts +21 -0
- package/dist/api/resources/oauth.d.ts.map +1 -0
- package/dist/api/resources/oauth.js +74 -0
- package/dist/api/resources/oauth.js.map +1 -0
- package/dist/api/resources/planItems.d.ts +1 -1
- package/dist/api/resources/planItems.d.ts.map +1 -1
- package/dist/api/resources/planItems.js +1 -1
- package/dist/api/resources/planItems.js.map +1 -1
- package/dist/api/resources/session.d.ts +1 -1
- package/dist/api/resources/session.d.ts.map +1 -1
- package/dist/api/resources/session.js +4 -2
- package/dist/api/resources/session.js.map +1 -1
- package/dist/api/resources/workspace.d.ts +2 -2
- package/dist/api/resources/workspace.js +2 -2
- package/dist/app/KelpieApp.d.ts.map +1 -1
- package/dist/app/KelpieApp.js +3 -1
- package/dist/app/KelpieApp.js.map +1 -1
- package/dist/components/ActivitiesPanel.d.ts +7 -4
- package/dist/components/ActivitiesPanel.d.ts.map +1 -1
- package/dist/components/ActivitiesPanel.js +12 -2
- package/dist/components/ActivitiesPanel.js.map +1 -1
- package/dist/components/ActivityAction.d.ts +15 -0
- package/dist/components/ActivityAction.d.ts.map +1 -0
- package/dist/components/ActivityAction.js +20 -0
- package/dist/components/ActivityAction.js.map +1 -0
- package/dist/components/AgentTasks.d.ts +5 -0
- package/dist/components/AgentTasks.d.ts.map +1 -1
- package/dist/components/AgentTasks.js +88 -10
- package/dist/components/AgentTasks.js.map +1 -1
- package/dist/components/ApiKeysPanel.d.ts.map +1 -1
- package/dist/components/ApiKeysPanel.js +4 -1
- package/dist/components/ApiKeysPanel.js.map +1 -1
- package/dist/components/DecisionsPanel.d.ts.map +1 -1
- package/dist/components/DecisionsPanel.js +3 -1
- package/dist/components/DecisionsPanel.js.map +1 -1
- package/dist/components/LinkedText.d.ts +12 -0
- package/dist/components/LinkedText.d.ts.map +1 -0
- package/dist/components/LinkedText.js +25 -0
- package/dist/components/LinkedText.js.map +1 -0
- package/dist/components/MarkdownView.d.ts +3 -1
- package/dist/components/MarkdownView.d.ts.map +1 -1
- package/dist/components/MarkdownView.js +17 -3
- package/dist/components/MarkdownView.js.map +1 -1
- package/dist/components/NotesPanel.d.ts +2 -1
- package/dist/components/NotesPanel.d.ts.map +1 -1
- package/dist/components/NotesPanel.js +6 -7
- package/dist/components/NotesPanel.js.map +1 -1
- package/dist/components/Paginator.d.ts +1 -1
- package/dist/components/PlanPanel.d.ts.map +1 -1
- package/dist/components/PlanPanel.js +3 -1
- package/dist/components/PlanPanel.js.map +1 -1
- package/dist/components/RecordLinkTextarea.d.ts +12 -0
- package/dist/components/RecordLinkTextarea.d.ts.map +1 -0
- package/dist/components/RecordLinkTextarea.js +142 -0
- package/dist/components/RecordLinkTextarea.js.map +1 -0
- package/dist/components/Shell.js +1 -1
- package/dist/components/SummaryBlock.d.ts +1 -1
- package/dist/components/SummaryBlock.js +1 -1
- package/dist/components/WorkspaceSwitcher.d.ts +2 -1
- package/dist/components/WorkspaceSwitcher.d.ts.map +1 -1
- package/dist/components/WorkspaceSwitcher.js +7 -2
- package/dist/components/WorkspaceSwitcher.js.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/fragmentTarget.d.ts +18 -0
- package/dist/lib/fragmentTarget.d.ts.map +1 -0
- package/dist/lib/fragmentTarget.js +73 -0
- package/dist/lib/fragmentTarget.js.map +1 -0
- package/dist/lib/mcpConfig.d.ts +10 -0
- package/dist/lib/mcpConfig.d.ts.map +1 -0
- package/dist/lib/mcpConfig.js +23 -0
- package/dist/lib/mcpConfig.js.map +1 -0
- package/dist/lib/money.d.ts +2 -2
- package/dist/lib/money.js +2 -2
- package/dist/lib/recordLinks.d.ts +17 -0
- package/dist/lib/recordLinks.d.ts.map +1 -0
- package/dist/lib/recordLinks.js +48 -0
- package/dist/lib/recordLinks.js.map +1 -0
- package/dist/lib/recordReferences.d.ts +41 -0
- package/dist/lib/recordReferences.d.ts.map +1 -0
- package/dist/lib/recordReferences.js +92 -0
- package/dist/lib/recordReferences.js.map +1 -0
- package/dist/modules/ai.d.ts +13 -0
- package/dist/modules/ai.d.ts.map +1 -0
- package/dist/modules/ai.js +22 -0
- package/dist/modules/ai.js.map +1 -0
- package/dist/modules/aiRunner.d.ts +3 -0
- package/dist/modules/aiRunner.d.ts.map +1 -0
- package/dist/modules/aiRunner.js +66 -0
- package/dist/modules/aiRunner.js.map +1 -0
- package/dist/pages/CompanyDetail.d.ts.map +1 -1
- package/dist/pages/CompanyDetail.js +2 -1
- package/dist/pages/CompanyDetail.js.map +1 -1
- package/dist/pages/DealDetail.d.ts.map +1 -1
- package/dist/pages/DealDetail.js +2 -1
- package/dist/pages/DealDetail.js.map +1 -1
- package/dist/pages/DealsPage.js +1 -1
- package/dist/pages/DealsPage.js.map +1 -1
- package/dist/pages/DecisionsPage.d.ts.map +1 -1
- package/dist/pages/DecisionsPage.js +5 -3
- package/dist/pages/DecisionsPage.js.map +1 -1
- package/dist/pages/EnquiryDetail.d.ts.map +1 -1
- package/dist/pages/EnquiryDetail.js +2 -1
- package/dist/pages/EnquiryDetail.js.map +1 -1
- package/dist/pages/EventDetail.d.ts.map +1 -1
- package/dist/pages/EventDetail.js +2 -1
- package/dist/pages/EventDetail.js.map +1 -1
- package/dist/pages/FundraisingPage.js +1 -1
- package/dist/pages/FundraisingPage.js.map +1 -1
- package/dist/pages/OpportunitiesPage.js +1 -1
- package/dist/pages/OpportunitiesPage.js.map +1 -1
- package/dist/pages/OpportunityDetail.d.ts.map +1 -1
- package/dist/pages/OpportunityDetail.js +2 -1
- package/dist/pages/OpportunityDetail.js.map +1 -1
- package/dist/pages/PartnershipDetail.d.ts.map +1 -1
- package/dist/pages/PartnershipDetail.js +2 -1
- package/dist/pages/PartnershipDetail.js.map +1 -1
- package/dist/pages/PartnershipsPage.js +1 -1
- package/dist/pages/PartnershipsPage.js.map +1 -1
- package/dist/pages/PersonDetail.d.ts.map +1 -1
- package/dist/pages/PersonDetail.js +4 -3
- package/dist/pages/PersonDetail.js.map +1 -1
- package/dist/pages/RaiseDetail.d.ts.map +1 -1
- package/dist/pages/RaiseDetail.js +2 -1
- package/dist/pages/RaiseDetail.js.map +1 -1
- package/dist/pages/SearchPage.d.ts.map +1 -1
- package/dist/pages/SearchPage.js +26 -14
- package/dist/pages/SearchPage.js.map +1 -1
- package/dist/pages/account/AccountLayout.d.ts.map +1 -1
- package/dist/pages/account/AccountLayout.js +2 -1
- package/dist/pages/account/AccountLayout.js.map +1 -1
- package/dist/pages/account/ConnectedAppsPage.d.ts +7 -0
- package/dist/pages/account/ConnectedAppsPage.d.ts.map +1 -0
- package/dist/pages/account/ConnectedAppsPage.js +32 -0
- package/dist/pages/account/ConnectedAppsPage.js.map +1 -0
- package/dist/pages/admin/AiPage.d.ts +2 -0
- package/dist/pages/admin/AiPage.d.ts.map +1 -0
- package/dist/pages/admin/AiPage.js +134 -0
- package/dist/pages/admin/AiPage.js.map +1 -0
- package/dist/pages/admin/McpPage.d.ts.map +1 -1
- package/dist/pages/admin/McpPage.js +7 -15
- package/dist/pages/admin/McpPage.js.map +1 -1
- package/dist/pages/admin/ModulesPage.d.ts.map +1 -1
- package/dist/pages/admin/ModulesPage.js +5 -4
- package/dist/pages/admin/ModulesPage.js.map +1 -1
- package/dist/pages/admin/WorkspaceSettingsPage.d.ts +5 -6
- package/dist/pages/admin/WorkspaceSettingsPage.d.ts.map +1 -1
- package/dist/pages/admin/WorkspaceSettingsPage.js +12 -17
- package/dist/pages/admin/WorkspaceSettingsPage.js.map +1 -1
- package/dist/pages/auth/AuthLayout.d.ts +1 -1
- package/dist/pages/auth/AuthLayout.d.ts.map +1 -1
- package/dist/pages/auth/AuthLayout.js +1 -1
- package/dist/pages/auth/AuthLayout.js.map +1 -1
- package/dist/pages/auth/SignUpPage.d.ts +1 -1
- package/dist/pages/auth/SignUpPage.js +1 -1
- package/dist/pages/dashboard/attention.d.ts +0 -5
- package/dist/pages/dashboard/attention.d.ts.map +1 -1
- package/dist/pages/dashboard/attention.js +1 -21
- package/dist/pages/dashboard/attention.js.map +1 -1
- package/dist/pages/dashboard/sections.d.ts.map +1 -1
- package/dist/pages/dashboard/sections.js +6 -3
- package/dist/pages/dashboard/sections.js.map +1 -1
- package/dist/pages/forms/SubmissionDetail.js +1 -1
- package/dist/pages/forms/SubmissionDetail.js.map +1 -1
- package/dist/pages/forms/SubmissionsTable.d.ts.map +1 -1
- package/dist/pages/forms/SubmissionsTable.js +4 -3
- package/dist/pages/forms/SubmissionsTable.js.map +1 -1
- package/dist/pages/handbook/HandbookPage.d.ts.map +1 -1
- package/dist/pages/handbook/HandbookPage.js +2 -3
- package/dist/pages/handbook/HandbookPage.js.map +1 -1
- package/dist/pages/hiringDirectory.js +2 -2
- package/dist/pages/hiringDirectory.js.map +1 -1
- package/dist/pages/oauth/ConsentPage.d.ts +14 -0
- package/dist/pages/oauth/ConsentPage.d.ts.map +1 -0
- package/dist/pages/oauth/ConsentPage.js +87 -0
- package/dist/pages/oauth/ConsentPage.js.map +1 -0
- package/dist/pages/onboarding/WorkspaceStepPage.d.ts.map +1 -1
- package/dist/pages/onboarding/WorkspaceStepPage.js +9 -27
- package/dist/pages/onboarding/WorkspaceStepPage.js.map +1 -1
- package/dist/pages/onboarding/onboardingModules.d.ts +1 -1
- package/dist/pages/onboarding/onboardingRerun.d.ts +10 -1
- package/dist/pages/onboarding/onboardingRerun.d.ts.map +1 -1
- package/dist/pages/onboarding/onboardingRerun.js +12 -1
- package/dist/pages/onboarding/onboardingRerun.js.map +1 -1
- package/dist/pages/positionDirectory.js +2 -2
- package/dist/pages/positionDirectory.js.map +1 -1
- package/dist/registry/context.d.ts +3 -1
- package/dist/registry/context.d.ts.map +1 -1
- package/dist/registry/context.js +4 -0
- package/dist/registry/context.js.map +1 -1
- package/dist/registry/contributions.d.ts +39 -1
- package/dist/registry/contributions.d.ts.map +1 -1
- package/dist/registry/contributions.js +1 -1
- package/dist/registry/overridable.d.ts +1 -1
- package/dist/registry/registry.d.ts +8 -4
- package/dist/registry/registry.d.ts.map +1 -1
- package/dist/registry/registry.js +9 -1
- package/dist/registry/registry.js.map +1 -1
- package/package.json +2 -2
- package/src/api/client.ts +7 -6
- package/src/api/resource.ts +6 -7
- package/src/api/resources/ai.ts +110 -0
- package/src/api/resources/conversions.ts +1 -1
- package/src/api/resources/members.ts +2 -2
- package/src/api/resources/oauth.ts +112 -0
- package/src/api/resources/planItems.ts +1 -1
- package/src/api/resources/session.ts +4 -2
- package/src/api/resources/workspace.ts +4 -4
- package/src/app/KelpieApp.tsx +6 -0
- package/src/components/ActivitiesPanel.tsx +39 -10
- package/src/components/ActivityAction.tsx +33 -0
- package/src/components/AgentTasks.tsx +138 -10
- package/src/components/ApiKeysPanel.tsx +17 -0
- package/src/components/DecisionsPanel.tsx +9 -1
- package/src/components/LinkedText.tsx +51 -0
- package/src/components/MarkdownView.tsx +37 -7
- package/src/components/NotesPanel.tsx +18 -12
- package/src/components/Paginator.tsx +1 -1
- package/src/components/PlanPanel.tsx +9 -1
- package/src/components/RecordLinkTextarea.tsx +257 -0
- package/src/components/Shell.tsx +1 -1
- package/src/components/SummaryBlock.tsx +1 -1
- package/src/components/WorkspaceSwitcher.tsx +15 -1
- package/src/index.ts +10 -0
- package/src/lib/fragmentTarget.ts +96 -0
- package/src/lib/mcpConfig.ts +24 -0
- package/src/lib/money.ts +2 -2
- package/src/lib/recordLinks.ts +57 -0
- package/src/lib/recordReferences.ts +139 -0
- package/src/modules/ai.tsx +23 -0
- package/src/modules/aiRunner.ts +80 -0
- package/src/pages/CompanyDetail.tsx +2 -1
- package/src/pages/DealDetail.tsx +2 -1
- package/src/pages/DealsPage.tsx +1 -1
- package/src/pages/DecisionsPage.tsx +5 -3
- package/src/pages/EnquiryDetail.tsx +2 -1
- package/src/pages/EventDetail.tsx +2 -1
- package/src/pages/FormsPage.tsx +1 -1
- package/src/pages/FundraisingPage.tsx +1 -1
- package/src/pages/OpportunitiesPage.tsx +1 -1
- package/src/pages/OpportunityDetail.tsx +2 -1
- package/src/pages/PartnershipDetail.tsx +2 -1
- package/src/pages/PartnershipsPage.tsx +1 -1
- package/src/pages/PersonDetail.tsx +4 -3
- package/src/pages/RaiseDetail.tsx +2 -1
- package/src/pages/SearchPage.tsx +30 -15
- package/src/pages/account/AccountLayout.tsx +2 -1
- package/src/pages/account/ConnectedAppsPage.tsx +131 -0
- package/src/pages/admin/AiPage.tsx +353 -0
- package/src/pages/admin/McpPage.tsx +48 -27
- package/src/pages/admin/ModulesPage.tsx +5 -4
- package/src/pages/admin/WorkspaceSettingsPage.tsx +13 -28
- package/src/pages/auth/AuthLayout.tsx +1 -1
- package/src/pages/auth/SignUpPage.tsx +1 -1
- package/src/pages/dashboard/attention.ts +1 -24
- package/src/pages/dashboard/sections.tsx +9 -4
- package/src/pages/forms/SubmissionDetail.tsx +1 -1
- package/src/pages/forms/SubmissionsTable.tsx +4 -3
- package/src/pages/handbook/HandbookPage.tsx +5 -6
- package/src/pages/hiringDirectory.ts +2 -2
- package/src/pages/oauth/ConsentPage.tsx +219 -0
- package/src/pages/onboarding/InvitesStepPage.tsx +1 -1
- package/src/pages/onboarding/WorkspaceStepPage.tsx +19 -43
- package/src/pages/onboarding/onboardingModules.ts +1 -1
- package/src/pages/onboarding/onboardingRerun.ts +15 -1
- package/src/pages/positionDirectory.ts +2 -2
- package/src/registry/context.ts +6 -0
- package/src/registry/contributions.ts +31 -1
- package/src/registry/overridable.ts +1 -1
- package/src/registry/registry.ts +21 -3
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { API_KEY_SCOPE_LABELS } from '@kelpie/schemas'
|
|
2
|
+
import type { OAuthGrant } from '@kelpie/schemas'
|
|
3
|
+
import { useState } from 'react'
|
|
4
|
+
|
|
5
|
+
import { useTimezone } from '../../api/resources/account.ts'
|
|
6
|
+
import { useOAuthGrants, useRevokeOAuthGrant } from '../../api/resources/oauth.ts'
|
|
7
|
+
import { PageHeader } from '../../components/PageHeader.tsx'
|
|
8
|
+
import { ErrorPanel, LoadingPanel } from '../../components/QueryState.tsx'
|
|
9
|
+
import { formatDate } from '../../lib/dates.ts'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* MCP clients this person connected through OAuth, across every workspace they
|
|
13
|
+
* belong to. Private to them, as personal API keys are: an admin's control is
|
|
14
|
+
* removing the member, which ends every connection in that workspace.
|
|
15
|
+
*/
|
|
16
|
+
export function ConnectedAppsPage(): React.JSX.Element {
|
|
17
|
+
const { grants, isLoading, error } = useOAuthGrants()
|
|
18
|
+
const revoke = useRevokeOAuthGrant()
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<div className="animate-slide-in space-y-4">
|
|
22
|
+
<PageHeader
|
|
23
|
+
title="Connected apps"
|
|
24
|
+
description="Apps you connected through MCP sign-in. Each one acts as you, in one workspace."
|
|
25
|
+
/>
|
|
26
|
+
|
|
27
|
+
{error !== null && <ErrorPanel error={error} />}
|
|
28
|
+
{revoke.error !== null && <ErrorPanel error={revoke.error} />}
|
|
29
|
+
|
|
30
|
+
{isLoading ? (
|
|
31
|
+
<LoadingPanel label="Loading connected apps…" />
|
|
32
|
+
) : grants.length === 0 ? (
|
|
33
|
+
<p className="rounded-md border border-border px-4 py-10 text-center text-[13px] text-ink-faint">
|
|
34
|
+
No connected apps. When an MCP client asks you to sign in to Kelpie, it shows up here.
|
|
35
|
+
</p>
|
|
36
|
+
) : (
|
|
37
|
+
<div className="overflow-hidden rounded-md border border-border">
|
|
38
|
+
<table className="w-full text-left text-[13px]">
|
|
39
|
+
<thead>
|
|
40
|
+
<tr className="border-b border-border bg-surface text-[11px] font-semibold tracking-wide text-ink-muted uppercase">
|
|
41
|
+
<th className="px-4 py-2.5">App</th>
|
|
42
|
+
<th className="px-4 py-2.5">Workspace</th>
|
|
43
|
+
<th className="px-4 py-2.5">Access</th>
|
|
44
|
+
<th className="px-4 py-2.5">Connected</th>
|
|
45
|
+
<th className="px-4 py-2.5">Last used</th>
|
|
46
|
+
<th className="px-4 py-2.5 text-right">Actions</th>
|
|
47
|
+
</tr>
|
|
48
|
+
</thead>
|
|
49
|
+
<tbody>
|
|
50
|
+
{grants.map((grant) => (
|
|
51
|
+
<GrantRow
|
|
52
|
+
key={grant.id}
|
|
53
|
+
grant={grant}
|
|
54
|
+
onRevoke={(id) => {
|
|
55
|
+
revoke.run(id)
|
|
56
|
+
}}
|
|
57
|
+
isRevoking={revoke.isPending}
|
|
58
|
+
/>
|
|
59
|
+
))}
|
|
60
|
+
</tbody>
|
|
61
|
+
</table>
|
|
62
|
+
</div>
|
|
63
|
+
)}
|
|
64
|
+
</div>
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function GrantRow({
|
|
69
|
+
grant,
|
|
70
|
+
onRevoke,
|
|
71
|
+
isRevoking,
|
|
72
|
+
}: {
|
|
73
|
+
readonly grant: OAuthGrant
|
|
74
|
+
readonly onRevoke: (id: string) => void
|
|
75
|
+
readonly isRevoking: boolean
|
|
76
|
+
}): React.JSX.Element {
|
|
77
|
+
const [isConfirming, setIsConfirming] = useState(false)
|
|
78
|
+
const timezone = useTimezone()
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<tr className="border-b border-border last:border-0">
|
|
82
|
+
<td className="px-4 py-3">
|
|
83
|
+
<div className="font-medium">{grant.clientName}</div>
|
|
84
|
+
<div className="font-mono text-[11px] text-ink-muted">{grant.clientHost}</div>
|
|
85
|
+
</td>
|
|
86
|
+
<td className="px-4 py-3 text-ink-muted">{grant.workspaceName}</td>
|
|
87
|
+
<td className="px-4 py-3 text-ink-muted">
|
|
88
|
+
{grant.scopes.map((scope) => API_KEY_SCOPE_LABELS[scope]).join(', ')}
|
|
89
|
+
</td>
|
|
90
|
+
<td className="px-4 py-3 text-ink-muted">{formatDate(grant.createdAt, timezone)}</td>
|
|
91
|
+
<td className="px-4 py-3 text-ink-muted">
|
|
92
|
+
{grant.lastUsedAt === null ? 'Never' : formatDate(grant.lastUsedAt, timezone)}
|
|
93
|
+
</td>
|
|
94
|
+
<td className="px-4 py-3 text-right">
|
|
95
|
+
{isConfirming ? (
|
|
96
|
+
<span className="inline-flex items-center gap-3">
|
|
97
|
+
<button
|
|
98
|
+
type="button"
|
|
99
|
+
onClick={() => {
|
|
100
|
+
setIsConfirming(false)
|
|
101
|
+
}}
|
|
102
|
+
className="text-[12px] font-medium text-ink-muted hover:text-ink"
|
|
103
|
+
>
|
|
104
|
+
Cancel
|
|
105
|
+
</button>
|
|
106
|
+
<button
|
|
107
|
+
type="button"
|
|
108
|
+
disabled={isRevoking}
|
|
109
|
+
onClick={() => {
|
|
110
|
+
onRevoke(grant.id)
|
|
111
|
+
}}
|
|
112
|
+
className="text-[12px] font-medium text-danger hover:underline disabled:opacity-50"
|
|
113
|
+
>
|
|
114
|
+
{isRevoking ? 'Disconnecting…' : 'Disconnect'}
|
|
115
|
+
</button>
|
|
116
|
+
</span>
|
|
117
|
+
) : (
|
|
118
|
+
<button
|
|
119
|
+
type="button"
|
|
120
|
+
onClick={() => {
|
|
121
|
+
setIsConfirming(true)
|
|
122
|
+
}}
|
|
123
|
+
className="text-[12px] font-medium text-danger hover:underline"
|
|
124
|
+
>
|
|
125
|
+
Disconnect
|
|
126
|
+
</button>
|
|
127
|
+
)}
|
|
128
|
+
</td>
|
|
129
|
+
</tr>
|
|
130
|
+
)
|
|
131
|
+
}
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
import { AI_DEFAULT_MODELS, AI_PROVIDER_LABELS, AI_PROVIDERS } from '@kelpie/schemas'
|
|
2
|
+
import type { AiProvider, AiRun, AiSettings, AiSettingsInput } from '@kelpie/schemas'
|
|
3
|
+
import { useState } from 'react'
|
|
4
|
+
import type { FormEvent } from 'react'
|
|
5
|
+
|
|
6
|
+
import { useTimezone } from '../../api/resources/account.ts'
|
|
7
|
+
import { useAiRuns, useAiSettings, useDisableAi, useSaveAiSettings } from '../../api/resources/ai.ts'
|
|
8
|
+
import { Chip } from '../../components/Chip.tsx'
|
|
9
|
+
import type { ChipTone } from '../../components/Chip.tsx'
|
|
10
|
+
import { PageHeader } from '../../components/PageHeader.tsx'
|
|
11
|
+
import { ErrorPanel, LoadingPanel } from '../../components/QueryState.tsx'
|
|
12
|
+
import { formatRelativeTime } from '../../lib/dates.ts'
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The AI admin page at `/admin/ai`, from the optional `ai` module.
|
|
16
|
+
*
|
|
17
|
+
* Two parts: the settings for Kelpie AI in this workspace, and its run log.
|
|
18
|
+
* Both read the same `/v1/ai/*` endpoints an agent would use.
|
|
19
|
+
*
|
|
20
|
+
* What the settings part shows depends on the module's key mode. In
|
|
21
|
+
* `workspace` mode an admin picks a provider, pastes their own API key, and
|
|
22
|
+
* may name a model. The key is write-only: the page shows its last four
|
|
23
|
+
* characters and never the key. In `deployment` mode the operator's
|
|
24
|
+
* environment decides all three, and the page offers only enable and disable.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
const STATUS_TONES: Readonly<Record<AiRun['status'], ChipTone>> = {
|
|
28
|
+
queued: 'neutral',
|
|
29
|
+
running: 'accent',
|
|
30
|
+
succeeded: 'success',
|
|
31
|
+
failed: 'danger',
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const OPERATION_TONES: Readonly<Record<string, ChipTone>> = {
|
|
35
|
+
applied: 'success',
|
|
36
|
+
failed: 'danger',
|
|
37
|
+
skipped: 'neutral',
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const inputClass =
|
|
41
|
+
'w-full max-w-md rounded-md border border-border bg-surface px-3 py-2 text-[13px] outline-none focus:border-accent focus:ring-2 focus:ring-accent/20'
|
|
42
|
+
const primaryButtonClass =
|
|
43
|
+
'rounded-md bg-accent px-3.5 py-2 text-[12px] font-semibold text-accent-fg transition hover:bg-accent-hover disabled:opacity-50'
|
|
44
|
+
const secondaryButtonClass =
|
|
45
|
+
'rounded-md border border-border px-3.5 py-2 text-[12px] font-medium text-ink transition hover:border-border-strong disabled:opacity-50'
|
|
46
|
+
|
|
47
|
+
function keyDescription(settings: AiSettings): string {
|
|
48
|
+
if (settings.keySource === 'workspace') {
|
|
49
|
+
return settings.keyHint === null ? 'Your key is stored.' : `Your key ending in ${settings.keyHint} is stored.`
|
|
50
|
+
}
|
|
51
|
+
if (settings.keySource === 'environment') {
|
|
52
|
+
return 'This install supplies a key. Enter your own to use it instead.'
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return 'No key is stored.'
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Provider, key and model for `workspace` key mode.
|
|
60
|
+
*
|
|
61
|
+
* Only changed fields are sent. The server keeps what is omitted, and drops the
|
|
62
|
+
* stored key and model when the provider changes, so this form clears the model
|
|
63
|
+
* field on a provider change to match.
|
|
64
|
+
*/
|
|
65
|
+
function WorkspaceKeyForm({ settings }: { readonly settings: AiSettings }): React.JSX.Element {
|
|
66
|
+
const save = useSaveAiSettings()
|
|
67
|
+
const [provider, setProvider] = useState<AiProvider>(settings.provider ?? 'openai')
|
|
68
|
+
const [apiKey, setApiKey] = useState('')
|
|
69
|
+
const [model, setModel] = useState(settings.provider === null ? '' : settings.model)
|
|
70
|
+
|
|
71
|
+
const providerChanged = provider !== settings.provider
|
|
72
|
+
const defaultModel = AI_DEFAULT_MODELS[provider]
|
|
73
|
+
|
|
74
|
+
/** `undefined` keeps the stored model, `null` clears it back to the default. */
|
|
75
|
+
function modelChange(): string | null | undefined {
|
|
76
|
+
const trimmed = model.trim()
|
|
77
|
+
|
|
78
|
+
if (trimmed === '') {
|
|
79
|
+
// Nothing to clear when the workspace has not chosen a provider yet.
|
|
80
|
+
if (settings.provider === null) return undefined
|
|
81
|
+
return providerChanged || settings.model !== defaultModel ? null : undefined
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return !providerChanged && trimmed === settings.model ? undefined : trimmed
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function changes(): AiSettingsInput {
|
|
88
|
+
const nextModel = modelChange()
|
|
89
|
+
|
|
90
|
+
return {
|
|
91
|
+
...(providerChanged ? { provider } : {}),
|
|
92
|
+
...(apiKey.trim() === '' ? {} : { apiKey: apiKey.trim() }),
|
|
93
|
+
...(nextModel === undefined ? {} : { model: nextModel }),
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function submit(formEvent: FormEvent): void {
|
|
98
|
+
formEvent.preventDefault()
|
|
99
|
+
save
|
|
100
|
+
.runAsync(changes())
|
|
101
|
+
.then(() => {
|
|
102
|
+
setApiKey('')
|
|
103
|
+
})
|
|
104
|
+
.catch(() => undefined)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
<form onSubmit={submit} className="mt-4 space-y-3">
|
|
109
|
+
<label className="block">
|
|
110
|
+
<span className="mb-1.5 block text-[12px] font-medium text-ink">Provider</span>
|
|
111
|
+
<select
|
|
112
|
+
value={provider}
|
|
113
|
+
onChange={(event) => {
|
|
114
|
+
setProvider(event.target.value as AiProvider)
|
|
115
|
+
setModel('')
|
|
116
|
+
}}
|
|
117
|
+
className="w-48 rounded-md border border-border bg-surface-raised px-3 py-2 text-[13px] outline-none focus:border-accent"
|
|
118
|
+
>
|
|
119
|
+
{AI_PROVIDERS.map((option) => (
|
|
120
|
+
<option key={option} value={option}>
|
|
121
|
+
{AI_PROVIDER_LABELS[option]}
|
|
122
|
+
</option>
|
|
123
|
+
))}
|
|
124
|
+
</select>
|
|
125
|
+
</label>
|
|
126
|
+
|
|
127
|
+
<label className="block">
|
|
128
|
+
<span className="mb-1.5 block text-[12px] font-medium text-ink">API key</span>
|
|
129
|
+
<input
|
|
130
|
+
type="password"
|
|
131
|
+
autoComplete="off"
|
|
132
|
+
value={apiKey}
|
|
133
|
+
onChange={(event) => {
|
|
134
|
+
setApiKey(event.target.value)
|
|
135
|
+
}}
|
|
136
|
+
placeholder={providerChanged ? `Paste your ${AI_PROVIDER_LABELS[provider]} API key` : 'Paste a new key to replace it'}
|
|
137
|
+
className={`${inputClass} font-mono`}
|
|
138
|
+
/>
|
|
139
|
+
<span className="mt-1.5 block text-[12px] text-ink-muted">
|
|
140
|
+
{providerChanged && settings.keySource === 'workspace'
|
|
141
|
+
? 'Changing provider removes the stored key.'
|
|
142
|
+
: keyDescription(settings)}{' '}
|
|
143
|
+
The key is stored encrypted and is never shown again.
|
|
144
|
+
</span>
|
|
145
|
+
</label>
|
|
146
|
+
|
|
147
|
+
<label className="block">
|
|
148
|
+
<span className="mb-1.5 block text-[12px] font-medium text-ink">Model</span>
|
|
149
|
+
<input
|
|
150
|
+
value={model}
|
|
151
|
+
onChange={(event) => {
|
|
152
|
+
setModel(event.target.value)
|
|
153
|
+
}}
|
|
154
|
+
placeholder={defaultModel}
|
|
155
|
+
className={`${inputClass} font-mono`}
|
|
156
|
+
/>
|
|
157
|
+
<span className="mt-1.5 block text-[12px] text-ink-muted">Leave it empty to use {defaultModel}.</span>
|
|
158
|
+
</label>
|
|
159
|
+
|
|
160
|
+
{save.error !== null && <ErrorPanel error={save.error} />}
|
|
161
|
+
|
|
162
|
+
<div className="flex flex-wrap gap-2">
|
|
163
|
+
<button type="submit" disabled={save.isPending} className={primaryButtonClass}>
|
|
164
|
+
{save.isPending ? 'Saving…' : settings.enabled ? 'Save' : 'Enable AI'}
|
|
165
|
+
</button>
|
|
166
|
+
{settings.enabled && settings.keySource === 'workspace' && !providerChanged && (
|
|
167
|
+
<button
|
|
168
|
+
type="button"
|
|
169
|
+
disabled={save.isPending}
|
|
170
|
+
onClick={() => {
|
|
171
|
+
save.run({ apiKey: null })
|
|
172
|
+
}}
|
|
173
|
+
className={secondaryButtonClass}
|
|
174
|
+
>
|
|
175
|
+
Remove stored key
|
|
176
|
+
</button>
|
|
177
|
+
)}
|
|
178
|
+
</div>
|
|
179
|
+
</form>
|
|
180
|
+
)
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function DeploymentKeyControls({ settings }: { readonly settings: AiSettings }): React.JSX.Element {
|
|
184
|
+
const save = useSaveAiSettings()
|
|
185
|
+
|
|
186
|
+
if (!settings.configured) {
|
|
187
|
+
return (
|
|
188
|
+
<p className="mt-3 text-[13px] text-ink-muted">
|
|
189
|
+
The operator has not set up a provider for this install. Set
|
|
190
|
+
<code className="mx-1 rounded bg-surface px-1">AI_PROVIDER</code>
|
|
191
|
+
and
|
|
192
|
+
<code className="mx-1 rounded bg-surface px-1">AI_API_KEY</code>
|
|
193
|
+
in the environment to turn on AI runs.
|
|
194
|
+
</p>
|
|
195
|
+
)
|
|
196
|
+
}
|
|
197
|
+
if (settings.monthlyLimit === 0) {
|
|
198
|
+
return <p className="mt-4 text-[13px] text-ink-muted">AI runs are not included for this workspace. Your own agent still works over MCP.</p>
|
|
199
|
+
}
|
|
200
|
+
if (settings.enabled) {
|
|
201
|
+
return <></>
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
return (
|
|
205
|
+
<div className="mt-4 space-y-2">
|
|
206
|
+
{save.error !== null && <ErrorPanel error={save.error} />}
|
|
207
|
+
<button
|
|
208
|
+
type="button"
|
|
209
|
+
disabled={save.isPending}
|
|
210
|
+
onClick={() => {
|
|
211
|
+
save.run({})
|
|
212
|
+
}}
|
|
213
|
+
className={primaryButtonClass}
|
|
214
|
+
>
|
|
215
|
+
{save.isPending ? 'Saving…' : 'Enable AI'}
|
|
216
|
+
</button>
|
|
217
|
+
</div>
|
|
218
|
+
)
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function SettingsPanel({ settings }: { readonly settings: AiSettings }): React.JSX.Element {
|
|
222
|
+
const disable = useDisableAi()
|
|
223
|
+
|
|
224
|
+
return (
|
|
225
|
+
<section className="rounded-md border border-border p-5">
|
|
226
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
227
|
+
<h2 className="text-[15px] font-semibold text-ink">Kelpie AI</h2>
|
|
228
|
+
<Chip tone={settings.enabled ? 'success' : 'neutral'}>{settings.enabled ? 'Enabled' : 'Not enabled'}</Chip>
|
|
229
|
+
</div>
|
|
230
|
+
<p className="mt-2 max-w-2xl text-[13px] leading-relaxed text-ink-muted">
|
|
231
|
+
Kelpie AI runs agent tasks for you: enrichment, summaries, follow-ups and notes. It reads the record and its
|
|
232
|
+
neighbours, asks the model for a reply, and applies that reply through the same tools any agent uses.
|
|
233
|
+
</p>
|
|
234
|
+
|
|
235
|
+
<dl className="mt-4 grid max-w-md grid-cols-2 gap-y-2 text-[13px]">
|
|
236
|
+
{settings.provider !== null && (
|
|
237
|
+
<>
|
|
238
|
+
<dt className="text-ink-muted">Provider</dt>
|
|
239
|
+
<dd className="text-ink">{AI_PROVIDER_LABELS[settings.provider]}</dd>
|
|
240
|
+
<dt className="text-ink-muted">Model</dt>
|
|
241
|
+
<dd className="font-mono text-ink">{settings.model}</dd>
|
|
242
|
+
</>
|
|
243
|
+
)}
|
|
244
|
+
<dt className="text-ink-muted">Runs this month</dt>
|
|
245
|
+
<dd className="text-ink">
|
|
246
|
+
{settings.runsThisMonth}
|
|
247
|
+
{settings.monthlyLimit === null ? '' : ` / ${String(settings.monthlyLimit)}`}
|
|
248
|
+
</dd>
|
|
249
|
+
</dl>
|
|
250
|
+
|
|
251
|
+
{settings.keyMode === 'workspace' ? (
|
|
252
|
+
<WorkspaceKeyForm
|
|
253
|
+
// Remount on a saved change, so the form starts from what the server now holds.
|
|
254
|
+
key={`${settings.provider ?? 'none'}:${settings.model}:${settings.keySource ?? 'none'}:${settings.keyHint ?? ''}`}
|
|
255
|
+
settings={settings}
|
|
256
|
+
/>
|
|
257
|
+
) : (
|
|
258
|
+
<DeploymentKeyControls settings={settings} />
|
|
259
|
+
)}
|
|
260
|
+
|
|
261
|
+
{settings.enabled && (
|
|
262
|
+
<div className="mt-4 space-y-2 border-t border-border pt-4">
|
|
263
|
+
{disable.error !== null && <ErrorPanel error={disable.error} />}
|
|
264
|
+
<button
|
|
265
|
+
type="button"
|
|
266
|
+
disabled={disable.isPending}
|
|
267
|
+
onClick={() => {
|
|
268
|
+
disable.run()
|
|
269
|
+
}}
|
|
270
|
+
className="rounded-md border border-danger px-3.5 py-2 text-[12px] font-medium text-danger disabled:opacity-50"
|
|
271
|
+
>
|
|
272
|
+
{disable.isPending ? 'Disabling…' : 'Disable AI'}
|
|
273
|
+
</button>
|
|
274
|
+
<p className="text-[12px] text-ink-muted">
|
|
275
|
+
Disabling removes Kelpie AI from the Run menu
|
|
276
|
+
{settings.keySource === 'workspace' ? ' and deletes the stored key' : ''}. The run log is kept.
|
|
277
|
+
</p>
|
|
278
|
+
</div>
|
|
279
|
+
)}
|
|
280
|
+
</section>
|
|
281
|
+
)
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
function RunLog(): React.JSX.Element {
|
|
285
|
+
const { records: runs, isLoading, error } = useAiRuns()
|
|
286
|
+
const timezone = useTimezone()
|
|
287
|
+
|
|
288
|
+
return (
|
|
289
|
+
<section className="rounded-md border border-border p-5">
|
|
290
|
+
<h2 className="text-[15px] font-semibold text-ink">Run log</h2>
|
|
291
|
+
{isLoading && <LoadingPanel label="Loading runs…" />}
|
|
292
|
+
{error !== null && <ErrorPanel error={error} />}
|
|
293
|
+
{!isLoading && error === null && runs.length === 0 && (
|
|
294
|
+
<p className="mt-2 text-[13px] text-ink-muted">
|
|
295
|
+
No runs yet. Start one from the Agent menu on any record page and pick <em>Kelpie AI</em>.
|
|
296
|
+
</p>
|
|
297
|
+
)}
|
|
298
|
+
{runs.length > 0 && (
|
|
299
|
+
<ul className="mt-3 flex flex-col gap-2">
|
|
300
|
+
{runs.map((run) => (
|
|
301
|
+
<li key={run.id} className="rounded-md border border-border bg-surface p-3">
|
|
302
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
303
|
+
<Chip tone={STATUS_TONES[run.status]}>{run.status}</Chip>
|
|
304
|
+
<span className="text-[13px] font-medium text-ink">{run.taskId}</span>
|
|
305
|
+
<span className="text-[12px] text-ink-muted">
|
|
306
|
+
{run.targetType} · {run.targetId}
|
|
307
|
+
</span>
|
|
308
|
+
<span className="ml-auto text-[12px] text-ink-faint">{formatRelativeTime(run.createdAt, timezone)}</span>
|
|
309
|
+
</div>
|
|
310
|
+
<p className="mt-1 text-[12px] text-ink-muted">
|
|
311
|
+
<span className="font-mono">{run.model}</span>
|
|
312
|
+
{run.inputTokens !== null && run.outputTokens !== null
|
|
313
|
+
? ` · ${String(run.inputTokens)} in · ${String(run.outputTokens)} out`
|
|
314
|
+
: ''}
|
|
315
|
+
</p>
|
|
316
|
+
{run.failureReason !== null && <p className="mt-2 text-[12px] text-danger">{run.failureReason}</p>}
|
|
317
|
+
{run.output !== null && (
|
|
318
|
+
<pre className="mt-2 max-h-64 overflow-auto whitespace-pre-wrap rounded bg-surface-raised p-2 text-[12px] text-ink">
|
|
319
|
+
{run.output}
|
|
320
|
+
</pre>
|
|
321
|
+
)}
|
|
322
|
+
{run.operations !== null && run.operations.length > 0 && (
|
|
323
|
+
<ul className="mt-2 flex flex-col gap-1">
|
|
324
|
+
{run.operations.map((operation, index) => (
|
|
325
|
+
<li key={`${run.id}-op-${String(index)}`} className="flex flex-wrap items-center gap-2 text-[12px]">
|
|
326
|
+
<Chip tone={OPERATION_TONES[operation.status] ?? 'neutral'}>{operation.status}</Chip>
|
|
327
|
+
<span className="font-medium text-ink">{operation.kind}</span>
|
|
328
|
+
<span className="text-ink-muted">{operation.detail}</span>
|
|
329
|
+
</li>
|
|
330
|
+
))}
|
|
331
|
+
</ul>
|
|
332
|
+
)}
|
|
333
|
+
</li>
|
|
334
|
+
))}
|
|
335
|
+
</ul>
|
|
336
|
+
)}
|
|
337
|
+
</section>
|
|
338
|
+
)
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
export function AiPage(): React.JSX.Element {
|
|
342
|
+
const { record: settings, isLoading, error } = useAiSettings()
|
|
343
|
+
|
|
344
|
+
return (
|
|
345
|
+
<div className="animate-slide-in mx-auto max-w-4xl space-y-6">
|
|
346
|
+
<PageHeader title="AI" description="Run agent tasks with your own model provider." />
|
|
347
|
+
{isLoading && <LoadingPanel label="Loading AI settings…" />}
|
|
348
|
+
{error !== null && <ErrorPanel error={error} />}
|
|
349
|
+
{settings !== undefined && <SettingsPanel settings={settings} />}
|
|
350
|
+
<RunLog />
|
|
351
|
+
</div>
|
|
352
|
+
)
|
|
353
|
+
}
|
|
@@ -16,6 +16,7 @@ import { PageHeader } from '../../components/PageHeader.tsx'
|
|
|
16
16
|
import { ErrorPanel, LoadingPanel } from '../../components/QueryState.tsx'
|
|
17
17
|
import { CopyButton } from '../../components/CopyButton.tsx'
|
|
18
18
|
import { formatRelativeTime } from '../../lib/dates.ts'
|
|
19
|
+
import { mcpClientConfig, mcpEndpoint } from '../../lib/mcpConfig.ts'
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* How an agent connects to this workspace.
|
|
@@ -50,17 +51,8 @@ function matches(tool: McpTool, term: string): boolean {
|
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
export function McpPage(): React.JSX.Element {
|
|
53
|
-
const endpoint =
|
|
54
|
-
const config =
|
|
55
|
-
"mcpServers": {
|
|
56
|
-
"kelpie": {
|
|
57
|
-
"url": "${endpoint}",
|
|
58
|
-
"headers": {
|
|
59
|
-
"Authorization": "Bearer kp_live_…"
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}`
|
|
54
|
+
const endpoint = mcpEndpoint()
|
|
55
|
+
const config = mcpClientConfig(endpoint, 'kp_live_…')
|
|
64
56
|
|
|
65
57
|
return (
|
|
66
58
|
<div className="animate-slide-in mx-auto max-w-4xl space-y-6">
|
|
@@ -71,8 +63,8 @@ export function McpPage(): React.JSX.Element {
|
|
|
71
63
|
<p className="mt-2 max-w-2xl text-[13px] leading-relaxed text-ink-muted">
|
|
72
64
|
Kelpie is a CRM and a company brain. Every REST operation is also an MCP tool over
|
|
73
65
|
Streamable HTTP, so an agent reads and writes the same records the app does, through the
|
|
74
|
-
same API. Point Claude, Cursor, or any MCP client at this workspace
|
|
75
|
-
AI
|
|
66
|
+
same API. Point Claude, Cursor, or any MCP client at this workspace: bring your own agent.
|
|
67
|
+
An install with the AI module can also run tasks on your own OpenAI or Anthropic key.
|
|
76
68
|
</p>
|
|
77
69
|
<ul className="mt-4 space-y-2 text-[13px] text-ink">
|
|
78
70
|
<li className="flex gap-2">
|
|
@@ -85,8 +77,8 @@ export function McpPage(): React.JSX.Element {
|
|
|
85
77
|
</li>
|
|
86
78
|
<li className="flex gap-2">
|
|
87
79
|
<span className="text-accent">→</span>
|
|
88
|
-
|
|
89
|
-
|
|
80
|
+
A browser session does not work here. The endpoint takes an API key, or a token from
|
|
81
|
+
OAuth sign-in.
|
|
90
82
|
</li>
|
|
91
83
|
</ul>
|
|
92
84
|
</section>
|
|
@@ -101,6 +93,19 @@ export function McpPage(): React.JSX.Element {
|
|
|
101
93
|
</code>
|
|
102
94
|
</section>
|
|
103
95
|
|
|
96
|
+
<section className="rounded-md border border-border p-5">
|
|
97
|
+
<h2 className="text-[13px] font-semibold text-ink">Sign in with OAuth</h2>
|
|
98
|
+
<p className="mt-1 max-w-2xl text-[12px] text-ink-muted">
|
|
99
|
+
A client that supports MCP sign-in, such as a Claude.ai connector, needs only the endpoint
|
|
100
|
+
URL above. It opens a Kelpie page where you choose a workspace and approve the access. You
|
|
101
|
+
can disconnect it at any time under{' '}
|
|
102
|
+
<Link to="/account/connected-apps" className="text-accent hover:underline">
|
|
103
|
+
Connected apps
|
|
104
|
+
</Link>
|
|
105
|
+
.
|
|
106
|
+
</p>
|
|
107
|
+
</section>
|
|
108
|
+
|
|
104
109
|
<section className="rounded-md border border-border p-5">
|
|
105
110
|
<div className="flex items-center justify-between gap-3">
|
|
106
111
|
<h2 className="text-[13px] font-semibold text-ink">Claude / Cursor config</h2>
|
|
@@ -246,9 +251,15 @@ function RegisteredAgents(): React.JSX.Element {
|
|
|
246
251
|
<li key={agent.id} className="flex flex-wrap items-center justify-between gap-3 px-3 py-2.5">
|
|
247
252
|
<div className="min-w-0">
|
|
248
253
|
<div className="text-[13px] font-medium text-ink">{agent.name}</div>
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
254
|
+
{agent.managedBy === null ? (
|
|
255
|
+
<code className="font-mono text-[11px] break-all text-ink-muted">
|
|
256
|
+
{agent.endpoint}
|
|
257
|
+
</code>
|
|
258
|
+
) : (
|
|
259
|
+
// A module-managed agent is dispatched in-process; its stored
|
|
260
|
+
// endpoint is not an address anything calls.
|
|
261
|
+
<span className="text-[11px] text-ink-muted">Runs inside Kelpie ({agent.managedBy} module)</span>
|
|
262
|
+
)}
|
|
252
263
|
</div>
|
|
253
264
|
<div className="flex shrink-0 items-center gap-3 text-[11px] text-ink-faint">
|
|
254
265
|
{agent.hasAuthHeader && <span>Auth header set</span>}
|
|
@@ -257,15 +268,25 @@ function RegisteredAgents(): React.JSX.Element {
|
|
|
257
268
|
? 'Never run'
|
|
258
269
|
: `Last run ${formatRelativeTime(agent.lastRunAt, timezone)}`}
|
|
259
270
|
</span>
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
271
|
+
{agent.managedBy === null ? (
|
|
272
|
+
<button
|
|
273
|
+
type="button"
|
|
274
|
+
onClick={() => {
|
|
275
|
+
deleteAgent.run(agent.id)
|
|
276
|
+
}}
|
|
277
|
+
className="font-medium text-danger hover:underline"
|
|
278
|
+
>
|
|
279
|
+
Remove
|
|
280
|
+
</button>
|
|
281
|
+
) : agent.settingsPath === null ? (
|
|
282
|
+
// The API refuses to change a row a module owns, so there is
|
|
283
|
+
// no Remove to offer; the module's own settings manage it.
|
|
284
|
+
<span>Managed by a module</span>
|
|
285
|
+
) : (
|
|
286
|
+
<Link to={agent.settingsPath} className="font-medium text-accent hover:underline">
|
|
287
|
+
Manage in settings
|
|
288
|
+
</Link>
|
|
289
|
+
)}
|
|
269
290
|
</div>
|
|
270
291
|
</li>
|
|
271
292
|
))}
|
|
@@ -8,10 +8,11 @@ import { ErrorPanel, LoadingPanel } from '../../components/QueryState.tsx'
|
|
|
8
8
|
/**
|
|
9
9
|
* Turns optional modules on or off for this workspace.
|
|
10
10
|
*
|
|
11
|
-
* A module a deploy-time config file locks
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* A module a deploy-time config file locks
|
|
12
|
+
* (`docs/self-hosting/configuration.md`) shows as disabled with a note rather
|
|
13
|
+
* than being left out of the list: a workspace admin should see that the
|
|
14
|
+
* choice exists and is not theirs, not wonder why a module they expect is
|
|
15
|
+
* simply missing from the page.
|
|
15
16
|
*
|
|
16
17
|
* Known ids get a friendlier label; an id this page has never heard of still
|
|
17
18
|
* renders, title-cased, because the module catalog is meant to grow without
|