@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
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { API_KEY_SCOPE_LABELS } from '@kelpie/schemas';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { Link, Navigate, useParams } from 'react-router';
|
|
5
|
+
import { useApproveOAuthRequest, useDenyOAuthRequest, useOAuthRequest } from '../../api/resources/oauth.js';
|
|
6
|
+
import { useSession } from '../../api/resources/session.js';
|
|
7
|
+
import { ErrorPanel, LoadingPanel } from '../../components/QueryState.js';
|
|
8
|
+
import { AuthLayout } from '../auth/AuthLayout.js';
|
|
9
|
+
/**
|
|
10
|
+
* Where an MCP client sends a person to approve a connection:
|
|
11
|
+
* `/consent/:requestId`, reached by redirect from `/oauth/authorize`.
|
|
12
|
+
*
|
|
13
|
+
* Outside the session gate, like `/join`: a signed-out person is sent to sign
|
|
14
|
+
* in and brought back here, rather than landing on the dashboard with the
|
|
15
|
+
* request lost.
|
|
16
|
+
*
|
|
17
|
+
* The page shows the client's host as well as its name. A name is whatever the
|
|
18
|
+
* client registered; the host is where the browser will be sent, and is the
|
|
19
|
+
* part a person can check.
|
|
20
|
+
*/
|
|
21
|
+
export function ConsentPage() {
|
|
22
|
+
const { requestId = '' } = useParams();
|
|
23
|
+
const { isLoading: sessionLoading, isSignedOut, error: sessionError } = useSession();
|
|
24
|
+
if (isSignedOut) {
|
|
25
|
+
return _jsx(Navigate, { to: `/login?next=${encodeURIComponent(`/consent/${requestId}`)}`, replace: true });
|
|
26
|
+
}
|
|
27
|
+
if (sessionError !== null) {
|
|
28
|
+
return (_jsx(AuthLayout, { title: "Connect an app", children: _jsx("div", { className: "mt-4", children: _jsx(ErrorPanel, { error: sessionError }) }) }));
|
|
29
|
+
}
|
|
30
|
+
if (sessionLoading) {
|
|
31
|
+
return _jsx(LoadingPanel, {});
|
|
32
|
+
}
|
|
33
|
+
return _jsx(ConsentForRequest, { requestId: requestId });
|
|
34
|
+
}
|
|
35
|
+
function ConsentForRequest({ requestId }) {
|
|
36
|
+
const { request, isLoading, error } = useOAuthRequest(requestId);
|
|
37
|
+
if (error !== null) {
|
|
38
|
+
return (_jsx(AuthLayout, { title: "This request is no longer valid", description: "It has expired, or it was already answered. Go back to the app and connect again.", children: _jsx("div", { className: "mt-4", children: _jsx(ErrorPanel, { error: error }) }) }));
|
|
39
|
+
}
|
|
40
|
+
if (isLoading || request === undefined) {
|
|
41
|
+
return _jsx(LoadingPanel, { label: "Loading the request\u2026" });
|
|
42
|
+
}
|
|
43
|
+
return _jsx(ConsentForm, { request: request });
|
|
44
|
+
}
|
|
45
|
+
function ConsentForm({ request }) {
|
|
46
|
+
const approve = useApproveOAuthRequest();
|
|
47
|
+
const deny = useDenyOAuthRequest();
|
|
48
|
+
const [workspaceId, setWorkspaceId] = useState(request.workspaces[0]?.id ?? '');
|
|
49
|
+
const [scopes, setScopes] = useState(request.scopes);
|
|
50
|
+
const [leaving, setLeaving] = useState(false);
|
|
51
|
+
const busy = approve.isPending || deny.isPending || leaving;
|
|
52
|
+
function leaveTo(url) {
|
|
53
|
+
// The redirect goes to the client, which may be another site or an app on
|
|
54
|
+
// this computer, so it is a full navigation and not a router one.
|
|
55
|
+
setLeaving(true);
|
|
56
|
+
window.location.assign(url);
|
|
57
|
+
}
|
|
58
|
+
function toggle(scope) {
|
|
59
|
+
setScopes((current) => (current.includes(scope) ? current.filter((entry) => entry !== scope) : [...current, scope]));
|
|
60
|
+
}
|
|
61
|
+
if (request.workspaces.length === 0) {
|
|
62
|
+
return (_jsx(AuthLayout, { title: `Connect ${request.clientName}`, description: "A connection is made to one workspace, and this account is not a member of any.", children: _jsxs("p", { className: "mt-4 text-[13px] text-ink-muted", children: [_jsx(Link, { to: "/onboarding/workspace", className: "text-accent hover:underline", children: "Create a workspace" }), ", then go back to the app and connect again."] }) }));
|
|
63
|
+
}
|
|
64
|
+
if (leaving) {
|
|
65
|
+
return (_jsx(AuthLayout, { title: "Returning to the app", description: `Sending you back to ${request.clientHost}.`, children: _jsx("p", { className: "mt-4 text-[13px] text-ink-muted", children: "You can close this tab if it does not move on." }) }));
|
|
66
|
+
}
|
|
67
|
+
return (_jsx(AuthLayout, { title: `Connect ${request.clientName}`, description: "This app wants to use Kelpie as you, through MCP.", footer: _jsx("p", { className: "text-[11px] text-ink-faint", children: "Remove the connection at any time under Account, Connected apps." }), children: _jsxs("div", { className: "mt-5 space-y-4", children: [_jsxs("div", { className: "rounded-md border border-border bg-surface px-3 py-2.5", children: [_jsx("p", { className: "text-[11px] font-medium tracking-wide text-ink-muted uppercase", children: "Sends you back to" }), _jsx("p", { className: "mt-0.5 font-mono text-[13px] break-all text-ink", children: request.clientHost }), request.clientUri !== null && (_jsx("a", { href: request.clientUri, target: "_blank", rel: "noreferrer", className: "mt-1 inline-block text-[12px] text-accent hover:underline", children: "About this app" }))] }), _jsxs("label", { className: "block", children: [_jsx("span", { className: "mb-1.5 block text-[12px] font-medium text-ink", children: "Workspace" }), _jsx("select", { value: workspaceId, onChange: (event) => {
|
|
68
|
+
setWorkspaceId(event.target.value);
|
|
69
|
+
}, className: "w-full rounded-md border border-border bg-surface px-3 py-2 text-[13px] text-ink outline-none focus:border-accent", children: request.workspaces.map((workspace) => (_jsx("option", { value: workspace.id, children: workspace.name }, workspace.id))) }), _jsx("span", { className: "mt-1 block text-[11px] text-ink-faint", children: "The app sees this workspace only. To use another, connect again." })] }), _jsxs("fieldset", { children: [_jsx("legend", { className: "mb-1.5 text-[12px] font-medium text-ink", children: "Access" }), _jsx("div", { className: "space-y-1.5", children: request.scopes.map((scope) => (_jsxs("label", { className: "flex items-center gap-2 text-[13px] text-ink", children: [_jsx("input", { type: "checkbox", checked: scopes.includes(scope), onChange: () => {
|
|
70
|
+
toggle(scope);
|
|
71
|
+
} }), API_KEY_SCOPE_LABELS[scope]] }, scope))) }), _jsx("p", { className: "mt-1.5 text-[11px] text-ink-faint", children: "The app can do no more than your own role allows. Clear an item to give less access." })] }), approve.error !== null && _jsx(ErrorPanel, { error: approve.error }), deny.error !== null && _jsx(ErrorPanel, { error: deny.error }), _jsxs("div", { className: "flex gap-2", children: [_jsx("button", { type: "button", disabled: busy, onClick: () => {
|
|
72
|
+
deny
|
|
73
|
+
.runAsync(request.id)
|
|
74
|
+
.then((decision) => {
|
|
75
|
+
leaveTo(decision.redirectUrl);
|
|
76
|
+
})
|
|
77
|
+
.catch(() => undefined);
|
|
78
|
+
}, 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", children: "Deny" }), _jsx("button", { type: "button", disabled: busy || scopes.length === 0 || workspaceId.length === 0, onClick: () => {
|
|
79
|
+
approve
|
|
80
|
+
.runAsync({ requestId: request.id, workspaceId, scopes })
|
|
81
|
+
.then((decision) => {
|
|
82
|
+
leaveTo(decision.redirectUrl);
|
|
83
|
+
})
|
|
84
|
+
.catch(() => undefined);
|
|
85
|
+
}, 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", children: approve.isPending ? 'Connecting…' : 'Allow' })] })] }) }));
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=ConsentPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConsentPage.js","sourceRoot":"","sources":["../../../src/pages/oauth/ConsentPage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAEtD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChC,OAAO,EAAE,IAAI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E,CAAC;qCACpB,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;oCACjB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAA;gCAC/B,CAAC,CAAC;qCACD,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAA;4BAC3B,CAAC,EACD,SAAS,EAAC,iJAAiJ,qBAGpJ,EACT,iBACE,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,IAAI,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EACjE,OAAO,EAAE,GAAG,EAAE;gCACZ,OAAO;qCACJ,QAAQ,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC;qCACxD,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;oCACjB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAA;gCAC/B,CAAC,CAAC;qCACD,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAA;4BAC3B,CAAC,EACD,SAAS,EAAC,uIAAuI,YAEhJ,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,GACrC,IACL,IACF,GACK,CACd,CAAA;AACH,CAAC"}
|
|
@@ -7,7 +7,7 @@ import type { OrganisationChoiceId } from './handbookTemplates.ts';
|
|
|
7
7
|
* what writes the first `workspace_module_settings` rows for these six.
|
|
8
8
|
*
|
|
9
9
|
* Labels stay the domain names. Defaults and explanations follow the
|
|
10
|
-
* organisation type chosen on the previous step (`
|
|
10
|
+
* organisation type chosen on the previous step (`docs/guides/getting-started.md`).
|
|
11
11
|
*/
|
|
12
12
|
export type OnboardingModuleId = 'deals' | 'opportunities' | 'raises' | 'partnerships' | 'events' | 'forms';
|
|
13
13
|
export interface OnboardingModuleChoice {
|
|
@@ -15,7 +15,7 @@ export declare function isOnboardingRerun(searchParams: URLSearchParams): boolea
|
|
|
15
15
|
/**
|
|
16
16
|
* Keep the rerun flag and the organisation type when moving between onboarding
|
|
17
17
|
* routes. `org` is how the modules step knows which defaults to offer; nothing
|
|
18
|
-
* else is held in the browser
|
|
18
|
+
* else is held in the browser.
|
|
19
19
|
*/
|
|
20
20
|
export declare function onboardingPath(path: string, rerun: boolean, org?: string | null): string;
|
|
21
21
|
//# sourceMappingURL=onboardingRerun.d.ts.map
|
|
@@ -17,7 +17,7 @@ export function isOnboardingRerun(searchParams) {
|
|
|
17
17
|
/**
|
|
18
18
|
* Keep the rerun flag and the organisation type when moving between onboarding
|
|
19
19
|
* routes. `org` is how the modules step knows which defaults to offer; nothing
|
|
20
|
-
* else is held in the browser
|
|
20
|
+
* else is held in the browser.
|
|
21
21
|
*/
|
|
22
22
|
export function onboardingPath(path, rerun, org) {
|
|
23
23
|
const params = new URLSearchParams();
|
|
@@ -5,7 +5,7 @@ import { usePositions } from '../api/resources/positions.js';
|
|
|
5
5
|
* Titles and company names for the people on screen, and head counts for the
|
|
6
6
|
* companies on screen.
|
|
7
7
|
*
|
|
8
|
-
* A list row needs data from three resources, and
|
|
8
|
+
* A list row needs data from three resources, and the API has no
|
|
9
9
|
* include-expansion. What it does have is repeatable id filters, so each of
|
|
10
10
|
* these asks about exactly the rows the page is rendering: two extra requests
|
|
11
11
|
* for the page, not one per row, and no cap that a real workspace could grow
|
|
@@ -15,7 +15,7 @@ import { usePositions } from '../api/resources/positions.js';
|
|
|
15
15
|
* omitted would answer with every record in the workspace, which is the wrong
|
|
16
16
|
* answer rather than a slow one.
|
|
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
|
export function usePeopleDirectory(personIds) {
|
|
21
21
|
const enabled = personIds.length > 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"positionDirectory.js","sourceRoot":"","sources":["../../src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c,GAAG,OAAO,CAAC,GAAG,EAAE;QAClC,MAAM,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAA;QAExC,KAAK,MAAM,QAAQ,IAAI,SAAS,CAAC,OAAO,EAAE,CAAC;YACzC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;QAC3E,CAAC;QAED,OAAO,MAAM,CAAA;IACf,CAAC,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IAEvB,OAAO;QACL,QAAQ,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC;QAC3D,SAAS,EAAE,SAAS,CAAC,SAAS;QAC9B,UAAU,EAAE,CAAC,SAAS,CAAC,OAAO;KAC/B,CAAA;AACH,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ExtensibleRecordType } from '@kelpie/schemas';
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
3
|
/**
|
|
4
|
-
* What a UI module may add to the shell
|
|
4
|
+
* What a UI module may add to the shell.
|
|
5
5
|
*
|
|
6
6
|
* Every slot renders nothing when empty. A core page has to look finished with
|
|
7
7
|
* no modules loaded at all, because the open-source assembly is exactly that.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* What a UI module may add to the shell
|
|
2
|
+
* What a UI module may add to the shell.
|
|
3
3
|
*
|
|
4
4
|
* Every slot renders nothing when empty. A core page has to look finished with
|
|
5
5
|
* no modules loaded at all, because the open-source assembly is exactly that.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ComponentType } from 'react';
|
|
2
2
|
/**
|
|
3
|
-
* The override escape hatch
|
|
3
|
+
* The override escape hatch: a module replaces a core
|
|
4
4
|
* component outright. Prefer a slot; this is for the cases a slot cannot reach.
|
|
5
5
|
*
|
|
6
6
|
* A core component is replaceable only if it hands out a token, and the token
|
|
@@ -2,7 +2,7 @@ import type { ComponentType } from 'react';
|
|
|
2
2
|
import type { AuthMethod, DashboardCard, ExtensibleRecordType, NavItem, NavSlot, RecordSidebarCard, RecordTab, RouteContribution } from './contributions.ts';
|
|
3
3
|
import type { Overridable } from './overridable.ts';
|
|
4
4
|
/**
|
|
5
|
-
* The build-time UI extension registry
|
|
5
|
+
* The build-time UI extension registry.
|
|
6
6
|
*
|
|
7
7
|
* Composition is build-time, like the server runtime: an assembly lists its UI
|
|
8
8
|
* modules and this collects what they contribute. Nothing is loaded at runtime,
|
|
@@ -21,7 +21,7 @@ export interface UiModuleContext {
|
|
|
21
21
|
dashboardCard(card: DashboardCard): void;
|
|
22
22
|
/** Another way to sign in, rendered beside the password form on `/login` and `/signup`. */
|
|
23
23
|
authMethod(method: AuthMethod): void;
|
|
24
|
-
/** Replaces a core component. Prefer a slot
|
|
24
|
+
/** Replaces a core component. Prefer a slot. */
|
|
25
25
|
override<Props>(token: Overridable<Props>, component: ComponentType<Props>): void;
|
|
26
26
|
}
|
|
27
27
|
export interface UiModule {
|
|
@@ -63,7 +63,7 @@ export declare function registerUiModules(modules: readonly UiModule[]): UiExten
|
|
|
63
63
|
* tree without a provider sees.
|
|
64
64
|
*
|
|
65
65
|
* Every slot is empty and every overridable renders its core fallback, which is
|
|
66
|
-
* the state
|
|
66
|
+
* the state core pages are required to look finished in.
|
|
67
67
|
*/
|
|
68
68
|
export declare const NO_UI_MODULES: UiExtensions;
|
|
69
69
|
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/registry/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAE1C,OAAO,KAAK,EACV,UAAU,EACV,aAAa,EACb,oBAAoB,EACpB,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wED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,SAAS,QAAQ,EAAE,GAAG,YAAY,CAgC5E;AAED;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,EAAE,YAAoC,CAAA"}
|
|
@@ -106,7 +106,7 @@ export function registerUiModules(modules) {
|
|
|
106
106
|
* tree without a provider sees.
|
|
107
107
|
*
|
|
108
108
|
* Every slot is empty and every overridable renders its core fallback, which is
|
|
109
|
-
* the state
|
|
109
|
+
* the state core pages are required to look finished in.
|
|
110
110
|
*/
|
|
111
111
|
export const NO_UI_MODULES = registerUiModules([]);
|
|
112
112
|
//# sourceMappingURL=registry.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kelpie/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "React UI for Kelpie: components, pages, API client, and the extension registry an assembly composes modules through.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"kelpie",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@dnd-kit/core": "^6.3.1",
|
|
49
49
|
"@dnd-kit/sortable": "^10.0.0",
|
|
50
50
|
"@dnd-kit/utilities": "^3.2.2",
|
|
51
|
-
"@kelpie/schemas": "^0.
|
|
51
|
+
"@kelpie/schemas": "^0.16.0",
|
|
52
52
|
"@tanstack/react-query": "^5.101.4",
|
|
53
53
|
"react-markdown": "^10.1.0",
|
|
54
54
|
"react-router": "^8.3.0",
|
package/src/api/client.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Client for the public `/v1` API. The UI is one more API consumer, exactly like
|
|
3
|
-
* an agent, so this file encodes only what
|
|
3
|
+
* an agent, so this file encodes only what the API documents: the list envelope,
|
|
4
4
|
* the error shape, and the write verbs.
|
|
5
5
|
*
|
|
6
6
|
* Responses are untrusted input. Every method takes a `Decoder` and returns what
|
|
@@ -40,7 +40,7 @@ export class ApiError extends Error {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
/** A cursor page: `{ data, next_cursor }` from `api.md`. */
|
|
43
|
+
/** A cursor page: `{ data, next_cursor }` from `docs/agents/api-and-webhooks.md`. */
|
|
44
44
|
export interface Page<T> {
|
|
45
45
|
readonly items: readonly T[]
|
|
46
46
|
readonly nextCursor: string | null
|
|
@@ -48,7 +48,8 @@ export interface Page<T> {
|
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
50
|
* Query string values. An array becomes a repeated parameter, which is how
|
|
51
|
-
*
|
|
51
|
+
* the API names a set of ids: `?person_id=per_1&person_id=per_2`
|
|
52
|
+
* (`docs/agents/api-and-webhooks.md`).
|
|
52
53
|
*/
|
|
53
54
|
export type QueryParameters = Readonly<
|
|
54
55
|
Record<string, string | number | boolean | readonly string[] | undefined>
|
|
@@ -78,7 +79,7 @@ export interface ApiClient {
|
|
|
78
79
|
*/
|
|
79
80
|
postForm<T>(path: string, form: FormData, decode: Decoder<T>): Promise<T>
|
|
80
81
|
/**
|
|
81
|
-
* A `POST` whose success carries no body.
|
|
82
|
+
* A `POST` whose success carries no body. Resource writes return
|
|
82
83
|
* the resulting object, but the session endpoints have nothing to return:
|
|
83
84
|
* logout answers `204`, and a password reset request answers `202`.
|
|
84
85
|
*/
|
|
@@ -287,7 +288,7 @@ export function createApiClient(options: ApiClientOptions): ApiClient {
|
|
|
287
288
|
delete: async (path, query) => {
|
|
288
289
|
const response = await request('DELETE', buildUrl(options.baseUrl, path, query))
|
|
289
290
|
|
|
290
|
-
// Stricter than `response.ok`:
|
|
291
|
+
// Stricter than `response.ok`: a successful delete is `204`,
|
|
291
292
|
// and anything else means the server is not doing what it documents.
|
|
292
293
|
if (response.status !== 204) {
|
|
293
294
|
throw await readEmptyError(response)
|
package/src/api/resource.ts
CHANGED
|
@@ -28,7 +28,7 @@ import { toError } from './errors.ts'
|
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* The default page size when a caller does not name one via `query.limit`.
|
|
31
|
-
* Matches the `/v1` default
|
|
31
|
+
* Matches the `/v1` default.
|
|
32
32
|
*/
|
|
33
33
|
export const DEFAULT_PAGE_SIZE = 50
|
|
34
34
|
|
|
@@ -50,7 +50,7 @@ export interface Paged {
|
|
|
50
50
|
readonly nextPage: () => void
|
|
51
51
|
/**
|
|
52
52
|
* Changes the API `?limit=` and returns the reader to page 1. The API caps
|
|
53
|
-
* `?limit=` at 200 (`api.md`); a larger value is coerced by the server, not
|
|
53
|
+
* `?limit=` at 200 (`docs/agents/api-and-webhooks.md`); a larger value is coerced by the server, not
|
|
54
54
|
* refused by this hook.
|
|
55
55
|
*/
|
|
56
56
|
readonly setPageSize: (size: number) => void
|
|
@@ -70,7 +70,7 @@ export interface RecordResult<TRecord> {
|
|
|
70
70
|
readonly record: TRecord | undefined
|
|
71
71
|
readonly isLoading: boolean
|
|
72
72
|
readonly error: Error | null
|
|
73
|
-
/** The record is not in this workspace, which
|
|
73
|
+
/** The record is not in this workspace, which the API makes indistinguishable from not existing. */
|
|
74
74
|
readonly isNotFound: boolean
|
|
75
75
|
}
|
|
76
76
|
|
|
@@ -160,9 +160,8 @@ function keysFor(name: string): ResourceKeys {
|
|
|
160
160
|
/**
|
|
161
161
|
* Applies a partial update to a record.
|
|
162
162
|
*
|
|
163
|
-
* `undefined` means "not sent" and `null` means "clear this field",
|
|
164
|
-
*
|
|
165
|
-
* overwrite it.
|
|
163
|
+
* `undefined` means "not sent" and `null` means "clear this field", so an
|
|
164
|
+
* undefined value must leave the existing one alone rather than overwrite it.
|
|
166
165
|
*/
|
|
167
166
|
function mergeDefined<TRecord extends object>(record: TRecord, changes: Partial<TRecord>): TRecord {
|
|
168
167
|
const merged = { ...record }
|
|
@@ -235,7 +234,7 @@ export interface PagedListInput<TRecord> {
|
|
|
235
234
|
* and the three custom collections whose paths carry a parent id
|
|
236
235
|
* (`useFormSubmissions`, `useListMembers`, `useWebhookDeliveries`).
|
|
237
236
|
*
|
|
238
|
-
* The API is cursor-only
|
|
237
|
+
* The API is cursor-only, so pages are fetched forward. Already
|
|
239
238
|
* fetched pages stay cached in `useInfiniteQuery`, and `pageIndex` selects
|
|
240
239
|
* which one is on screen — so going back to a visited page is instant and
|
|
241
240
|
* going forward past the fetched set kicks off exactly one new request.
|
|
@@ -15,8 +15,8 @@ import { useSession } from './session.ts'
|
|
|
15
15
|
* endpoint answers the whole team in one page rather than a cursor list.
|
|
16
16
|
*
|
|
17
17
|
* Notes carry an `author_id` and activities an `actor_member_id`, both workspace
|
|
18
|
-
* member ids.
|
|
19
|
-
* against this list. One request per page, not one per row.
|
|
18
|
+
* member ids. The API has no include-expansion (`docs/api-reference.md`), so
|
|
19
|
+
* the panel showing them joins against this list. One request per page, not one per row.
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
22
|
export interface MemberDirectory {
|
|
@@ -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
|
*
|
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 {
|