@kelpie/ui 0.22.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/resource.d.ts +12 -0
- package/dist/api/resource.d.ts.map +1 -1
- package/dist/api/resource.js +11 -0
- package/dist/api/resource.js.map +1 -1
- package/dist/api/resources/decisions.d.ts +31 -0
- package/dist/api/resources/decisions.d.ts.map +1 -1
- package/dist/api/resources/decisions.js +51 -1
- package/dist/api/resources/decisions.js.map +1 -1
- package/dist/api/resources/oauth.d.ts +2 -0
- package/dist/api/resources/oauth.d.ts.map +1 -1
- package/dist/api/resources/oauth.js +13 -1
- package/dist/api/resources/oauth.js.map +1 -1
- package/dist/api/resources/personIntake.d.ts +15 -3
- package/dist/api/resources/personIntake.d.ts.map +1 -1
- package/dist/api/resources/personIntake.js +38 -9
- package/dist/api/resources/personIntake.js.map +1 -1
- package/dist/api/resources/session.d.ts.map +1 -1
- package/dist/api/resources/session.js +4 -0
- package/dist/api/resources/session.js.map +1 -1
- package/dist/app/KelpieApp.d.ts.map +1 -1
- package/dist/app/KelpieApp.js +2 -1
- package/dist/app/KelpieApp.js.map +1 -1
- package/dist/components/AddRecordPanel.d.ts +35 -0
- package/dist/components/AddRecordPanel.d.ts.map +1 -0
- package/dist/components/AddRecordPanel.js +35 -0
- package/dist/components/AddRecordPanel.js.map +1 -0
- package/dist/components/AiDrawer.d.ts.map +1 -1
- package/dist/components/AiDrawer.js +29 -6
- package/dist/components/AiDrawer.js.map +1 -1
- package/dist/components/ApiKeysPanel.d.ts.map +1 -1
- package/dist/components/ApiKeysPanel.js +101 -44
- package/dist/components/ApiKeysPanel.js.map +1 -1
- package/dist/components/CustomFieldsPanel.d.ts.map +1 -1
- package/dist/components/CustomFieldsPanel.js +5 -2
- package/dist/components/CustomFieldsPanel.js.map +1 -1
- package/dist/components/DecisionProvenance.d.ts +27 -0
- package/dist/components/DecisionProvenance.d.ts.map +1 -0
- package/dist/components/DecisionProvenance.js +53 -0
- package/dist/components/DecisionProvenance.js.map +1 -0
- package/dist/components/DecisionsPanel.d.ts +3 -0
- package/dist/components/DecisionsPanel.d.ts.map +1 -1
- package/dist/components/DecisionsPanel.js +9 -5
- package/dist/components/DecisionsPanel.js.map +1 -1
- package/dist/components/MarkdownView.d.ts.map +1 -1
- package/dist/components/MarkdownView.js +18 -2
- package/dist/components/MarkdownView.js.map +1 -1
- package/dist/components/NotesPanel.d.ts.map +1 -1
- package/dist/components/NotesPanel.js +7 -3
- package/dist/components/NotesPanel.js.map +1 -1
- package/dist/components/OriginLabel.d.ts +5 -0
- package/dist/components/OriginLabel.d.ts.map +1 -0
- package/dist/components/OriginLabel.js +22 -0
- package/dist/components/OriginLabel.js.map +1 -0
- package/dist/components/Shell.d.ts.map +1 -1
- package/dist/components/Shell.js +17 -5
- package/dist/components/Shell.js.map +1 -1
- package/dist/components/aiDrawerState.d.ts +12 -0
- package/dist/components/aiDrawerState.d.ts.map +1 -1
- package/dist/components/aiDrawerState.js.map +1 -1
- package/dist/components/personIntakeTask.d.ts +15 -0
- package/dist/components/personIntakeTask.d.ts.map +1 -1
- package/dist/components/personIntakeTask.js +42 -0
- package/dist/components/personIntakeTask.js.map +1 -1
- package/dist/lib/personIntakeRunStorage.d.ts +15 -0
- package/dist/lib/personIntakeRunStorage.d.ts.map +1 -0
- package/dist/lib/personIntakeRunStorage.js +88 -0
- package/dist/lib/personIntakeRunStorage.js.map +1 -0
- package/dist/modules/PersonIntakeWizard.d.ts +1 -1
- package/dist/modules/PersonIntakeWizard.d.ts.map +1 -1
- package/dist/modules/PersonIntakeWizard.js +243 -29
- package/dist/modules/PersonIntakeWizard.js.map +1 -1
- package/dist/modules/ai.d.ts +1 -1
- package/dist/modules/ai.js +1 -1
- package/dist/pages/CompaniesPage.d.ts.map +1 -1
- package/dist/pages/CompaniesPage.js +13 -6
- package/dist/pages/CompaniesPage.js.map +1 -1
- package/dist/pages/DealsPage.d.ts.map +1 -1
- package/dist/pages/DealsPage.js +16 -8
- package/dist/pages/DealsPage.js.map +1 -1
- package/dist/pages/DecisionsPage.d.ts.map +1 -1
- package/dist/pages/DecisionsPage.js +7 -3
- package/dist/pages/DecisionsPage.js.map +1 -1
- package/dist/pages/EnquiriesPage.d.ts.map +1 -1
- package/dist/pages/EnquiriesPage.js +14 -6
- package/dist/pages/EnquiriesPage.js.map +1 -1
- package/dist/pages/FundraisingPage.d.ts.map +1 -1
- package/dist/pages/FundraisingPage.js +16 -11
- package/dist/pages/FundraisingPage.js.map +1 -1
- package/dist/pages/OpportunitiesPage.d.ts.map +1 -1
- package/dist/pages/OpportunitiesPage.js +14 -6
- package/dist/pages/OpportunitiesPage.js.map +1 -1
- package/dist/pages/PartnershipsPage.d.ts.map +1 -1
- package/dist/pages/PartnershipsPage.js +16 -11
- package/dist/pages/PartnershipsPage.js.map +1 -1
- package/dist/pages/PeoplePage.d.ts.map +1 -1
- package/dist/pages/PeoplePage.js +13 -8
- package/dist/pages/PeoplePage.js.map +1 -1
- package/dist/pages/PersonDetail.js +2 -2
- package/dist/pages/PersonDetail.js.map +1 -1
- package/dist/pages/SearchPage.d.ts.map +1 -1
- package/dist/pages/SearchPage.js +2 -1
- package/dist/pages/SearchPage.js.map +1 -1
- package/dist/pages/account/ConnectedAppsPage.d.ts +0 -5
- package/dist/pages/account/ConnectedAppsPage.d.ts.map +1 -1
- package/dist/pages/account/ConnectedAppsPage.js +38 -6
- package/dist/pages/account/ConnectedAppsPage.js.map +1 -1
- package/dist/pages/admin/AgentsPanel.d.ts +10 -0
- package/dist/pages/admin/AgentsPanel.d.ts.map +1 -0
- package/dist/pages/admin/AgentsPanel.js +81 -0
- package/dist/pages/admin/AgentsPanel.js.map +1 -0
- package/dist/pages/admin/AiAdminPage.d.ts.map +1 -1
- package/dist/pages/admin/AiAdminPage.js +9 -6
- package/dist/pages/admin/AiAdminPage.js.map +1 -1
- package/dist/pages/admin/AiPage.js +1 -1
- package/dist/pages/admin/TeamPage.d.ts.map +1 -1
- package/dist/pages/admin/TeamPage.js +16 -3
- package/dist/pages/admin/TeamPage.js.map +1 -1
- package/dist/pages/ai/AiAccessPage.d.ts +11 -0
- package/dist/pages/ai/AiAccessPage.d.ts.map +1 -0
- package/dist/pages/ai/AiAccessPage.js +16 -0
- package/dist/pages/ai/AiAccessPage.js.map +1 -0
- package/dist/pages/ai/McpPanel.d.ts +7 -0
- package/dist/pages/ai/McpPanel.d.ts.map +1 -0
- package/dist/pages/ai/McpPanel.js +86 -0
- package/dist/pages/ai/McpPanel.js.map +1 -0
- package/dist/pages/auth/nextPath.d.ts +6 -0
- package/dist/pages/auth/nextPath.d.ts.map +1 -1
- package/dist/pages/auth/nextPath.js +16 -1
- package/dist/pages/auth/nextPath.js.map +1 -1
- package/dist/pages/dashboard/sections.d.ts.map +1 -1
- package/dist/pages/dashboard/sections.js +4 -2
- package/dist/pages/dashboard/sections.js.map +1 -1
- package/dist/pages/forms/EmbedPanel.js +1 -1
- package/dist/pages/forms/EmbedPanel.js.map +1 -1
- package/dist/pages/forms/FormEmails.d.ts.map +1 -1
- package/dist/pages/forms/FormEmails.js +6 -1
- package/dist/pages/forms/FormEmails.js.map +1 -1
- package/dist/pages/forms/FormSettings.d.ts.map +1 -1
- package/dist/pages/forms/FormSettings.js +6 -2
- package/dist/pages/forms/FormSettings.js.map +1 -1
- package/dist/pages/forms/SubmissionDetail.js +15 -3
- package/dist/pages/forms/SubmissionDetail.js.map +1 -1
- package/dist/pages/forms/SubmissionsTable.js +5 -2
- package/dist/pages/forms/SubmissionsTable.js.map +1 -1
- package/dist/pages/oauth/ConsentPage.d.ts.map +1 -1
- package/dist/pages/oauth/ConsentPage.js +132 -15
- package/dist/pages/oauth/ConsentPage.js.map +1 -1
- package/dist/registry/contributions.d.ts +1 -1
- package/package.json +3 -3
- package/src/api/resource.ts +16 -0
- package/src/api/resources/decisions.ts +81 -1
- package/src/api/resources/oauth.ts +15 -1
- package/src/api/resources/personIntake.ts +54 -13
- package/src/api/resources/session.ts +4 -0
- package/src/app/KelpieApp.tsx +4 -2
- package/src/components/AddRecordPanel.tsx +143 -0
- package/src/components/AiDrawer.tsx +34 -7
- package/src/components/ApiKeysPanel.tsx +193 -75
- package/src/components/CustomFieldsPanel.tsx +15 -5
- package/src/components/DecisionProvenance.tsx +95 -0
- package/src/components/DecisionsPanel.tsx +30 -2
- package/src/components/MarkdownView.tsx +45 -11
- package/src/components/NotesPanel.tsx +15 -6
- package/src/components/OriginLabel.tsx +26 -0
- package/src/components/Shell.tsx +30 -6
- package/src/components/aiDrawerState.ts +12 -0
- package/src/components/personIntakeTask.tsx +48 -0
- package/src/lib/personIntakeRunStorage.ts +97 -0
- package/src/modules/PersonIntakeWizard.tsx +391 -30
- package/src/modules/ai.tsx +1 -1
- package/src/pages/CompaniesPage.tsx +22 -5
- package/src/pages/DealsPage.tsx +25 -8
- package/src/pages/DecisionsPage.tsx +28 -1
- package/src/pages/EnquiriesPage.tsx +23 -5
- package/src/pages/FundraisingPage.tsx +25 -11
- package/src/pages/OpportunitiesPage.tsx +23 -5
- package/src/pages/PartnershipsPage.tsx +25 -11
- package/src/pages/PeoplePage.tsx +22 -7
- package/src/pages/PersonDetail.tsx +4 -2
- package/src/pages/SearchPage.tsx +3 -0
- package/src/pages/account/ConnectedAppsPage.tsx +97 -14
- package/src/pages/admin/{McpPanel.tsx → AgentsPanel.tsx} +11 -168
- package/src/pages/admin/AiAdminPage.tsx +16 -11
- package/src/pages/admin/AiPage.tsx +1 -1
- package/src/pages/admin/TeamPage.tsx +33 -0
- package/src/pages/ai/AiAccessPage.tsx +23 -0
- package/src/pages/ai/McpPanel.tsx +261 -0
- package/src/pages/auth/nextPath.ts +18 -1
- package/src/pages/dashboard/sections.tsx +4 -0
- package/src/pages/forms/EmbedPanel.tsx +3 -2
- package/src/pages/forms/FormEmails.tsx +11 -2
- package/src/pages/forms/FormSettings.tsx +5 -0
- package/src/pages/forms/SubmissionDetail.tsx +23 -4
- package/src/pages/forms/SubmissionsTable.tsx +9 -1
- package/src/pages/oauth/ConsentPage.tsx +271 -33
- package/src/registry/contributions.ts +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { API_KEY_SCOPE_LABELS } from '@kelpie/schemas';
|
|
2
|
+
import { API_KEY_SCOPE_LABELS, apiKeyScopeRisk, expandApiKeyScopes, isApiKeyPresetScope, isApiKeyRiskScope, } from '@kelpie/schemas';
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
import { Link, Navigate, useParams } from 'react-router';
|
|
5
5
|
import { useApproveOAuthRequest, useDenyOAuthRequest, useOAuthRequest } from '../../api/resources/oauth.js';
|
|
@@ -20,7 +20,7 @@ import { AuthLayout } from '../auth/AuthLayout.js';
|
|
|
20
20
|
*/
|
|
21
21
|
export function ConsentPage() {
|
|
22
22
|
const { requestId = '' } = useParams();
|
|
23
|
-
const { isLoading: sessionLoading, isSignedOut, error: sessionError } = useSession();
|
|
23
|
+
const { session, isLoading: sessionLoading, isSignedOut, error: sessionError } = useSession();
|
|
24
24
|
if (isSignedOut) {
|
|
25
25
|
return _jsx(Navigate, { to: `/login?next=${encodeURIComponent(`/consent/${requestId}`)}`, replace: true });
|
|
26
26
|
}
|
|
@@ -30,9 +30,9 @@ export function ConsentPage() {
|
|
|
30
30
|
if (sessionLoading) {
|
|
31
31
|
return _jsx(LoadingPanel, {});
|
|
32
32
|
}
|
|
33
|
-
return _jsx(ConsentForRequest, { requestId: requestId });
|
|
33
|
+
return _jsx(ConsentForRequest, { requestId: requestId, activeWorkspaceId: session?.workspaceId ?? null });
|
|
34
34
|
}
|
|
35
|
-
function ConsentForRequest({ requestId }) {
|
|
35
|
+
function ConsentForRequest({ requestId, activeWorkspaceId }) {
|
|
36
36
|
const { request, isLoading, error } = useOAuthRequest(requestId);
|
|
37
37
|
if (error !== null) {
|
|
38
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 }) }) }));
|
|
@@ -40,13 +40,113 @@ function ConsentForRequest({ requestId }) {
|
|
|
40
40
|
if (isLoading || request === undefined) {
|
|
41
41
|
return _jsx(LoadingPanel, { label: "Loading the request\u2026" });
|
|
42
42
|
}
|
|
43
|
-
return _jsx(ConsentForm, { request: request });
|
|
43
|
+
return _jsx(ConsentForm, { request: request, activeWorkspaceId: activeWorkspaceId });
|
|
44
44
|
}
|
|
45
|
-
|
|
45
|
+
/**
|
|
46
|
+
* The workspaces ticked when the page opens.
|
|
47
|
+
*
|
|
48
|
+
* When the app is connected already, they are the workspaces it is connected
|
|
49
|
+
* to, whichever workspace the session is in. The app is then asking for more
|
|
50
|
+
* access, and an approval that named another workspace would make a new
|
|
51
|
+
* connection there and end the one that asked.
|
|
52
|
+
*
|
|
53
|
+
* For an app that is new to this person: the workspace the session is in, or
|
|
54
|
+
* the first when the session has none the person can connect. One, never all:
|
|
55
|
+
* a person who only clicks Allow gives the app the workspace they are working in.
|
|
56
|
+
*/
|
|
57
|
+
function initialWorkspaceIds(request, activeWorkspaceId) {
|
|
58
|
+
const connected = request.workspaces.filter((workspace) => workspace.connected);
|
|
59
|
+
if (connected.length > 0) {
|
|
60
|
+
return connected.map((workspace) => workspace.id);
|
|
61
|
+
}
|
|
62
|
+
const active = request.workspaces.find((workspace) => workspace.id === activeWorkspaceId);
|
|
63
|
+
const first = active ?? request.workspaces[0];
|
|
64
|
+
return first === undefined ? [] : [first.id];
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The scopes the page offers: each preset the app asked for, then each
|
|
68
|
+
* per-resource scope that none of those presets includes.
|
|
69
|
+
*
|
|
70
|
+
* A per-resource scope inside a requested preset is not listed. The preset
|
|
71
|
+
* grants it, so a separate tick box for it would change nothing. Only the
|
|
72
|
+
* listed scopes are approved: clearing a preset also drops what it included.
|
|
73
|
+
*
|
|
74
|
+
* A scope that gives a sensitive power is not listed here, also when the app
|
|
75
|
+
* asked for it. The server names those in `extraScopes`; they are in their
|
|
76
|
+
* own section and start clear.
|
|
77
|
+
*/
|
|
78
|
+
function offeredScopes(request) {
|
|
79
|
+
const requested = request.scopes.filter((scope) => !request.extraScopes.includes(scope));
|
|
80
|
+
const presets = requested.filter(isApiKeyPresetScope);
|
|
81
|
+
const included = expandApiKeyScopes(presets);
|
|
82
|
+
return [...presets, ...requested.filter((scope) => !isApiKeyPresetScope(scope) && !included.has(scope))];
|
|
83
|
+
}
|
|
84
|
+
function ConsentForm({ request, activeWorkspaceId }) {
|
|
46
85
|
const approve = useApproveOAuthRequest();
|
|
47
86
|
const deny = useDenyOAuthRequest();
|
|
48
|
-
const [
|
|
49
|
-
const [
|
|
87
|
+
const [workspaceIds, setWorkspaceIds] = useState(() => initialWorkspaceIds(request, activeWorkspaceId));
|
|
88
|
+
const [onlyWorkspace] = request.workspaces;
|
|
89
|
+
const offered = offeredScopes(request);
|
|
90
|
+
const [scopes, setScopes] = useState(offered);
|
|
91
|
+
// Only what the person changed by hand. An extra they did not touch is
|
|
92
|
+
// ticked when the app has it already in every selected workspace, and
|
|
93
|
+
// clear otherwise, so it follows the workspaces as they are ticked.
|
|
94
|
+
const [extraChoices, setExtraChoices] = useState(new Map());
|
|
95
|
+
const selectedWorkspaces = request.workspaces.filter((workspace) => workspaceIds.includes(workspace.id));
|
|
96
|
+
/**
|
|
97
|
+
* True when an approval with this extra ticked gives nothing new: each
|
|
98
|
+
* selected workspace has it from an earlier approval. The server says what
|
|
99
|
+
* each workspace holds. One workspace that lacks it makes this false, so a
|
|
100
|
+
* tick that nobody made never gives a new power anywhere.
|
|
101
|
+
*/
|
|
102
|
+
function alreadyAllowed(scope) {
|
|
103
|
+
return (selectedWorkspaces.length > 0 && selectedWorkspaces.every((workspace) => workspace.heldScopes.includes(scope)));
|
|
104
|
+
}
|
|
105
|
+
function extraTicked(scope) {
|
|
106
|
+
return extraChoices.get(scope) ?? alreadyAllowed(scope);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* The selected workspaces that have this extra now, when some have it and
|
|
110
|
+
* some do not. The row then starts clear, and an approval takes the extra
|
|
111
|
+
* away where the app had it. The row has to say so.
|
|
112
|
+
*/
|
|
113
|
+
function allowedOnlyIn(scope) {
|
|
114
|
+
const holders = selectedWorkspaces.filter((workspace) => workspace.heldScopes.includes(scope));
|
|
115
|
+
return holders.length === selectedWorkspaces.length ? [] : holders.map((workspace) => workspace.name);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* For an app on this computer: every workspace where it has this extra
|
|
119
|
+
* now, ticked on this page or not. Read from the display fields and shown
|
|
120
|
+
* as words. No tick on this page is ever taken from them.
|
|
121
|
+
*/
|
|
122
|
+
function shownAsAllowedIn(scope) {
|
|
123
|
+
if (!request.localClient) {
|
|
124
|
+
return [];
|
|
125
|
+
}
|
|
126
|
+
return request.workspaces
|
|
127
|
+
.filter((workspace) => workspace.displayHeldScopes.includes(scope))
|
|
128
|
+
.map((workspace) => workspace.name);
|
|
129
|
+
}
|
|
130
|
+
function connectedNow(workspace) {
|
|
131
|
+
return request.localClient && workspace.displayConnected;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* The ticked extra that gives everything this one gives and more, if there
|
|
135
|
+
* is one: "Delete objects" for `people:delete`, "Write all" for "Handbook
|
|
136
|
+
* (write)". The narrower row is then shown ticked and locked. Clear, it
|
|
137
|
+
* would say the app does not get a power that the wider row gives it.
|
|
138
|
+
*/
|
|
139
|
+
function widerTickedExtra(scope) {
|
|
140
|
+
const needed = [...expandApiKeyScopes([scope])];
|
|
141
|
+
return request.extraScopes.find((other) => {
|
|
142
|
+
const given = expandApiKeyScopes([other]);
|
|
143
|
+
return other !== scope && extraTicked(other) && given.size > needed.length && needed.every((entry) => given.has(entry));
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
// Only the rows the person ticked, or left ticked. A row that is shown
|
|
147
|
+
// ticked because a wider one covers it is not sent: the wider one gives it.
|
|
148
|
+
const extras = request.extraScopes.filter(extraTicked);
|
|
149
|
+
const nothingTicked = scopes.length + extras.length === 0;
|
|
50
150
|
const [leaving, setLeaving] = useState(false);
|
|
51
151
|
const busy = approve.isPending || deny.isPending || leaving;
|
|
52
152
|
function leaveTo(url) {
|
|
@@ -58,26 +158,43 @@ function ConsentForm({ request }) {
|
|
|
58
158
|
function toggle(scope) {
|
|
59
159
|
setScopes((current) => (current.includes(scope) ? current.filter((entry) => entry !== scope) : [...current, scope]));
|
|
60
160
|
}
|
|
161
|
+
function toggleExtra(scope) {
|
|
162
|
+
setExtraChoices((current) => new Map(current).set(scope, !extraTicked(scope)));
|
|
163
|
+
}
|
|
164
|
+
function toggleWorkspace(id) {
|
|
165
|
+
setWorkspaceIds((current) => (current.includes(id) ? current.filter((entry) => entry !== id) : [...current, id]));
|
|
166
|
+
}
|
|
61
167
|
if (request.workspaces.length === 0) {
|
|
62
|
-
return (_jsx(AuthLayout, { title: `Connect ${request.clientName}`, description: "A connection is made to
|
|
168
|
+
return (_jsx(AuthLayout, { title: `Connect ${request.clientName}`, description: "A connection is made to a 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
169
|
}
|
|
64
170
|
if (leaving) {
|
|
65
171
|
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
172
|
}
|
|
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("
|
|
68
|
-
|
|
69
|
-
|
|
173
|
+
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" }))] }), request.localClient && (_jsx("p", { className: "rounded-md border border-border bg-surface px-3 py-2.5 text-[12px] text-ink-muted", children: "This app runs on your computer, so Kelpie does not use what you allowed it before. Tick each workspace and each extra permission that it needs. What it has now is marked. After you select Allow, the app uses only the workspaces that you tick here. Tick a connected workspace again to keep it." })), request.workspaces.length === 1 && onlyWorkspace !== undefined ? (_jsxs("div", { children: [_jsx("p", { className: "mb-1.5 text-[12px] font-medium text-ink", children: "Workspace" }), _jsxs("p", { className: "text-[13px] text-ink", children: [onlyWorkspace.name, ' ', _jsxs("span", { className: "text-ink-muted capitalize", children: ["(", onlyWorkspace.role, ")"] }), connectedNow(onlyWorkspace) && _jsx("span", { className: "text-[11px] text-ink-muted", children: " \u00B7 connected now" })] }), _jsx("p", { className: "mt-1 text-[11px] text-ink-faint", children: "The app sees this workspace only." })] })) : (_jsxs("fieldset", { children: [_jsx("legend", { className: "mb-1.5 text-[12px] font-medium text-ink", children: "Workspaces" }), _jsx("div", { className: "space-y-1.5", children: request.workspaces.map((workspace) => (_jsxs("label", { className: "flex items-center gap-2 text-[13px] text-ink", children: [_jsx("input", { type: "checkbox", checked: workspaceIds.includes(workspace.id), onChange: () => {
|
|
174
|
+
toggleWorkspace(workspace.id);
|
|
175
|
+
} }), _jsxs("span", { className: "min-w-0 flex-1 truncate", children: [workspace.name, connectedNow(workspace) && _jsx("span", { className: "text-[11px] text-ink-muted", children: " \u00B7 connected now" })] }), _jsx("span", { className: "shrink-0 text-[11px] text-ink-muted capitalize", children: workspace.role })] }, workspace.id))) }), _jsx("p", { className: "mt-1.5 text-[11px] text-ink-faint", children: workspaceIds.length > 1
|
|
176
|
+
? 'The app can read and write in each of these workspaces.'
|
|
177
|
+
: 'The app sees only the workspaces you select.' })] })), _jsxs("fieldset", { hidden: offered.length === 0, children: [_jsx("legend", { className: "mb-1.5 text-[12px] font-medium text-ink", children: "Access" }), _jsx("div", { className: "space-y-1.5", children: offered.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
178
|
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." })] }),
|
|
179
|
+
} }), 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. A wider item, such as Read all, includes the narrower ones." })] }), request.extraScopes.length > 0 && (_jsxs("fieldset", { className: "rounded-md border border-border px-3 py-2.5", children: [_jsx("legend", { className: "px-1 text-[12px] font-medium text-ink", children: "Extra permissions" }), _jsx("p", { className: "mb-2 text-[11px] text-ink-muted", children: "Not part of the access above. Tick one only if you want this app to have it." }), _jsx("div", { className: "space-y-2", children: request.extraScopes.map((scope) => {
|
|
180
|
+
const wider = widerTickedExtra(scope);
|
|
181
|
+
const partly = allowedOnlyIn(scope);
|
|
182
|
+
const shown = shownAsAllowedIn(scope);
|
|
183
|
+
return (_jsxs("label", { className: "flex items-start gap-2 text-[13px] text-ink", children: [_jsx("input", { type: "checkbox", className: "mt-0.5", checked: wider !== undefined || extraTicked(scope), disabled: wider !== undefined, onChange: () => {
|
|
184
|
+
toggleExtra(scope);
|
|
185
|
+
} }), _jsxs("span", { children: [API_KEY_SCOPE_LABELS[scope], request.scopes.includes(scope) && (_jsx("span", { className: "text-[11px] text-ink-muted", children: " \u00B7 this app asks for it" })), alreadyAllowed(scope) && (_jsx("span", { className: "text-[11px] text-ink-muted", children: " \u00B7 already allowed" })), wider !== undefined && (_jsxs("span", { className: "text-[11px] text-ink-muted", children: [" \u00B7 included in ", API_KEY_SCOPE_LABELS[wider]] })), isApiKeyRiskScope(scope) && (_jsx("span", { className: "block text-[11px] text-ink-muted", children: apiKeyScopeRisk(scope) })), shown.length > 0 && (_jsxs("span", { className: "block text-[11px] text-warning", children: ["Allowed now in ", shown.join(', '), ". Tick it to allow it in the workspaces you select."] })), partly.length > 0 && (_jsxs("span", { className: "block text-[11px] text-warning", children: ["Allowed now in ", partly.join(', '), ".", ' ', extraTicked(scope) || wider !== undefined
|
|
186
|
+
? 'Ticked, it is allowed in every selected workspace.'
|
|
187
|
+
: 'If you leave it clear, it is removed there.'] }))] })] }, scope));
|
|
188
|
+
}) }), _jsx("p", { className: "mt-2 text-[11px] text-ink-faint", children: "What you allow here replaces what this app had. Clear an item that is already allowed to take it away." })] })), 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
189
|
deny
|
|
73
190
|
.runAsync(request.id)
|
|
74
191
|
.then((decision) => {
|
|
75
192
|
leaveTo(decision.redirectUrl);
|
|
76
193
|
})
|
|
77
194
|
.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 ||
|
|
195
|
+
}, 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 || nothingTicked || workspaceIds.length === 0, onClick: () => {
|
|
79
196
|
approve
|
|
80
|
-
.runAsync({ requestId: request.id,
|
|
197
|
+
.runAsync({ requestId: request.id, workspaceIds, scopes: [...scopes, ...extras] })
|
|
81
198
|
.then((decision) => {
|
|
82
199
|
leaveTo(decision.redirectUrl);
|
|
83
200
|
})
|
|
@@ -1 +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,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExD,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAA;AAC3G,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAA;AAC3D,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,gCAAiC,CAAA;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAwB,CAAA;AAEnD;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,WAAW;IACzB,MAAM,EAAE,SAAS,GAAG,EAAE,EAAE,GAAG,SAAS,EAAE,CAAA;IACtC,MAAM,EAAE,SAAS,EAAE,cAAc,EAA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AAQ,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,aAAa,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAC5D,OAAO,EAAE,GAAG,EAAE;gCACZ,OAAO;qCACJ,QAAQ,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC,EAAE,CAAC;qCACjF,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"}
|
|
@@ -73,7 +73,7 @@ export interface RecordTab {
|
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
75
|
* An admin page whose tabs modules may add to. `ai` is Admin → AI: core owns
|
|
76
|
-
* the page and its
|
|
76
|
+
* the page and its Agents tab, and the optional `ai` module adds Kelpie AI's
|
|
77
77
|
* settings and run log.
|
|
78
78
|
*/
|
|
79
79
|
export type ExtensibleAdminPage = 'ai';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kelpie/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.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.23.0",
|
|
52
52
|
"@tanstack/react-query": "^5.101.4",
|
|
53
53
|
"react-markdown": "^10.1.0",
|
|
54
54
|
"react-router": "^8.3.0",
|
|
@@ -69,6 +69,6 @@
|
|
|
69
69
|
"react-dom": "^19.2.8",
|
|
70
70
|
"tailwindcss": "^4.3.3",
|
|
71
71
|
"vite": "^8.2.0",
|
|
72
|
-
"vitest": "^
|
|
72
|
+
"vitest": "^5.0.3"
|
|
73
73
|
}
|
|
74
74
|
}
|
package/src/api/resource.ts
CHANGED
|
@@ -195,6 +195,22 @@ function writeRecordEverywhere<TRecord extends { readonly id: string }>(
|
|
|
195
195
|
)
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
+
/**
|
|
199
|
+
* Puts a record the server just answered with into every cache of its
|
|
200
|
+
* resource, by the resource's name.
|
|
201
|
+
*
|
|
202
|
+
* For a write that is not one of the five verbs: an action route that answers
|
|
203
|
+
* with the whole record. Without it the row shows its old state until the
|
|
204
|
+
* refetch lands.
|
|
205
|
+
*/
|
|
206
|
+
export function cacheRecord<TRecord extends { readonly id: string }>(
|
|
207
|
+
queryClient: QueryClient,
|
|
208
|
+
name: string,
|
|
209
|
+
record: TRecord,
|
|
210
|
+
): void {
|
|
211
|
+
writeRecordEverywhere(queryClient, keysFor(name), record)
|
|
212
|
+
}
|
|
213
|
+
|
|
198
214
|
function removeRecordEverywhere<TRecord extends { readonly id: string }>(
|
|
199
215
|
queryClient: QueryClient,
|
|
200
216
|
keys: ResourceKeys,
|
|
@@ -6,8 +6,13 @@ import type {
|
|
|
6
6
|
RecordTargetType,
|
|
7
7
|
} from '@kelpie/schemas'
|
|
8
8
|
|
|
9
|
+
import { useMutation, useQueryClient } from '@tanstack/react-query'
|
|
10
|
+
import { useState } from 'react'
|
|
11
|
+
|
|
9
12
|
import type { QueryParameters } from '../client.ts'
|
|
10
|
-
import {
|
|
13
|
+
import { useApiClient } from '../context.ts'
|
|
14
|
+
import { toError } from '../errors.ts'
|
|
15
|
+
import { cacheRecord, createResourceHooks } from '../resource.ts'
|
|
11
16
|
import type { MutationResult, RecordListResult, UpdateArguments } from '../resource.ts'
|
|
12
17
|
|
|
13
18
|
/**
|
|
@@ -61,3 +66,78 @@ export function useUpdateDecision(): MutationResult<UpdateArguments<DecisionInpu
|
|
|
61
66
|
export function useDeleteDecision(): MutationResult<string, void> {
|
|
62
67
|
return decisions.useRemove()
|
|
63
68
|
}
|
|
69
|
+
|
|
70
|
+
/** The proposal to confirm, as the member read it. */
|
|
71
|
+
export interface ConfirmDecisionArguments {
|
|
72
|
+
readonly id: string
|
|
73
|
+
/**
|
|
74
|
+
* The `updatedAt` of the Decision on screen. The server refuses with `409`
|
|
75
|
+
* when the Decision was edited after it, so the member confirms the text
|
|
76
|
+
* they read and not one an agent put there before the click.
|
|
77
|
+
*/
|
|
78
|
+
readonly updatedAt: Date
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface ConfirmDecisionResult extends MutationResult<ConfirmDecisionArguments, Decision> {
|
|
82
|
+
/**
|
|
83
|
+
* Every Decision a confirm is in flight for, so each row shows its own
|
|
84
|
+
* state. A set and not one id: a member can click a second row before the
|
|
85
|
+
* first answer is back, and both are then still in flight.
|
|
86
|
+
*/
|
|
87
|
+
readonly pendingIds: ReadonlySet<string>
|
|
88
|
+
/** How many confirms have succeeded on this page, for a status line a screen reader hears. */
|
|
89
|
+
readonly confirmedCount: number
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Confirms a proposal.
|
|
94
|
+
*
|
|
95
|
+
* Not optimistic: until the server answers, the Decision is still a proposal,
|
|
96
|
+
* and a page that showed it as a commitment for a moment would say the one
|
|
97
|
+
* thing this field exists to keep true. The answer is written into the caches
|
|
98
|
+
* at once, so the row does not stay "not confirmed" while the lists refetch.
|
|
99
|
+
* The dashboard lists recent decisions with the same label, so it goes stale
|
|
100
|
+
* too. A refusal refetches the lists: the usual cause is that the text changed.
|
|
101
|
+
*/
|
|
102
|
+
export function useConfirmDecision(): ConfirmDecisionResult {
|
|
103
|
+
const client = useApiClient()
|
|
104
|
+
const queryClient = useQueryClient()
|
|
105
|
+
const [pendingIds, setPendingIds] = useState<ReadonlySet<string>>(new Set())
|
|
106
|
+
const [confirmedCount, setConfirmedCount] = useState(0)
|
|
107
|
+
const mutation = useMutation({
|
|
108
|
+
mutationFn: ({ id, updatedAt }: ConfirmDecisionArguments) =>
|
|
109
|
+
client.post(
|
|
110
|
+
`/decisions/${id}/confirm`,
|
|
111
|
+
{ updated_at: updatedAt.toISOString() },
|
|
112
|
+
decisionSchema.parse,
|
|
113
|
+
),
|
|
114
|
+
// The mutation's own state follows only the newest call. These two run
|
|
115
|
+
// for every call, so the set holds each id until its own answer is back.
|
|
116
|
+
onMutate: ({ id }) => {
|
|
117
|
+
setPendingIds((current) => new Set(current).add(id))
|
|
118
|
+
},
|
|
119
|
+
onSettled: (_decision, _error, { id }) => {
|
|
120
|
+
setPendingIds((current) => new Set([...current].filter((pending) => pending !== id)))
|
|
121
|
+
},
|
|
122
|
+
onSuccess: (decision) => {
|
|
123
|
+
setConfirmedCount((count) => count + 1)
|
|
124
|
+
cacheRecord(queryClient, 'decisions', decision)
|
|
125
|
+
void queryClient.invalidateQueries({ queryKey: ['decisions'] })
|
|
126
|
+
void queryClient.invalidateQueries({ queryKey: ['dashboard'] })
|
|
127
|
+
},
|
|
128
|
+
onError: () => {
|
|
129
|
+
void queryClient.invalidateQueries({ queryKey: ['decisions'] })
|
|
130
|
+
},
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
return {
|
|
134
|
+
run: (input) => {
|
|
135
|
+
mutation.mutate(input)
|
|
136
|
+
},
|
|
137
|
+
runAsync: (input) => mutation.mutateAsync(input),
|
|
138
|
+
isPending: pendingIds.size > 0,
|
|
139
|
+
pendingIds,
|
|
140
|
+
confirmedCount,
|
|
141
|
+
error: toError(mutation.error),
|
|
142
|
+
}
|
|
143
|
+
}
|
|
@@ -16,7 +16,7 @@ import { asMutationResult } from './mutation.ts'
|
|
|
16
16
|
* `/v1/oauth`: the consent page an MCP client sends a person to, and the
|
|
17
17
|
* "Connected apps" list. Session only; the server refuses a bearer credential.
|
|
18
18
|
*
|
|
19
|
-
* Not workspace-scoped. A request asks which
|
|
19
|
+
* Not workspace-scoped. A request asks which workspaces to connect, and the
|
|
20
20
|
* list covers every workspace the person belongs to.
|
|
21
21
|
*/
|
|
22
22
|
|
|
@@ -110,3 +110,17 @@ export function useRevokeOAuthGrant(): MutationResult<string, void> {
|
|
|
110
110
|
|
|
111
111
|
return asMutationResult(mutation)
|
|
112
112
|
}
|
|
113
|
+
|
|
114
|
+
/** Ends a whole connection: every workspace that was approved together. */
|
|
115
|
+
export function useRevokeOAuthConnection(): MutationResult<string, void> {
|
|
116
|
+
const client = useApiClient()
|
|
117
|
+
const queryClient = useQueryClient()
|
|
118
|
+
const mutation = useMutation({
|
|
119
|
+
mutationFn: (id: string) => client.delete(`/oauth/connections/${id}`),
|
|
120
|
+
onSuccess: async () => {
|
|
121
|
+
await queryClient.invalidateQueries({ queryKey: GRANTS_KEY })
|
|
122
|
+
},
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
return asMutationResult(mutation)
|
|
126
|
+
}
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
personIntakeApplyResultSchema,
|
|
3
3
|
personIntakeCandidateBody,
|
|
4
|
-
personIntakeIdentifyResultSchema,
|
|
5
4
|
personIntakeItemBody,
|
|
6
|
-
|
|
5
|
+
personIntakeRunSchema,
|
|
6
|
+
personIntakeRunStartedSchema,
|
|
7
7
|
} from '@kelpie/schemas'
|
|
8
8
|
import type {
|
|
9
9
|
PersonIntakeApplyResult,
|
|
10
10
|
PersonIntakeCandidate,
|
|
11
|
-
PersonIntakeIdentifyResult,
|
|
12
11
|
PersonIntakeItem,
|
|
13
|
-
|
|
12
|
+
PersonIntakeRun,
|
|
13
|
+
PersonIntakeRunStarted,
|
|
14
14
|
} from '@kelpie/schemas'
|
|
15
|
-
import { useMutation, useQueryClient } from '@tanstack/react-query'
|
|
15
|
+
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
|
|
16
16
|
|
|
17
|
+
import { ApiError } from '../client.ts'
|
|
17
18
|
import { useApiClient } from '../context.ts'
|
|
19
|
+
import { toError } from '../errors.ts'
|
|
18
20
|
import type { MutationResult } from '../resource.ts'
|
|
19
21
|
import { asMutationResult } from './mutation.ts'
|
|
20
22
|
|
|
@@ -22,21 +24,25 @@ import { asMutationResult } from './mutation.ts'
|
|
|
22
24
|
* `/v1/ai/person-intake/*`, from the optional `ai` module. Only the module's
|
|
23
25
|
* wizard calls these, and only an assembly that lists the module serves them.
|
|
24
26
|
*
|
|
25
|
-
* `identify` and `research`
|
|
26
|
-
*
|
|
27
|
-
*
|
|
27
|
+
* `identify` and `research` start an AI run on the server's job queue and
|
|
28
|
+
* answer its id at once. The wizard then reads the run every 2 seconds until
|
|
29
|
+
* it settles (`usePersonIntakeRun`). Each run shows in the run log, so
|
|
30
|
+
* starting one refreshes it. `apply` can touch every record type the wizard
|
|
31
|
+
* offers, so it refreshes all of them.
|
|
28
32
|
*/
|
|
29
33
|
|
|
30
34
|
const RUN_LOG_KEY = ['ai_runs'] as const
|
|
31
35
|
|
|
32
36
|
const WRITTEN_RESOURCES = ['people', 'companies', 'positions', 'notes', 'partnerships', 'deals', 'enquiries'] as const
|
|
33
37
|
|
|
34
|
-
|
|
38
|
+
/** How often the wizard reads a run that has not settled. */
|
|
39
|
+
export const PERSON_INTAKE_POLL_INTERVAL_MS = 2000
|
|
40
|
+
|
|
41
|
+
export function useStartIdentify(): MutationResult<string, PersonIntakeRunStarted> {
|
|
35
42
|
const client = useApiClient()
|
|
36
43
|
const cache = useQueryClient()
|
|
37
44
|
const mutation = useMutation({
|
|
38
|
-
mutationFn: (text: string) =>
|
|
39
|
-
client.post('/ai/person-intake/identify', { text }, personIntakeIdentifyResultSchema.parse),
|
|
45
|
+
mutationFn: (text: string) => client.post('/ai/person-intake/identify', { text }, personIntakeRunStartedSchema.parse),
|
|
40
46
|
onSettled: () => {
|
|
41
47
|
void cache.invalidateQueries({ queryKey: RUN_LOG_KEY })
|
|
42
48
|
},
|
|
@@ -52,7 +58,7 @@ export interface ResearchPersonInput {
|
|
|
52
58
|
readonly existingPersonId: string | null
|
|
53
59
|
}
|
|
54
60
|
|
|
55
|
-
export function
|
|
61
|
+
export function useStartResearch(): MutationResult<ResearchPersonInput, PersonIntakeRunStarted> {
|
|
56
62
|
const client = useApiClient()
|
|
57
63
|
const cache = useQueryClient()
|
|
58
64
|
const mutation = useMutation({
|
|
@@ -64,7 +70,7 @@ export function useResearchPerson(): MutationResult<ResearchPersonInput, PersonI
|
|
|
64
70
|
candidate: personIntakeCandidateBody(input.candidate),
|
|
65
71
|
existing_person_id: input.existingPersonId,
|
|
66
72
|
},
|
|
67
|
-
|
|
73
|
+
personIntakeRunStartedSchema.parse,
|
|
68
74
|
),
|
|
69
75
|
onSettled: () => {
|
|
70
76
|
void cache.invalidateQueries({ queryKey: RUN_LOG_KEY })
|
|
@@ -74,6 +80,41 @@ export function useResearchPerson(): MutationResult<ResearchPersonInput, PersonI
|
|
|
74
80
|
return asMutationResult(mutation)
|
|
75
81
|
}
|
|
76
82
|
|
|
83
|
+
export interface PersonIntakeRunResult {
|
|
84
|
+
readonly run: PersonIntakeRun | undefined
|
|
85
|
+
readonly error: Error | null
|
|
86
|
+
/** The server has no such run for this caller, or never had one. */
|
|
87
|
+
readonly isNotFound: boolean
|
|
88
|
+
/** Reads the run again now, for a read that failed. */
|
|
89
|
+
readonly refetch: () => void
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** One intake run, read every 2 seconds until it settles. Nothing is read while `runId` is undefined. */
|
|
93
|
+
export function usePersonIntakeRun(runId: string | undefined): PersonIntakeRunResult {
|
|
94
|
+
const client = useApiClient()
|
|
95
|
+
const result = useQuery({
|
|
96
|
+
queryKey: ['person_intake_runs', runId ?? ''],
|
|
97
|
+
queryFn: () => client.get(`/ai/person-intake/runs/${encodeURIComponent(runId ?? '')}`, personIntakeRunSchema.parse),
|
|
98
|
+
enabled: runId !== undefined,
|
|
99
|
+
// A settled run never changes again, except that its result goes after an hour.
|
|
100
|
+
staleTime: Infinity,
|
|
101
|
+
refetchInterval: (query) => {
|
|
102
|
+
const status = query.state.data?.status
|
|
103
|
+
|
|
104
|
+
return status === 'queued' || status === 'running' ? PERSON_INTAKE_POLL_INTERVAL_MS : false
|
|
105
|
+
},
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
return {
|
|
109
|
+
run: result.data,
|
|
110
|
+
error: toError(result.error),
|
|
111
|
+
isNotFound: result.error instanceof ApiError && result.error.status === 404,
|
|
112
|
+
refetch: () => {
|
|
113
|
+
void result.refetch()
|
|
114
|
+
},
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
77
118
|
export function useApplyPersonIntake(): MutationResult<readonly PersonIntakeItem[], PersonIntakeApplyResult> {
|
|
78
119
|
const client = useApiClient()
|
|
79
120
|
const cache = useQueryClient()
|
|
@@ -26,6 +26,7 @@ import type {
|
|
|
26
26
|
} from '@kelpie/schemas'
|
|
27
27
|
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
|
|
28
28
|
|
|
29
|
+
import { clearAllSavedIntakeRuns } from '../../lib/personIntakeRunStorage.ts'
|
|
29
30
|
import { ApiError } from '../client.ts'
|
|
30
31
|
import type { ApiClient } from '../client.ts'
|
|
31
32
|
import { useApiClient } from '../context.ts'
|
|
@@ -136,6 +137,9 @@ export function useLogOut(): MutationResult<void, void> {
|
|
|
136
137
|
// and the next protected route asks for the session itself.
|
|
137
138
|
onSettled: () => {
|
|
138
139
|
queryClient.clear()
|
|
140
|
+
// The person-intake wizard saves its notes in this tab. The next person
|
|
141
|
+
// to sign in here must not find them.
|
|
142
|
+
clearAllSavedIntakeRuns()
|
|
139
143
|
},
|
|
140
144
|
})
|
|
141
145
|
|
package/src/app/KelpieApp.tsx
CHANGED
|
@@ -42,6 +42,7 @@ import { PreferencesPage } from '../pages/account/PreferencesPage.tsx'
|
|
|
42
42
|
import { ProfilePage } from '../pages/account/ProfilePage.tsx'
|
|
43
43
|
import { SecurityPage } from '../pages/account/SecurityPage.tsx'
|
|
44
44
|
import { AiAdminPage } from '../pages/admin/AiAdminPage.tsx'
|
|
45
|
+
import { AiAccessPage } from '../pages/ai/AiAccessPage.tsx'
|
|
45
46
|
import { ApiKeysPage } from '../pages/admin/ApiKeysPage.tsx'
|
|
46
47
|
import { DataPage } from '../pages/admin/DataPage.tsx'
|
|
47
48
|
import { FieldsPage } from '../pages/admin/FieldsPage.tsx'
|
|
@@ -193,6 +194,7 @@ function AppRoutes(): React.JSX.Element {
|
|
|
193
194
|
{/* The optional segment is the mockup's: /handbook opens the first page. */}
|
|
194
195
|
<Route path="handbook" element={<HandbookLayout />} />
|
|
195
196
|
<Route path="handbook/:pageId" element={<HandbookLayout />} />
|
|
197
|
+
<Route path="ai" element={<AiAccessPage />} />
|
|
196
198
|
<Route path="admin" element={<Navigate to="/admin/workspace" replace />} />
|
|
197
199
|
<Route path="admin/workspace" element={<WorkspaceSettingsPage />} />
|
|
198
200
|
<Route path="admin/team" element={<TeamPage />} />
|
|
@@ -201,8 +203,8 @@ function AppRoutes(): React.JSX.Element {
|
|
|
201
203
|
<Route path="admin/data" element={<DataPage />} />
|
|
202
204
|
<Route path="admin/api-keys" element={<ApiKeysPage />} />
|
|
203
205
|
<Route path="admin/ai" element={<AiAdminPage />} />
|
|
204
|
-
{/* MCP moved
|
|
205
|
-
<Route path="admin/mcp" element={<Navigate to="/
|
|
206
|
+
{/* MCP moved out of Admin: every member can open the AI page. */}
|
|
207
|
+
<Route path="admin/mcp" element={<Navigate to="/ai" replace />} />
|
|
206
208
|
<Route path="admin/webhooks" element={<WebhooksPage />} />
|
|
207
209
|
<Route path="admin/modules" element={<ModulesPage />} />
|
|
208
210
|
{/* The mockup's own shape: /account opens the first tab. */}
|