@kelpie/ui 0.22.0 → 0.24.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/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/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/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/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/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/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/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 +2 -2
- package/dist/pages/PersonDetail.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/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.js +15 -3
- package/dist/pages/forms/SubmissionDetail.js.map +1 -1
- package/dist/pages/forms/SubmissionsTable.js +5 -2
- package/dist/pages/forms/SubmissionsTable.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 +4 -4
- package/src/api/resource.ts +16 -0
- package/src/api/resources/decisions.ts +81 -1
- 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/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/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/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/DealsPage.tsx +25 -8
- package/src/pages/DecisionsPage.tsx +28 -1
- package/src/pages/EnquiriesPage.tsx +23 -5
- package/src/pages/FundraisingPage.tsx +25 -11
- package/src/pages/OpportunitiesPage.tsx +23 -5
- package/src/pages/PartnershipsPage.tsx +25 -11
- package/src/pages/PeoplePage.tsx +22 -7
- package/src/pages/PersonDetail.tsx +4 -2
- 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/FormEmails.tsx +11 -2
- package/src/pages/forms/FormSettings.tsx +5 -0
- package/src/pages/forms/SubmissionDetail.tsx +23 -4
- package/src/pages/forms/SubmissionsTable.tsx +9 -1
- package/src/pages/oauth/ConsentPage.tsx +271 -33
- package/src/registry/contributions.ts +1 -1
|
@@ -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.
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
useSendInvite,
|
|
12
12
|
} from '../../api/resources/invites.ts'
|
|
13
13
|
import { useSession } from '../../api/resources/session.ts'
|
|
14
|
+
import { Chip } from '../../components/Chip.tsx'
|
|
14
15
|
import { PageHeader } from '../../components/PageHeader.tsx'
|
|
15
16
|
import { ErrorPanel, LoadingPanel } from '../../components/QueryState.tsx'
|
|
16
17
|
import { initialsOf } from '../../lib/names.ts'
|
|
@@ -194,6 +195,9 @@ function InviteRow({
|
|
|
194
195
|
>
|
|
195
196
|
{invite.status === 'pending' ? `Pending until ${formatDate(invite.expiresAt)}` : 'Expired'}
|
|
196
197
|
</span>
|
|
198
|
+
{invite.emailFailedAt !== null && (
|
|
199
|
+
<EmailNotDelivered failedAt={invite.emailFailedAt} reason={invite.emailFailure} />
|
|
200
|
+
)}
|
|
197
201
|
</td>
|
|
198
202
|
<td className="px-4 py-3 text-right">
|
|
199
203
|
<div className="flex flex-wrap justify-end gap-3">
|
|
@@ -220,6 +224,35 @@ function InviteRow({
|
|
|
220
224
|
)
|
|
221
225
|
}
|
|
222
226
|
|
|
227
|
+
/**
|
|
228
|
+
* Says that the invitation email did not arrive, and why. The person who was
|
|
229
|
+
* invited has no link, so the invitation stays pending until an admin sends
|
|
230
|
+
* it again or revokes it. The Resend button is in the same row.
|
|
231
|
+
*
|
|
232
|
+
* The reason is the mail server's own answer. It is shown as text, not only
|
|
233
|
+
* as a tooltip, so a touch screen shows it too. `break-words` and the
|
|
234
|
+
* maximum width keep a long answer from making the table wider.
|
|
235
|
+
*/
|
|
236
|
+
function EmailNotDelivered({
|
|
237
|
+
failedAt,
|
|
238
|
+
reason,
|
|
239
|
+
}: {
|
|
240
|
+
readonly failedAt: Date
|
|
241
|
+
readonly reason: string | null
|
|
242
|
+
}): React.JSX.Element {
|
|
243
|
+
return (
|
|
244
|
+
<div className="mt-1.5 max-w-[320px] min-w-[160px]">
|
|
245
|
+
<Chip tone="danger">Email not delivered</Chip>
|
|
246
|
+
<p className="mt-1 text-[11px] break-words text-ink-muted">
|
|
247
|
+
{reason === null || reason === '' ? 'The mail server gave no reason.' : reason}
|
|
248
|
+
</p>
|
|
249
|
+
<p className="mt-0.5 text-[11px] text-ink-faint">
|
|
250
|
+
Failed {formatDate(failedAt)}. Resend it, or revoke it and invite the correct address.
|
|
251
|
+
</p>
|
|
252
|
+
</div>
|
|
253
|
+
)
|
|
254
|
+
}
|
|
255
|
+
|
|
223
256
|
function MemberTable({
|
|
224
257
|
members,
|
|
225
258
|
isAdmin,
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { PageHeader } from '../../components/PageHeader.tsx'
|
|
2
|
+
import { McpPanel } from './McpPanel.tsx'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* AI at `/ai`: how a member's agent reaches this workspace.
|
|
6
|
+
*
|
|
7
|
+
* Outside Admin, so every member can open it. Any member can use MCP with a
|
|
8
|
+
* personal key or OAuth sign-in, and this page is where they find the address.
|
|
9
|
+
* Settings for AI stay under Admin → AI.
|
|
10
|
+
*
|
|
11
|
+
* No tab strip while MCP is the only content. Add one with the second tab.
|
|
12
|
+
*/
|
|
13
|
+
export function AiAccessPage(): React.JSX.Element {
|
|
14
|
+
return (
|
|
15
|
+
<div className="animate-slide-in mx-auto max-w-4xl">
|
|
16
|
+
<PageHeader
|
|
17
|
+
title="Connect your agent"
|
|
18
|
+
description="Give Claude, Cursor, or another MCP client access to this workspace."
|
|
19
|
+
/>
|
|
20
|
+
<McpPanel />
|
|
21
|
+
</div>
|
|
22
|
+
)
|
|
23
|
+
}
|