@kelpie/ui 0.15.0 → 0.16.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 +5 -4
- 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/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.js +1 -1
- 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/ApiKeysPanel.d.ts.map +1 -1
- package/dist/components/ApiKeysPanel.js +4 -1
- package/dist/components/ApiKeysPanel.js.map +1 -1
- package/dist/components/Paginator.d.ts +1 -1
- package/dist/components/Shell.js +1 -1
- package/dist/components/SummaryBlock.d.ts +1 -1
- package/dist/components/SummaryBlock.js +1 -1
- 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/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/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/PartnershipsPage.js +1 -1
- package/dist/pages/PartnershipsPage.js.map +1 -1
- package/dist/pages/PersonDetail.js +2 -2
- package/dist/pages/PersonDetail.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/McpPage.d.ts.map +1 -1
- package/dist/pages/admin/McpPage.js +6 -14
- 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/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/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/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/onboardingModules.d.ts +1 -1
- package/dist/pages/onboarding/onboardingRerun.d.ts +1 -1
- package/dist/pages/onboarding/onboardingRerun.js +1 -1
- package/dist/pages/positionDirectory.js +2 -2
- package/dist/pages/positionDirectory.js.map +1 -1
- package/dist/registry/contributions.d.ts +1 -1
- package/dist/registry/contributions.js +1 -1
- package/dist/registry/overridable.d.ts +1 -1
- package/dist/registry/registry.d.ts +3 -3
- package/dist/registry/registry.d.ts.map +1 -1
- package/dist/registry/registry.js +1 -1
- package/package.json +2 -2
- package/src/api/client.ts +6 -5
- package/src/api/resource.ts +6 -7
- 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 +1 -1
- package/src/app/KelpieApp.tsx +6 -0
- package/src/components/ApiKeysPanel.tsx +17 -0
- package/src/components/Paginator.tsx +1 -1
- package/src/components/Shell.tsx +1 -1
- package/src/components/SummaryBlock.tsx +1 -1
- package/src/lib/mcpConfig.ts +24 -0
- package/src/lib/money.ts +2 -2
- package/src/pages/DealsPage.tsx +1 -1
- package/src/pages/DecisionsPage.tsx +5 -3
- package/src/pages/FormsPage.tsx +1 -1
- package/src/pages/FundraisingPage.tsx +1 -1
- package/src/pages/OpportunitiesPage.tsx +1 -1
- package/src/pages/PartnershipsPage.tsx +1 -1
- package/src/pages/PersonDetail.tsx +2 -2
- package/src/pages/account/AccountLayout.tsx +2 -1
- package/src/pages/account/ConnectedAppsPage.tsx +131 -0
- package/src/pages/admin/McpPage.tsx +37 -22
- package/src/pages/admin/ModulesPage.tsx +5 -4
- package/src/pages/auth/AuthLayout.tsx +1 -1
- package/src/pages/auth/SignUpPage.tsx +1 -1
- package/src/pages/forms/SubmissionDetail.tsx +1 -1
- package/src/pages/forms/SubmissionsTable.tsx +4 -3
- 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/onboardingModules.ts +1 -1
- package/src/pages/onboarding/onboardingRerun.ts +1 -1
- package/src/pages/positionDirectory.ts +2 -2
- package/src/registry/contributions.ts +1 -1
- package/src/registry/overridable.ts +1 -1
- package/src/registry/registry.ts +3 -3
package/src/pages/DealsPage.tsx
CHANGED
|
@@ -113,7 +113,7 @@ export function DealsPage(): React.JSX.Element {
|
|
|
113
113
|
const visibleDeals = deals.records.filter((deal) => visibleStageIds.has(deal.stageId))
|
|
114
114
|
|
|
115
115
|
// The next-step column asks about the deals on screen by id. `?target_id=`
|
|
116
|
-
// takes at most one page of them (`api.md`), so past that ceiling the rest
|
|
116
|
+
// takes at most one page of them (`docs/agents/api-and-webhooks.md`), so past that ceiling the rest
|
|
117
117
|
// read as having no plan; the note under the table says so.
|
|
118
118
|
const askedDealIds = visibleDeals.slice(0, MAX_PAGE_SIZE).map((deal) => deal.id)
|
|
119
119
|
const planItems = usePlanItems(
|
|
@@ -29,13 +29,15 @@ import { useListView } from '../lib/listView.ts'
|
|
|
29
29
|
* matches target names the loaded page may not even hold.
|
|
30
30
|
*
|
|
31
31
|
* The "Linked to" column joins client-side against one page each of people,
|
|
32
|
-
* companies, deals, opportunities, raises and partnerships, because
|
|
33
|
-
* has no include-expansion
|
|
32
|
+
* companies, deals, opportunities, raises and partnerships, because the API
|
|
33
|
+
* has no include-expansion. The repeatable id filters (`?person_id=`,
|
|
34
|
+
* `?company_id=`, …) match a foreign key; no list filters on its own `?id=`,
|
|
35
|
+
* so there is no way to fetch just the targets by id. A target past
|
|
34
36
|
* those pages, or one whose type has no page yet (candidate), names its record
|
|
35
37
|
* type instead — better than a raw id or a link to a route that does not exist.
|
|
36
38
|
*/
|
|
37
39
|
|
|
38
|
-
/**
|
|
40
|
+
/** `?limit=` maxes out at 200 (`docs/agents/api-and-webhooks.md`). */
|
|
39
41
|
const MAX_PAGE = 200
|
|
40
42
|
|
|
41
43
|
const TARGET_LABELS: Readonly<Record<RecordTargetType, string>> = {
|
package/src/pages/FormsPage.tsx
CHANGED
|
@@ -24,7 +24,7 @@ import { CONTACT_FORM_FIELDS } from './forms/template.ts'
|
|
|
24
24
|
* loaded array, so they match forms this page has not paged to yet.
|
|
25
25
|
*
|
|
26
26
|
* There is no submissions count column. The mockup had one because its seed data
|
|
27
|
-
* was a local array; here it would be one request per row, and
|
|
27
|
+
* was a local array; here it would be one request per row, and the API has no
|
|
28
28
|
* expansion to fold that into the list. The count lives on the detail page,
|
|
29
29
|
* where the submissions are already being fetched.
|
|
30
30
|
*/
|
|
@@ -109,7 +109,7 @@ export function FundraisingPage(): React.JSX.Element {
|
|
|
109
109
|
const visibleRaises = raises.records.filter((raise) => visibleStageIds.has(raise.stageId))
|
|
110
110
|
|
|
111
111
|
// The next-step column asks about the records on screen by id. `?target_id=`
|
|
112
|
-
// takes at most one page of them (`api.md`), so past that ceiling the rest
|
|
112
|
+
// takes at most one page of them (`docs/agents/api-and-webhooks.md`), so past that ceiling the rest
|
|
113
113
|
// read as having no plan; the note under the table says so.
|
|
114
114
|
const askedIds = visibleRaises.slice(0, MAX_PAGE_SIZE).map((raise) => raise.id)
|
|
115
115
|
const planItems = usePlanItems(
|
|
@@ -109,7 +109,7 @@ export function OpportunitiesPage(): React.JSX.Element {
|
|
|
109
109
|
)
|
|
110
110
|
|
|
111
111
|
// The next-step column asks about the records on screen by id. `?target_id=`
|
|
112
|
-
// takes at most one page of them (`api.md`), so past that ceiling the rest
|
|
112
|
+
// takes at most one page of them (`docs/agents/api-and-webhooks.md`), so past that ceiling the rest
|
|
113
113
|
// read as having no plan; the note under the table says so.
|
|
114
114
|
const askedIds = visibleOpportunities.slice(0, MAX_PAGE_SIZE).map((opportunity) => opportunity.id)
|
|
115
115
|
const planItems = usePlanItems(
|
|
@@ -110,7 +110,7 @@ export function PartnershipsPage(): React.JSX.Element {
|
|
|
110
110
|
)
|
|
111
111
|
|
|
112
112
|
// The next-step column asks about the records on screen by id. `?target_id=`
|
|
113
|
-
// takes at most one page of them (`api.md`), so past that ceiling the rest
|
|
113
|
+
// takes at most one page of them (`docs/agents/api-and-webhooks.md`), so past that ceiling the rest
|
|
114
114
|
// read as having no plan; the note under the table says so.
|
|
115
115
|
const askedIds = visiblePartnerships.slice(0, MAX_PAGE_SIZE).map((partnership) => partnership.id)
|
|
116
116
|
const planItems = usePlanItems(
|
|
@@ -209,7 +209,7 @@ export function PersonDetail(): React.JSX.Element {
|
|
|
209
209
|
)
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
/** A committed inline edit is one `PATCH` of one field
|
|
212
|
+
/** A committed inline edit is one `PATCH` of one field. */
|
|
213
213
|
function usePersonPatch(person: Person): PatchResult<PersonInput> {
|
|
214
214
|
return usePatch(useUpdatePerson, person)
|
|
215
215
|
}
|
|
@@ -672,7 +672,7 @@ function PersonFields({ person }: { readonly person: Person }): React.JSX.Elemen
|
|
|
672
672
|
* The companies this person holds a title at.
|
|
673
673
|
*
|
|
674
674
|
* Two requests, not one per position: `?person_id=` on both lists is exactly the
|
|
675
|
-
* filter `api.md` documents for this, and it exists so a detail page is not N+1.
|
|
675
|
+
* filter `docs/api-reference.md` documents for this, and it exists so a detail page is not N+1.
|
|
676
676
|
*/
|
|
677
677
|
function PersonPositions({ person }: { readonly person: Person }): React.JSX.Element {
|
|
678
678
|
const positions = usePositions({ personIds: [person.id] })
|
|
@@ -7,7 +7,7 @@ import { useVisibleNavItems } from '../../registry/visibleNav.ts'
|
|
|
7
7
|
/**
|
|
8
8
|
* Tabs across the account's own settings, from the mockup's `AccountNav`.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
10
|
+
* Five tabs are core's. The rest come from `nav.account`, which is
|
|
11
11
|
* where a module's own account page announces itself: a module route mounts as
|
|
12
12
|
* a sibling of `/account` rather than a child of it, so without this the page
|
|
13
13
|
* would render with no tab strip and nothing anywhere pointing at it.
|
|
@@ -21,6 +21,7 @@ const CORE_TABS: readonly NavItem[] = [
|
|
|
21
21
|
{ id: 'security', to: '/account/security', label: 'Security', order: 200 },
|
|
22
22
|
{ id: 'preferences', to: '/account/preferences', label: 'Preferences', order: 300 },
|
|
23
23
|
{ id: 'api-keys', to: '/account/api-keys', label: 'API keys', order: 400 },
|
|
24
|
+
{ id: 'connected-apps', to: '/account/connected-apps', label: 'Connected apps', order: 500 },
|
|
24
25
|
]
|
|
25
26
|
|
|
26
27
|
function tabClass({ isActive }: { isActive: boolean }): string {
|
|
@@ -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
|
+
}
|
|
@@ -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">
|
|
@@ -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>
|
|
@@ -257,15 +262,25 @@ function RegisteredAgents(): React.JSX.Element {
|
|
|
257
262
|
? 'Never run'
|
|
258
263
|
: `Last run ${formatRelativeTime(agent.lastRunAt, timezone)}`}
|
|
259
264
|
</span>
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
265
|
+
{agent.managedBy === null ? (
|
|
266
|
+
<button
|
|
267
|
+
type="button"
|
|
268
|
+
onClick={() => {
|
|
269
|
+
deleteAgent.run(agent.id)
|
|
270
|
+
}}
|
|
271
|
+
className="font-medium text-danger hover:underline"
|
|
272
|
+
>
|
|
273
|
+
Remove
|
|
274
|
+
</button>
|
|
275
|
+
) : agent.settingsPath === null ? (
|
|
276
|
+
// The API refuses to change a row a module owns, so there is
|
|
277
|
+
// no Remove to offer; the module's own settings manage it.
|
|
278
|
+
<span>Managed by a module</span>
|
|
279
|
+
) : (
|
|
280
|
+
<Link to={agent.settingsPath} className="font-medium text-accent hover:underline">
|
|
281
|
+
Manage in settings
|
|
282
|
+
</Link>
|
|
283
|
+
)}
|
|
269
284
|
</div>
|
|
270
285
|
</li>
|
|
271
286
|
))}
|
|
@@ -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
|
|
@@ -13,7 +13,7 @@ import { RegionSwitcher } from './RegionSwitcher.tsx'
|
|
|
13
13
|
* those steps: a session already exists on this origin.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
/** Onboarding, per `
|
|
16
|
+
/** Onboarding, per `docs/guides/getting-started.md`: workspace, organisation, modules, invites, handbook. */
|
|
17
17
|
const ONBOARDING_STEPS = [1, 2, 3, 4, 5] as const
|
|
18
18
|
|
|
19
19
|
export type OnboardingStep = (typeof ONBOARDING_STEPS)[number]
|
|
@@ -13,7 +13,7 @@ import { AuthMethods } from './AuthMethods.tsx'
|
|
|
13
13
|
/**
|
|
14
14
|
* Creating an account, against `POST /v1/auth/signup`.
|
|
15
15
|
*
|
|
16
|
-
* Signup makes the user and nothing else,
|
|
16
|
+
* Signup makes the user and nothing else, so success
|
|
17
17
|
* lands on the email-verification screen rather than in the app or the first
|
|
18
18
|
* onboarding step: the account cannot create a workspace until it verifies.
|
|
19
19
|
* The response sets the session cookie, which is why that next page can
|
|
@@ -18,7 +18,7 @@ import { formatDateTime } from '../../lib/dates.ts'
|
|
|
18
18
|
* rather than the forms list.
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
/**
|
|
21
|
+
/** `?limit=` maxes out at 200 (`docs/agents/api-and-webhooks.md`). */
|
|
22
22
|
const MAX_PAGE = 200
|
|
23
23
|
|
|
24
24
|
export function SubmissionDetail(): React.JSX.Element {
|
|
@@ -17,8 +17,9 @@ import { formatDateTime } from '../../lib/dates.ts'
|
|
|
17
17
|
* What has arrived through this form.
|
|
18
18
|
*
|
|
19
19
|
* Person and company names are joined client-side against one page each, the
|
|
20
|
-
* same way the Decisions page does it:
|
|
21
|
-
* neither list
|
|
20
|
+
* same way the Decisions page does it: the API has no include-expansion, and
|
|
21
|
+
* neither list filters on its own `?id=` (the repeatable id filters match a
|
|
22
|
+
* foreign key, not the record's id). A record past those pages is still
|
|
22
23
|
* linked, by its type rather than its name, which beats a raw id.
|
|
23
24
|
*
|
|
24
25
|
* A row opens `/forms/:id/submissions/:submissionId`. Inline person/company
|
|
@@ -26,7 +27,7 @@ import { formatDateTime } from '../../lib/dates.ts'
|
|
|
26
27
|
* also open the submission.
|
|
27
28
|
*/
|
|
28
29
|
|
|
29
|
-
/**
|
|
30
|
+
/** `?limit=` maxes out at 200 (`docs/agents/api-and-webhooks.md`). */
|
|
30
31
|
const MAX_PAGE = 200
|
|
31
32
|
|
|
32
33
|
export interface SubmissionsTableProps {
|
|
@@ -10,12 +10,12 @@ import { useRoles } from '../api/resources/roles.ts'
|
|
|
10
10
|
* The counts and names the hiring pages need beside their own records.
|
|
11
11
|
*
|
|
12
12
|
* A candidacy carries two ids and no words, so every page showing one needs a
|
|
13
|
-
* second resource to render it.
|
|
13
|
+
* second resource to render it. The API has no include-expansion; it has
|
|
14
14
|
* repeatable id filters, so each of these asks about exactly the rows on screen:
|
|
15
15
|
* one extra request for the page rather than one per row.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
/**
|
|
18
|
+
/** `?limit=` and an id filter both max out at 200 (`docs/agents/api-and-webhooks.md`). */
|
|
19
19
|
const MAX_PAGE = 200
|
|
20
20
|
|
|
21
21
|
export interface RoleCandidateCounts {
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { API_KEY_SCOPE_LABELS } from '@kelpie/schemas'
|
|
2
|
+
import type { ApiKeyScope, OAuthRequest } from '@kelpie/schemas'
|
|
3
|
+
import { useState } from 'react'
|
|
4
|
+
import { Link, Navigate, useParams } from 'react-router'
|
|
5
|
+
|
|
6
|
+
import { useApproveOAuthRequest, useDenyOAuthRequest, useOAuthRequest } from '../../api/resources/oauth.ts'
|
|
7
|
+
import { useSession } from '../../api/resources/session.ts'
|
|
8
|
+
import { ErrorPanel, LoadingPanel } from '../../components/QueryState.tsx'
|
|
9
|
+
import { AuthLayout } from '../auth/AuthLayout.tsx'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Where an MCP client sends a person to approve a connection:
|
|
13
|
+
* `/consent/:requestId`, reached by redirect from `/oauth/authorize`.
|
|
14
|
+
*
|
|
15
|
+
* Outside the session gate, like `/join`: a signed-out person is sent to sign
|
|
16
|
+
* in and brought back here, rather than landing on the dashboard with the
|
|
17
|
+
* request lost.
|
|
18
|
+
*
|
|
19
|
+
* The page shows the client's host as well as its name. A name is whatever the
|
|
20
|
+
* client registered; the host is where the browser will be sent, and is the
|
|
21
|
+
* part a person can check.
|
|
22
|
+
*/
|
|
23
|
+
export function ConsentPage(): React.JSX.Element {
|
|
24
|
+
const { requestId = '' } = useParams()
|
|
25
|
+
const { isLoading: sessionLoading, isSignedOut, error: sessionError } = useSession()
|
|
26
|
+
|
|
27
|
+
if (isSignedOut) {
|
|
28
|
+
return <Navigate to={`/login?next=${encodeURIComponent(`/consent/${requestId}`)}`} replace />
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (sessionError !== null) {
|
|
32
|
+
return (
|
|
33
|
+
<AuthLayout title="Connect an app">
|
|
34
|
+
<div className="mt-4">
|
|
35
|
+
<ErrorPanel error={sessionError} />
|
|
36
|
+
</div>
|
|
37
|
+
</AuthLayout>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (sessionLoading) {
|
|
42
|
+
return <LoadingPanel />
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return <ConsentForRequest requestId={requestId} />
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function ConsentForRequest({ requestId }: { readonly requestId: string }): React.JSX.Element {
|
|
49
|
+
const { request, isLoading, error } = useOAuthRequest(requestId)
|
|
50
|
+
|
|
51
|
+
if (error !== null) {
|
|
52
|
+
return (
|
|
53
|
+
<AuthLayout
|
|
54
|
+
title="This request is no longer valid"
|
|
55
|
+
description="It has expired, or it was already answered. Go back to the app and connect again."
|
|
56
|
+
>
|
|
57
|
+
<div className="mt-4">
|
|
58
|
+
<ErrorPanel error={error} />
|
|
59
|
+
</div>
|
|
60
|
+
</AuthLayout>
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (isLoading || request === undefined) {
|
|
65
|
+
return <LoadingPanel label="Loading the request…" />
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return <ConsentForm request={request} />
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function ConsentForm({ request }: { readonly request: OAuthRequest }): React.JSX.Element {
|
|
72
|
+
const approve = useApproveOAuthRequest()
|
|
73
|
+
const deny = useDenyOAuthRequest()
|
|
74
|
+
const [workspaceId, setWorkspaceId] = useState(request.workspaces[0]?.id ?? '')
|
|
75
|
+
const [scopes, setScopes] = useState<readonly ApiKeyScope[]>(request.scopes)
|
|
76
|
+
const [leaving, setLeaving] = useState(false)
|
|
77
|
+
const busy = approve.isPending || deny.isPending || leaving
|
|
78
|
+
|
|
79
|
+
function leaveTo(url: string): void {
|
|
80
|
+
// The redirect goes to the client, which may be another site or an app on
|
|
81
|
+
// this computer, so it is a full navigation and not a router one.
|
|
82
|
+
setLeaving(true)
|
|
83
|
+
window.location.assign(url)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function toggle(scope: ApiKeyScope): void {
|
|
87
|
+
setScopes((current) => (current.includes(scope) ? current.filter((entry) => entry !== scope) : [...current, scope]))
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (request.workspaces.length === 0) {
|
|
91
|
+
return (
|
|
92
|
+
<AuthLayout
|
|
93
|
+
title={`Connect ${request.clientName}`}
|
|
94
|
+
description="A connection is made to one workspace, and this account is not a member of any."
|
|
95
|
+
>
|
|
96
|
+
<p className="mt-4 text-[13px] text-ink-muted">
|
|
97
|
+
<Link to="/onboarding/workspace" className="text-accent hover:underline">
|
|
98
|
+
Create a workspace
|
|
99
|
+
</Link>
|
|
100
|
+
, then go back to the app and connect again.
|
|
101
|
+
</p>
|
|
102
|
+
</AuthLayout>
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (leaving) {
|
|
107
|
+
return (
|
|
108
|
+
<AuthLayout title="Returning to the app" description={`Sending you back to ${request.clientHost}.`}>
|
|
109
|
+
<p className="mt-4 text-[13px] text-ink-muted">You can close this tab if it does not move on.</p>
|
|
110
|
+
</AuthLayout>
|
|
111
|
+
)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return (
|
|
115
|
+
<AuthLayout
|
|
116
|
+
title={`Connect ${request.clientName}`}
|
|
117
|
+
description="This app wants to use Kelpie as you, through MCP."
|
|
118
|
+
footer={
|
|
119
|
+
<p className="text-[11px] text-ink-faint">
|
|
120
|
+
Remove the connection at any time under Account, Connected apps.
|
|
121
|
+
</p>
|
|
122
|
+
}
|
|
123
|
+
>
|
|
124
|
+
<div className="mt-5 space-y-4">
|
|
125
|
+
<div className="rounded-md border border-border bg-surface px-3 py-2.5">
|
|
126
|
+
<p className="text-[11px] font-medium tracking-wide text-ink-muted uppercase">Sends you back to</p>
|
|
127
|
+
<p className="mt-0.5 font-mono text-[13px] break-all text-ink">{request.clientHost}</p>
|
|
128
|
+
{request.clientUri !== null && (
|
|
129
|
+
<a
|
|
130
|
+
href={request.clientUri}
|
|
131
|
+
target="_blank"
|
|
132
|
+
rel="noreferrer"
|
|
133
|
+
className="mt-1 inline-block text-[12px] text-accent hover:underline"
|
|
134
|
+
>
|
|
135
|
+
About this app
|
|
136
|
+
</a>
|
|
137
|
+
)}
|
|
138
|
+
</div>
|
|
139
|
+
|
|
140
|
+
<label className="block">
|
|
141
|
+
<span className="mb-1.5 block text-[12px] font-medium text-ink">Workspace</span>
|
|
142
|
+
<select
|
|
143
|
+
value={workspaceId}
|
|
144
|
+
onChange={(event) => {
|
|
145
|
+
setWorkspaceId(event.target.value)
|
|
146
|
+
}}
|
|
147
|
+
className="w-full rounded-md border border-border bg-surface px-3 py-2 text-[13px] text-ink outline-none focus:border-accent"
|
|
148
|
+
>
|
|
149
|
+
{request.workspaces.map((workspace) => (
|
|
150
|
+
<option key={workspace.id} value={workspace.id}>
|
|
151
|
+
{workspace.name}
|
|
152
|
+
</option>
|
|
153
|
+
))}
|
|
154
|
+
</select>
|
|
155
|
+
<span className="mt-1 block text-[11px] text-ink-faint">
|
|
156
|
+
The app sees this workspace only. To use another, connect again.
|
|
157
|
+
</span>
|
|
158
|
+
</label>
|
|
159
|
+
|
|
160
|
+
<fieldset>
|
|
161
|
+
<legend className="mb-1.5 text-[12px] font-medium text-ink">Access</legend>
|
|
162
|
+
<div className="space-y-1.5">
|
|
163
|
+
{request.scopes.map((scope) => (
|
|
164
|
+
<label key={scope} className="flex items-center gap-2 text-[13px] text-ink">
|
|
165
|
+
<input
|
|
166
|
+
type="checkbox"
|
|
167
|
+
checked={scopes.includes(scope)}
|
|
168
|
+
onChange={() => {
|
|
169
|
+
toggle(scope)
|
|
170
|
+
}}
|
|
171
|
+
/>
|
|
172
|
+
{API_KEY_SCOPE_LABELS[scope]}
|
|
173
|
+
</label>
|
|
174
|
+
))}
|
|
175
|
+
</div>
|
|
176
|
+
<p className="mt-1.5 text-[11px] text-ink-faint">
|
|
177
|
+
The app can do no more than your own role allows. Clear an item to give less access.
|
|
178
|
+
</p>
|
|
179
|
+
</fieldset>
|
|
180
|
+
|
|
181
|
+
{approve.error !== null && <ErrorPanel error={approve.error} />}
|
|
182
|
+
{deny.error !== null && <ErrorPanel error={deny.error} />}
|
|
183
|
+
|
|
184
|
+
<div className="flex gap-2">
|
|
185
|
+
<button
|
|
186
|
+
type="button"
|
|
187
|
+
disabled={busy}
|
|
188
|
+
onClick={() => {
|
|
189
|
+
deny
|
|
190
|
+
.runAsync(request.id)
|
|
191
|
+
.then((decision) => {
|
|
192
|
+
leaveTo(decision.redirectUrl)
|
|
193
|
+
})
|
|
194
|
+
.catch(() => undefined)
|
|
195
|
+
}}
|
|
196
|
+
className="flex-1 rounded-md border border-border px-3.5 py-2 text-[12px] font-semibold text-ink transition hover:border-border-strong disabled:opacity-50"
|
|
197
|
+
>
|
|
198
|
+
Deny
|
|
199
|
+
</button>
|
|
200
|
+
<button
|
|
201
|
+
type="button"
|
|
202
|
+
disabled={busy || scopes.length === 0 || workspaceId.length === 0}
|
|
203
|
+
onClick={() => {
|
|
204
|
+
approve
|
|
205
|
+
.runAsync({ requestId: request.id, workspaceId, scopes })
|
|
206
|
+
.then((decision) => {
|
|
207
|
+
leaveTo(decision.redirectUrl)
|
|
208
|
+
})
|
|
209
|
+
.catch(() => undefined)
|
|
210
|
+
}}
|
|
211
|
+
className="flex-1 rounded-md bg-accent px-3.5 py-2 text-[12px] font-semibold text-accent-fg transition hover:bg-accent-hover disabled:opacity-50"
|
|
212
|
+
>
|
|
213
|
+
{approve.isPending ? 'Connecting…' : 'Allow'}
|
|
214
|
+
</button>
|
|
215
|
+
</div>
|
|
216
|
+
</div>
|
|
217
|
+
</AuthLayout>
|
|
218
|
+
)
|
|
219
|
+
}
|
|
@@ -18,7 +18,7 @@ import { isOnboardingRerun } from './onboardingRerun.ts'
|
|
|
18
18
|
* this because it sent nothing. Here a row carries its own outcome, a sent one
|
|
19
19
|
* is never sent twice, and the step only advances once nothing is outstanding.
|
|
20
20
|
*
|
|
21
|
-
* Skippable, per `
|
|
21
|
+
* Skippable, per `docs/guides/getting-started.md`. Admin → Team does the same job later.
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
interface InviteRow {
|
|
@@ -8,7 +8,7 @@ import type { OrganisationChoiceId } from './handbookTemplates.ts'
|
|
|
8
8
|
* what writes the first `workspace_module_settings` rows for these six.
|
|
9
9
|
*
|
|
10
10
|
* Labels stay the domain names. Defaults and explanations follow the
|
|
11
|
-
* organisation type chosen on the previous step (`
|
|
11
|
+
* organisation type chosen on the previous step (`docs/guides/getting-started.md`).
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
export type OnboardingModuleId =
|