@kelpie/ui 0.14.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 +34 -7
- 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/QueryState.js +7 -1
- package/dist/components/QueryState.js.map +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/dashboard/DashboardPage.d.ts.map +1 -1
- package/dist/pages/dashboard/DashboardPage.js +14 -1
- package/dist/pages/dashboard/DashboardPage.js.map +1 -1
- package/dist/pages/dashboard/sections.d.ts.map +1 -1
- package/dist/pages/dashboard/sections.js +12 -4
- 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/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 +39 -11
- 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/QueryState.tsx +8 -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/dashboard/DashboardPage.tsx +28 -0
- package/src/pages/dashboard/sections.tsx +36 -12
- 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
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import {
|
|
2
|
+
approveOAuthRequestBody,
|
|
3
|
+
oauthDecisionSchema,
|
|
4
|
+
oauthGrantSchema,
|
|
5
|
+
oauthRequestSchema,
|
|
6
|
+
} from '@kelpie/schemas'
|
|
7
|
+
import type { ApproveOAuthRequestInput, OAuthDecision, OAuthGrant, OAuthRequest } from '@kelpie/schemas'
|
|
8
|
+
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
|
|
9
|
+
|
|
10
|
+
import { useApiClient } from '../context.ts'
|
|
11
|
+
import { toError } from '../errors.ts'
|
|
12
|
+
import type { MutationResult } from '../resource.ts'
|
|
13
|
+
import { asMutationResult } from './mutation.ts'
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* `/v1/oauth`: the consent page an MCP client sends a person to, and the
|
|
17
|
+
* "Connected apps" list. Session only; the server refuses a bearer credential.
|
|
18
|
+
*
|
|
19
|
+
* Not workspace-scoped. A request asks which workspace to connect, and the
|
|
20
|
+
* list covers every workspace the person belongs to.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
const GRANTS_KEY = ['oauth', 'grants'] as const
|
|
24
|
+
|
|
25
|
+
function requestKey(id: string): readonly unknown[] {
|
|
26
|
+
return ['oauth', 'requests', id]
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface OAuthRequestState {
|
|
30
|
+
readonly request: OAuthRequest | undefined
|
|
31
|
+
readonly isLoading: boolean
|
|
32
|
+
readonly error: Error | null
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function useOAuthRequest(id: string): OAuthRequestState {
|
|
36
|
+
const client = useApiClient()
|
|
37
|
+
const result = useQuery({
|
|
38
|
+
queryKey: requestKey(id),
|
|
39
|
+
queryFn: () => client.get(`/oauth/requests/${id}`, oauthRequestSchema.parse),
|
|
40
|
+
// A request is answered once. Refetching after that would show "expired"
|
|
41
|
+
// over the page that is already on its way back to the client.
|
|
42
|
+
retry: false,
|
|
43
|
+
refetchOnWindowFocus: false,
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
request: result.data,
|
|
48
|
+
isLoading: result.isPending,
|
|
49
|
+
error: toError(result.error),
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface ApproveOAuthRequestVariables extends ApproveOAuthRequestInput {
|
|
54
|
+
readonly requestId: string
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function useApproveOAuthRequest(): MutationResult<ApproveOAuthRequestVariables, OAuthDecision> {
|
|
58
|
+
const client = useApiClient()
|
|
59
|
+
const queryClient = useQueryClient()
|
|
60
|
+
const mutation = useMutation({
|
|
61
|
+
mutationFn: ({ requestId, ...input }: ApproveOAuthRequestVariables) =>
|
|
62
|
+
client.post(`/oauth/requests/${requestId}/approve`, approveOAuthRequestBody(input), oauthDecisionSchema.parse),
|
|
63
|
+
onSuccess: async () => {
|
|
64
|
+
await queryClient.invalidateQueries({ queryKey: GRANTS_KEY })
|
|
65
|
+
},
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
return asMutationResult(mutation)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function useDenyOAuthRequest(): MutationResult<string, OAuthDecision> {
|
|
72
|
+
const client = useApiClient()
|
|
73
|
+
const mutation = useMutation({
|
|
74
|
+
mutationFn: (requestId: string) =>
|
|
75
|
+
client.post(`/oauth/requests/${requestId}/deny`, {}, oauthDecisionSchema.parse),
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
return asMutationResult(mutation)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface OAuthGrantsState {
|
|
82
|
+
readonly grants: readonly OAuthGrant[]
|
|
83
|
+
readonly isLoading: boolean
|
|
84
|
+
readonly error: Error | null
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export function useOAuthGrants(): OAuthGrantsState {
|
|
88
|
+
const client = useApiClient()
|
|
89
|
+
const result = useQuery({
|
|
90
|
+
queryKey: GRANTS_KEY,
|
|
91
|
+
queryFn: () => client.list('/oauth/grants', oauthGrantSchema.parse),
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
return {
|
|
95
|
+
grants: result.data?.items ?? [],
|
|
96
|
+
isLoading: result.isPending,
|
|
97
|
+
error: toError(result.error),
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export function useRevokeOAuthGrant(): MutationResult<string, void> {
|
|
102
|
+
const client = useApiClient()
|
|
103
|
+
const queryClient = useQueryClient()
|
|
104
|
+
const mutation = useMutation({
|
|
105
|
+
mutationFn: (id: string) => client.delete(`/oauth/grants/${id}`),
|
|
106
|
+
onSuccess: async () => {
|
|
107
|
+
await queryClient.invalidateQueries({ queryKey: GRANTS_KEY })
|
|
108
|
+
},
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
return asMutationResult(mutation)
|
|
112
|
+
}
|
|
@@ -31,7 +31,7 @@ const planItems = createResourceHooks<PlanItem, CreatePlanItemInput, PlanItemInp
|
|
|
31
31
|
updateBody: planItemBody,
|
|
32
32
|
})
|
|
33
33
|
|
|
34
|
-
/** The `?limit=` ceiling from `api.md`. A caller asking for a bounded set may ask for all of it. */
|
|
34
|
+
/** The `?limit=` ceiling from `docs/agents/api-and-webhooks.md`. A caller asking for a bounded set may ask for all of it. */
|
|
35
35
|
export const MAX_PAGE_SIZE = 200
|
|
36
36
|
|
|
37
37
|
export interface PlanItemFilters {
|
|
@@ -240,7 +240,7 @@ export function useAcceptInvite(): MutationResult<{ readonly token: string }, Wo
|
|
|
240
240
|
/**
|
|
241
241
|
* Creates the account's first workspace.
|
|
242
242
|
*
|
|
243
|
-
* Signup makes an account and nothing else
|
|
243
|
+
* Signup makes an account and nothing else, so without this a
|
|
244
244
|
* new account reaches the app and gets `403` from every CRM endpoint.
|
|
245
245
|
*/
|
|
246
246
|
export function useCreateWorkspace(): MutationResult<CreateWorkspaceInput, Workspace> {
|
package/src/app/KelpieApp.tsx
CHANGED
|
@@ -36,6 +36,7 @@ import { RaiseDetail } from '../pages/RaiseDetail.tsx'
|
|
|
36
36
|
import { RaiseStageSettingsPage } from '../pages/RaiseStageSettingsPage.tsx'
|
|
37
37
|
import { RoleDetail } from '../pages/RoleDetail.tsx'
|
|
38
38
|
import { AccountLayout } from '../pages/account/AccountLayout.tsx'
|
|
39
|
+
import { ConnectedAppsPage } from '../pages/account/ConnectedAppsPage.tsx'
|
|
39
40
|
import { PersonalApiKeysPage } from '../pages/account/PersonalApiKeysPage.tsx'
|
|
40
41
|
import { PreferencesPage } from '../pages/account/PreferencesPage.tsx'
|
|
41
42
|
import { ProfilePage } from '../pages/account/ProfilePage.tsx'
|
|
@@ -51,6 +52,7 @@ import { WebhooksPage } from '../pages/admin/WebhooksPage.tsx'
|
|
|
51
52
|
import { WorkspaceSettingsPage } from '../pages/admin/WorkspaceSettingsPage.tsx'
|
|
52
53
|
import { ForgotPasswordPage } from '../pages/auth/ForgotPasswordPage.tsx'
|
|
53
54
|
import { JoinPage } from '../pages/auth/JoinPage.tsx'
|
|
55
|
+
import { ConsentPage } from '../pages/oauth/ConsentPage.tsx'
|
|
54
56
|
import { ResetPasswordPage } from '../pages/auth/ResetPasswordPage.tsx'
|
|
55
57
|
import { SignInPage } from '../pages/auth/SignInPage.tsx'
|
|
56
58
|
import { SignUpPage } from '../pages/auth/SignUpPage.tsx'
|
|
@@ -137,6 +139,9 @@ function AppRoutes(): React.JSX.Element {
|
|
|
137
139
|
verification pages, all of which are what the gate sends an account
|
|
138
140
|
with no workspace to. */}
|
|
139
141
|
<Route path="/join" element={<JoinPage />} />
|
|
142
|
+
{/* An MCP client's OAuth consent. Handles its own sign-in redirect, as
|
|
143
|
+
/join does, so the request survives it. */}
|
|
144
|
+
<Route path="/consent/:requestId" element={<ConsentPage />} />
|
|
140
145
|
<Route path="/onboarding/workspace" element={<WorkspaceStepPage />} />
|
|
141
146
|
<Route path="/verify-email" element={<VerifyEmailConfirmPage />} />
|
|
142
147
|
<Route path="/verify-email/pending" element={<VerifyEmailPendingPage />} />
|
|
@@ -205,6 +210,7 @@ function AppRoutes(): React.JSX.Element {
|
|
|
205
210
|
<Route path="security" element={<SecurityPage />} />
|
|
206
211
|
<Route path="preferences" element={<PreferencesPage />} />
|
|
207
212
|
<Route path="api-keys" element={<PersonalApiKeysPage />} />
|
|
213
|
+
<Route path="connected-apps" element={<ConnectedAppsPage />} />
|
|
208
214
|
{accountRoutes.map((route) => (
|
|
209
215
|
<Route
|
|
210
216
|
key={route.path}
|
|
@@ -13,6 +13,7 @@ import type { FormEvent } from 'react'
|
|
|
13
13
|
import { useTimezone } from '../api/resources/account.ts'
|
|
14
14
|
import { useApiKeys, useCreateApiKey, useRevokeApiKey } from '../api/resources/apiKeys.ts'
|
|
15
15
|
import { formatDate } from '../lib/dates.ts'
|
|
16
|
+
import { mcpClientConfig, mcpEndpoint } from '../lib/mcpConfig.ts'
|
|
16
17
|
import { CopyButton } from './CopyButton.tsx'
|
|
17
18
|
import { ErrorPanel, LoadingPanel } from './QueryState.tsx'
|
|
18
19
|
|
|
@@ -346,6 +347,9 @@ function SecretOnce({
|
|
|
346
347
|
readonly apiKey: CreatedApiKey
|
|
347
348
|
readonly onDismiss: () => void
|
|
348
349
|
}): React.JSX.Element {
|
|
350
|
+
const endpoint = mcpEndpoint()
|
|
351
|
+
const config = mcpClientConfig(endpoint, apiKey.secret)
|
|
352
|
+
|
|
349
353
|
return (
|
|
350
354
|
<div className="rounded-md border border-accent/40 bg-accent-soft px-4 py-3">
|
|
351
355
|
<div className="flex items-start justify-between gap-3">
|
|
@@ -357,6 +361,19 @@ function SecretOnce({
|
|
|
357
361
|
</div>
|
|
358
362
|
<CopyButton value={apiKey.secret} label="Copy the API key" />
|
|
359
363
|
</div>
|
|
364
|
+
<div className="mt-4 flex items-start justify-between gap-3">
|
|
365
|
+
<div className="min-w-0 flex-1">
|
|
366
|
+
<p className="text-[13px] font-medium text-ink">MCP client config</p>
|
|
367
|
+
<p className="mt-0.5 text-[12px] text-ink-muted">
|
|
368
|
+
Paste into Claude, Cursor, or any MCP client. It connects to{' '}
|
|
369
|
+
<code className="font-mono text-[12px] break-all">{endpoint}</code> with this key.
|
|
370
|
+
</p>
|
|
371
|
+
<pre className="bg-code-bg text-code-fg mt-2 overflow-x-auto rounded border border-border p-3 font-mono text-[12px] leading-relaxed">
|
|
372
|
+
{config}
|
|
373
|
+
</pre>
|
|
374
|
+
</div>
|
|
375
|
+
<CopyButton value={config} label="Copy the MCP client config" />
|
|
376
|
+
</div>
|
|
360
377
|
<button
|
|
361
378
|
type="button"
|
|
362
379
|
onClick={onDismiss}
|
|
@@ -3,7 +3,7 @@ import type { Paged } from '../api/resource.ts'
|
|
|
3
3
|
/**
|
|
4
4
|
* Prev / Next with a page indicator and an optional page size selector.
|
|
5
5
|
*
|
|
6
|
-
* The API is cursor-only
|
|
6
|
+
* The API is cursor-only, so there is no total count and no jump
|
|
7
7
|
* to page N. `pageIndex` is one-based on screen but zero-based in `Paged` —
|
|
8
8
|
* the label adds one so page 1 does not read as page 0.
|
|
9
9
|
*
|
|
@@ -72,7 +72,14 @@ export function ErrorPanel({ error, onRetry }: ErrorPanelProps): React.JSX.Eleme
|
|
|
72
72
|
|
|
73
73
|
function describe(error: Error): string {
|
|
74
74
|
if (!(error instanceof ApiError)) {
|
|
75
|
-
|
|
75
|
+
// A non-`ApiError` here is a decoder throwing on an unexpected shape, or a
|
|
76
|
+
// programmer error. Neither is actionable, so name the class of failure and
|
|
77
|
+
// keep the raw message out of the UI.
|
|
78
|
+
return 'The response could not be read. Reload the page, or check the service logs.'
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (error.code === 'service_unreachable') {
|
|
82
|
+
return error.message
|
|
76
83
|
}
|
|
77
84
|
|
|
78
85
|
if (error.status === 403) {
|
package/src/components/Shell.tsx
CHANGED
|
@@ -52,7 +52,7 @@ const CORE_NAV: readonly NavItem[] = [
|
|
|
52
52
|
]
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
|
-
* `nav.primary` is one flat slot
|
|
55
|
+
* `nav.primary` is one flat slot; the shell renders it as visual
|
|
56
56
|
* groups: an unheaded top section, an unheaded directory pair (People,
|
|
57
57
|
* Companies), a headed "CRM" section for pipeline objects, then a headed
|
|
58
58
|
* "Tools" section for Lists and Forms. Presentation only — it stays here rather
|
|
@@ -9,7 +9,7 @@ export interface SummaryBlockProps {
|
|
|
9
9
|
* The agent-facing summary, at the top of a record's overview.
|
|
10
10
|
*
|
|
11
11
|
* It sits above everything else because it is the field an agent reads first;
|
|
12
|
-
*
|
|
12
|
+
* it is a record field rather than something buried in notes.
|
|
13
13
|
*/
|
|
14
14
|
export function SummaryBlock({ value, onChange }: SummaryBlockProps): React.JSX.Element {
|
|
15
15
|
return (
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How an MCP client reaches this workspace.
|
|
3
|
+
*
|
|
4
|
+
* The endpoint comes from the origin the browser reached the app on, so it is
|
|
5
|
+
* right for a self-hosted install on any hostname. The MCP page shows the config
|
|
6
|
+
* with a placeholder token; a freshly minted API key shows it with the real one.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export function mcpEndpoint(): string {
|
|
10
|
+
return new URL('/mcp', window.location.origin).toString()
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function mcpClientConfig(endpoint: string, bearerToken: string): string {
|
|
14
|
+
return `{
|
|
15
|
+
"mcpServers": {
|
|
16
|
+
"kelpie": {
|
|
17
|
+
"url": "${endpoint}",
|
|
18
|
+
"headers": {
|
|
19
|
+
"Authorization": "Bearer ${bearerToken}"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}`
|
|
24
|
+
}
|
package/src/lib/money.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* How the app writes a deal's value.
|
|
3
|
-
* an ISO 4217 code; the board and the sidebar both render whole units, as the
|
|
2
|
+
* How the app writes a deal's value. The API stores money as integer cents plus
|
|
3
|
+
* an ISO 4217 code (`docs/agents/api-and-webhooks.md`); the board and the sidebar both render whole units, as the
|
|
4
4
|
* mockup did.
|
|
5
5
|
*/
|
|
6
6
|
export function formatMoney(valueCents: number, currency: string | null): string {
|
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]
|