@coffre/ui 0.4.1 → 0.4.2
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/chunks/{connected-apps-CUOyEZXR.js → connected-apps-D8Df97-F.js} +2 -2
- package/dist/chunks/{connected-apps-CUOyEZXR.js.map → connected-apps-D8Df97-F.js.map} +1 -1
- package/dist/chunks/{delete-place-CRX7ntE8.js → delete-place-LYN7z7xb.js} +3 -3
- package/dist/chunks/{delete-place-CRX7ntE8.js.map → delete-place-LYN7z7xb.js.map} +1 -1
- package/dist/chunks/{directory-CxxrnGUL.js → directory-v87HGjEn.js} +4 -4
- package/dist/chunks/{directory-CxxrnGUL.js.map → directory-v87HGjEn.js.map} +1 -1
- package/dist/chunks/{folders-DoBmCwOi.js → folders-CbGU0xOz.js} +2 -2
- package/dist/chunks/{folders-DoBmCwOi.js.map → folders-CbGU0xOz.js.map} +1 -1
- package/dist/chunks/{grants-CXcmhujY.js → grants-9kIV6uZ7.js} +5 -5
- package/dist/chunks/{grants-CXcmhujY.js.map → grants-9kIV6uZ7.js.map} +1 -1
- package/dist/chunks/{offboarding-6eAduCsM.js → offboarding-DdnmRV1f.js} +2 -2
- package/dist/chunks/{offboarding-6eAduCsM.js.map → offboarding-DdnmRV1f.js.map} +1 -1
- package/dist/chunks/{principal-page-B9R2zPlp.js → principal-page-BubEO6-b.js} +10 -10
- package/dist/chunks/{principal-page-B9R2zPlp.js.map → principal-page-BubEO6-b.js.map} +1 -1
- package/dist/chunks/{project-page-SRCtRe2g.js → project-page-C4cEaRFa.js} +2 -2
- package/dist/chunks/{project-page-SRCtRe2g.js.map → project-page-C4cEaRFa.js.map} +1 -1
- package/dist/chunks/{queries-DVR_i3rA.js → queries-Dew8mIeo.js} +3 -3
- package/dist/chunks/queries-Dew8mIeo.js.map +1 -0
- package/dist/chunks/{references-B6pLT1uQ.js → references-DPSYdWOk.js} +3 -3
- package/dist/chunks/{references-B6pLT1uQ.js.map → references-DPSYdWOk.js.map} +1 -1
- package/dist/chunks/{use-change-CZdI2MJG.js → use-change-C4bGRhHY.js} +2 -2
- package/dist/chunks/{use-change-CZdI2MJG.js.map → use-change-C4bGRhHY.js.map} +1 -1
- package/dist/chunks/{use-shell-rNKfGjdj.js → use-shell-Dkv89nW1.js} +2 -2
- package/dist/chunks/{use-shell-rNKfGjdj.js.map → use-shell-Dkv89nW1.js.map} +1 -1
- package/dist/chunks/{validation-D312_NLf.js → validation-DvPinn8V.js} +2 -2
- package/dist/chunks/{validation-D312_NLf.js.map → validation-DvPinn8V.js.map} +1 -1
- package/dist/index.d.ts +25 -6
- package/dist/index.js +36 -8
- package/dist/index.js.map +1 -1
- package/dist/pages/account.d.ts +13 -3
- package/dist/pages/account.js +165 -76
- package/dist/pages/account.js.map +1 -1
- package/dist/pages/audit.js +1 -1
- package/dist/pages/environment.js +9 -10
- package/dist/pages/environment.js.map +1 -1
- package/dist/pages/login.js +1 -1
- package/dist/pages/oauth-authorize.d.ts +2 -1
- package/dist/pages/oauth-authorize.js +12 -8
- package/dist/pages/oauth-authorize.js.map +1 -1
- package/dist/pages/project-access.js +7 -7
- package/dist/pages/project-environments.js +8 -8
- package/dist/pages/project-settings.js +6 -6
- package/dist/pages/project.js +2 -2
- package/dist/pages/projects.js +6 -6
- package/dist/pages/service-account.js +6 -6
- package/dist/pages/service-account.js.map +1 -1
- package/dist/pages/service-accounts.js +4 -4
- package/dist/pages/settings.js +2 -2
- package/dist/pages/unregistered.js +1 -1
- package/dist/pages/user.js +1 -1
- package/dist/pages/users.js +4 -4
- package/package.json +3 -3
- package/src/components/service-tokens.tsx +1 -1
- package/src/index.ts +4 -0
- package/src/lib/queries.ts +2 -2
- package/src/options.ts +41 -6
- package/src/pages/account.tsx +138 -60
- package/src/pages/environment.tsx +2 -2
- package/src/pages/oauth-authorize.tsx +10 -7
- package/src/parity.ts +4 -4
- package/src/register.ts +13 -3
- package/src/shared/models.ts +1 -1
- package/src/styles/globals.css +9 -4
- package/dist/chunks/queries-DVR_i3rA.js.map +0 -1
package/dist/pages/users.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { i as PageHeader, n as ClosedDoor, rt as Users, u as useCoffre } from "../chunks/page-DvsgZ2Hd.js";
|
|
2
|
-
import { p as queries } from "../chunks/queries-
|
|
3
|
-
import { t as useShell } from "../chunks/use-shell-
|
|
4
|
-
import { t as DirectoryTable } from "../chunks/directory-
|
|
5
|
-
import { n as RemovedList } from "../chunks/offboarding-
|
|
2
|
+
import { p as queries } from "../chunks/queries-Dew8mIeo.js";
|
|
3
|
+
import { t as useShell } from "../chunks/use-shell-Dkv89nW1.js";
|
|
4
|
+
import { t as DirectoryTable } from "../chunks/directory-v87HGjEn.js";
|
|
5
|
+
import { n as RemovedList } from "../chunks/offboarding-DdnmRV1f.js";
|
|
6
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { useSuspenseQuery } from "@tanstack/react-query";
|
|
8
8
|
//#region src/pages/users.tsx
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coffre/ui",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "coffre's pages, for a deployment's own TanStack Start app: its router, and a Vite plugin for its build.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"@tanstack/router-core": "1.171.15",
|
|
45
45
|
"lucide-react": "1.47.0",
|
|
46
46
|
"sonner": "2.0.7",
|
|
47
|
-
"@coffre/
|
|
48
|
-
"@coffre/
|
|
47
|
+
"@coffre/client": "0.4.2",
|
|
48
|
+
"@coffre/core": "0.4.2"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"@tanstack/react-query": "5.103.1",
|
|
@@ -222,7 +222,7 @@ function IssueToken({ serviceId }: { serviceId: string }) {
|
|
|
222
222
|
secrets; a CI run signs the CLI in with it, piped to{' '}
|
|
223
223
|
<span className="mono">coffre login <url> --token</span>.
|
|
224
224
|
</Notice>
|
|
225
|
-
<div className="
|
|
225
|
+
<div className="copy-line">
|
|
226
226
|
<code className="mono">{issued.token}</code>
|
|
227
227
|
<CopyButton value={issued.token} label="Copy token" />
|
|
228
228
|
</div>
|
package/src/index.ts
CHANGED
package/src/lib/queries.ts
CHANGED
|
@@ -329,8 +329,8 @@ export function shellOf(
|
|
|
329
329
|
registrationRequired: me !== null && !me.registered,
|
|
330
330
|
/** A member the vault refuses: their record failed its integrity check. */
|
|
331
331
|
accessTampered: me?.tampered === true,
|
|
332
|
-
/** What the deployment's configuration turns on: MCP clients, and CI runs signing in by their ID tokens. */
|
|
333
|
-
features: member?.features ?? { mcp:
|
|
332
|
+
/** What the deployment's configuration turns on: MCP clients, as their endpoint's URL, and CI runs signing in by their ID tokens. */
|
|
333
|
+
features: member?.features ?? { mcp: null, workloads: false },
|
|
334
334
|
};
|
|
335
335
|
}
|
|
336
336
|
|
package/src/options.ts
CHANGED
|
@@ -282,10 +282,20 @@ export const settings = {
|
|
|
282
282
|
},
|
|
283
283
|
};
|
|
284
284
|
|
|
285
|
+
/**
|
|
286
|
+
* `/account`, the layout of your own account's tabs: its header, Sign out,
|
|
287
|
+
* and the tabs you may open. Each tab is a page under it that reads its own.
|
|
288
|
+
*/
|
|
289
|
+
export const account = {};
|
|
290
|
+
|
|
285
291
|
type AccountSearch = { linked?: string; error?: string };
|
|
286
292
|
|
|
287
|
-
/**
|
|
288
|
-
|
|
293
|
+
/**
|
|
294
|
+
* `/account/`, who coffre takes you for and, when coffre runs its own
|
|
295
|
+
* sign-in, the accounts you sign in with. Linking one comes back here, with
|
|
296
|
+
* its outcome in `?linked=` or `?error=`.
|
|
297
|
+
*/
|
|
298
|
+
export const accountProfile = {
|
|
289
299
|
validateSearch: (search: Record<string, unknown>): AccountSearch => {
|
|
290
300
|
const out: AccountSearch = {};
|
|
291
301
|
for (const name of ['linked', 'error'] as const) {
|
|
@@ -294,16 +304,41 @@ export const account = {
|
|
|
294
304
|
}
|
|
295
305
|
return out;
|
|
296
306
|
},
|
|
297
|
-
|
|
298
|
-
|
|
307
|
+
loader: async ({ context }: Loader) => {
|
|
308
|
+
const { coffre, queryClient } = coffreOf(context);
|
|
309
|
+
if (await ownSignIn(context)) await queryClient.fetchQuery(queries.identities(coffre));
|
|
310
|
+
},
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
/** `/account/sessions`, where you are signed in: absent behind Cloudflare Access, which owns sessions there. */
|
|
314
|
+
export const accountSessions = {
|
|
315
|
+
loader: async ({ context }: Loader) => {
|
|
316
|
+
const { coffre, queryClient } = coffreOf(context);
|
|
317
|
+
if (!(await ownSignIn(context))) throw redirect({ to: '/account' });
|
|
318
|
+
await queryClient.fetchQuery(queries.sessions(coffre));
|
|
319
|
+
},
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
/** `/account/apps`, how to connect an MCP client and the ones you connected, where the deployment serves MCP. */
|
|
323
|
+
export const accountApps = {
|
|
299
324
|
loader: async ({ context }: Loader) => {
|
|
300
325
|
const { coffre, queryClient } = coffreOf(context);
|
|
301
326
|
const shell = await loadShell(queryClient, coffre);
|
|
302
|
-
if (shell.
|
|
303
|
-
await
|
|
327
|
+
if (!shell.features.mcp || shell.principal?.type !== 'user') throw redirect({ to: '/account' });
|
|
328
|
+
await queryClient.fetchQuery(queries.apps(coffre));
|
|
304
329
|
},
|
|
305
330
|
};
|
|
306
331
|
|
|
332
|
+
/** `/account/appearance`, how coffre looks here, kept in this browser. */
|
|
333
|
+
export const accountAppearance = {};
|
|
334
|
+
|
|
335
|
+
/** Whether you are a person signed in by coffre's own sign-in, whose accounts and sessions are coffre's to show. */
|
|
336
|
+
async function ownSignIn(context: unknown): Promise<boolean> {
|
|
337
|
+
const { coffre, queryClient } = coffreOf(context);
|
|
338
|
+
const shell = await loadShell(queryClient, coffre);
|
|
339
|
+
return shell.auth.signin !== null && shell.principal?.type === 'user';
|
|
340
|
+
}
|
|
341
|
+
|
|
307
342
|
// --- in the solo frame ----------------------------------------------------------------
|
|
308
343
|
|
|
309
344
|
/** `/login`. */
|
package/src/pages/account.tsx
CHANGED
|
@@ -1,97 +1,136 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type { IdentityRow, SessionRow } from '@coffre/client';
|
|
2
|
+
import { Link, Outlet } from '@tanstack/react-router';
|
|
3
|
+
import { useSuspenseQuery } from '@tanstack/react-query';
|
|
4
4
|
|
|
5
5
|
import { Fragment } from 'react';
|
|
6
6
|
import { useShell } from '../lib/use-shell';
|
|
7
7
|
import { Card, Fact, PageHeader } from '../components/page';
|
|
8
|
+
import { PageTabs } from '../components/tabs';
|
|
8
9
|
import { ThemeCards } from '../components/theme';
|
|
9
10
|
import { InstanceRole } from '../components/directory';
|
|
10
|
-
import { ConfirmButton, EmptyState, ErrorLine, Notice, Timestamp } from '../components/ui';
|
|
11
|
-
import { Link as LinkIcon, Monitor, ProviderMark, SignOut, Terminal, X } from '../components/icons';
|
|
11
|
+
import { ConfirmButton, CopyButton, EmptyState, ErrorLine, Notice, Timestamp } from '../components/ui';
|
|
12
|
+
import { Link as LinkIcon, Monitor, ProviderMark, SignOut, Sun, Terminal, User, X } from '../components/icons';
|
|
12
13
|
import { signinErrorMessage } from '../lib/signin-errors';
|
|
13
14
|
import { useOneTime } from '../lib/one-time';
|
|
14
15
|
import { useCoffre } from '../lib/coffre';
|
|
16
|
+
import { useMounted } from '../lib/mounted';
|
|
15
17
|
import { disconnectApp, endSession, unlinkIdentity } from '../lib/changes';
|
|
16
18
|
import { queries } from '../lib/queries';
|
|
17
19
|
import { useChange, useChangeStatus } from '../lib/use-change';
|
|
18
20
|
import { RowFailure, RowPending, rowClass } from '../components/row-state';
|
|
19
21
|
import { ConnectedAppsCard } from '../components/connected-apps';
|
|
20
22
|
import { pageRoute } from '../lib/page-route';
|
|
21
|
-
import type {
|
|
23
|
+
import type { accountProfile } from '../options';
|
|
22
24
|
|
|
23
|
-
const Route = pageRoute<typeof
|
|
24
|
-
|
|
25
|
-
type Search = { linked?: string; error?: string };
|
|
25
|
+
const Route = pageRoute<typeof accountProfile>();
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* Your own
|
|
28
|
+
* Your own account, around its tabs: who coffre takes you for and, when
|
|
29
29
|
* coffre runs its own sign-in, which accounts you sign in with, where you
|
|
30
|
-
* are signed in,
|
|
31
|
-
*
|
|
30
|
+
* are signed in, the MCP clients you connected, and how coffre looks here.
|
|
31
|
+
* The sidebar's Settings is the instance's; this page is reached from your
|
|
32
|
+
* account at the sidebar's foot. It keeps the name it had as one page, which
|
|
33
|
+
* a deployment's `_coffre/account.tsx` mounts.
|
|
32
34
|
*/
|
|
33
|
-
|
|
34
35
|
export function AccountPage() {
|
|
35
|
-
const { principal,
|
|
36
|
+
const { principal, auth, features } = useShell();
|
|
37
|
+
const mounted = useMounted();
|
|
38
|
+
const person = principal?.type === 'user';
|
|
36
39
|
|
|
37
40
|
return (
|
|
38
41
|
<>
|
|
39
42
|
<PageHeader title="Account" actions={principal !== null && <SignOutButton />} />
|
|
40
43
|
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
<PageTabs label="Account sections">
|
|
45
|
+
{[
|
|
46
|
+
<Link key="profile" to="/account" activeOptions={{ exact: true, includeSearch: false }}>
|
|
47
|
+
<User size={15} />
|
|
48
|
+
Profile
|
|
49
|
+
</Link>,
|
|
50
|
+
person && auth.signin !== null && mounted('/account/sessions') && (
|
|
51
|
+
<Link key="sessions" to="/account/sessions">
|
|
52
|
+
<Monitor size={15} />
|
|
53
|
+
Sessions
|
|
54
|
+
</Link>
|
|
55
|
+
),
|
|
56
|
+
person && features.mcp && mounted('/account/apps') && (
|
|
57
|
+
<Link key="apps" to="/account/apps">
|
|
58
|
+
<LinkIcon size={15} />
|
|
59
|
+
Connected apps
|
|
60
|
+
</Link>
|
|
61
|
+
),
|
|
62
|
+
mounted('/account/appearance') && (
|
|
63
|
+
<Link key="appearance" to="/account/appearance">
|
|
64
|
+
<Sun size={15} />
|
|
65
|
+
Appearance
|
|
66
|
+
</Link>
|
|
67
|
+
),
|
|
68
|
+
]}
|
|
69
|
+
</PageTabs>
|
|
70
|
+
|
|
71
|
+
<Outlet />
|
|
72
|
+
</>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
46
75
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
76
|
+
/** Its first tab: who you are to coffre, and the accounts you sign in with. */
|
|
77
|
+
export function AccountProfilePage() {
|
|
78
|
+
const { principal, instanceRole, auth } = useShell();
|
|
79
|
+
if (principal === null) return null;
|
|
80
|
+
return (
|
|
81
|
+
<>
|
|
82
|
+
<Card labelledBy="identity" title="Identity">
|
|
83
|
+
<dl className="facts">
|
|
84
|
+
<Fact label={principal.type === 'user' ? 'Email' : 'Name'}>
|
|
85
|
+
<span className="mono">{principal.id}</span>
|
|
86
|
+
</Fact>
|
|
87
|
+
<Fact label="Kind">{principal.type === 'user' ? 'User' : 'Token'}</Fact>
|
|
88
|
+
{principal.type === 'user' && (
|
|
89
|
+
<Fact label="Instance role">
|
|
90
|
+
<InstanceRole
|
|
91
|
+
principal={{
|
|
92
|
+
principalType: 'user',
|
|
93
|
+
principalId: principal.id,
|
|
94
|
+
instanceRole: instanceRole ?? 'user',
|
|
95
|
+
isRootAdmin: instanceRole === 'root-admin',
|
|
96
|
+
}}
|
|
97
|
+
/>
|
|
52
98
|
</Fact>
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
<InstanceRole
|
|
57
|
-
principal={{
|
|
58
|
-
principalType: 'user',
|
|
59
|
-
principalId: principal.id,
|
|
60
|
-
instanceRole: instanceRole ?? 'user',
|
|
61
|
-
isRootAdmin: instanceRole === 'root-admin',
|
|
62
|
-
}}
|
|
63
|
-
/>
|
|
64
|
-
</Fact>
|
|
65
|
-
)}
|
|
66
|
-
</dl>
|
|
67
|
-
</Card>
|
|
68
|
-
)}
|
|
99
|
+
)}
|
|
100
|
+
</dl>
|
|
101
|
+
</Card>
|
|
69
102
|
|
|
70
|
-
{auth.signin !== null && principal
|
|
71
|
-
<
|
|
103
|
+
{auth.signin !== null && principal.type === 'user' && (
|
|
104
|
+
<SigninAccounts email={principal.id} providers={auth.signin.providers} />
|
|
72
105
|
)}
|
|
73
|
-
|
|
74
|
-
{features.mcp && principal?.type === 'user' && <ConnectedApps />}
|
|
75
106
|
</>
|
|
76
107
|
);
|
|
77
108
|
}
|
|
78
109
|
|
|
79
|
-
/**
|
|
80
|
-
function
|
|
81
|
-
const
|
|
82
|
-
const
|
|
83
|
-
queries: [queries.identities(client), queries.sessions(client)],
|
|
84
|
-
});
|
|
85
|
-
if (!identities.ok) return <ErrorLine error={identities.error} />;
|
|
110
|
+
/** Where you are signed in, browsers and command lines. */
|
|
111
|
+
export function AccountSessionsPage() {
|
|
112
|
+
const { auth } = useShell();
|
|
113
|
+
const { data: sessions } = useSuspenseQuery(queries.sessions(useCoffre()));
|
|
86
114
|
if (!sessions.ok) return <ErrorLine error={sessions.error} />;
|
|
115
|
+
return <Sessions sessions={sessions.sessions} providers={auth.signin?.providers ?? []} />;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** How to connect Claude, then the apps you connected. */
|
|
119
|
+
export function AccountAppsPage() {
|
|
120
|
+
const { features } = useShell();
|
|
87
121
|
return (
|
|
88
122
|
<>
|
|
89
|
-
|
|
90
|
-
<
|
|
123
|
+
{features.mcp !== null && <ConnectAnApp url={features.mcp} />}
|
|
124
|
+
<ConnectedApps />
|
|
91
125
|
</>
|
|
92
126
|
);
|
|
93
127
|
}
|
|
94
128
|
|
|
129
|
+
/** How coffre looks in this browser. */
|
|
130
|
+
export function AccountAppearancePage() {
|
|
131
|
+
return <ThemeCards />;
|
|
132
|
+
}
|
|
133
|
+
|
|
95
134
|
/**
|
|
96
135
|
* Sign-out is a form post: a GET could be triggered by any image tag on any
|
|
97
136
|
* page, and the server's origin check covers form posts.
|
|
@@ -113,7 +152,14 @@ function providerLabel(providers: Provider[], id: string | null) {
|
|
|
113
152
|
return providers.find((provider) => provider.id === id)?.label ?? id ?? 'unknown';
|
|
114
153
|
}
|
|
115
154
|
|
|
116
|
-
|
|
155
|
+
/** Which accounts you sign in with. */
|
|
156
|
+
function SigninAccounts({ email, providers }: { email: string; providers: Provider[] }) {
|
|
157
|
+
const { data } = useSuspenseQuery(queries.identities(useCoffre()));
|
|
158
|
+
if (!data.ok) return <ErrorLine error={data.error} />;
|
|
159
|
+
return <SigninAccountsCard email={email} providers={providers} identities={data.identities} />;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function SigninAccountsCard({
|
|
117
163
|
email,
|
|
118
164
|
providers,
|
|
119
165
|
identities,
|
|
@@ -375,6 +421,42 @@ function Sessions({
|
|
|
375
421
|
);
|
|
376
422
|
}
|
|
377
423
|
|
|
424
|
+
/** How to connect an MCP client: this instance's endpoint, as `/me` reports it, and the steps for Claude Code and claude.ai. */
|
|
425
|
+
function ConnectAnApp({ url }: { url: string }) {
|
|
426
|
+
return (
|
|
427
|
+
<Card
|
|
428
|
+
labelledBy="connect"
|
|
429
|
+
title="Connect an app"
|
|
430
|
+
description="Claude, or another MCP client, connects at this address. It asks you to approve it here, then acts as you."
|
|
431
|
+
>
|
|
432
|
+
<dl className="facts">
|
|
433
|
+
<Fact label="MCP URL">
|
|
434
|
+
<CopyLine value={url} label="Copy the URL" />
|
|
435
|
+
</Fact>
|
|
436
|
+
<Fact label="Claude Code">
|
|
437
|
+
<CopyLine value={`claude mcp add --transport http coffre ${url}`} label="Copy the command" />
|
|
438
|
+
<span className="hint">
|
|
439
|
+
Then run <span className="mono">/mcp</span> in Claude Code to sign in.
|
|
440
|
+
</span>
|
|
441
|
+
</Fact>
|
|
442
|
+
<Fact label="claude.ai">
|
|
443
|
+
<span>In Customize › Connectors, choose Add custom connector, then paste the URL.</span>
|
|
444
|
+
</Fact>
|
|
445
|
+
</dl>
|
|
446
|
+
</Card>
|
|
447
|
+
);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/** A value to copy whole, in a box of its own. */
|
|
451
|
+
function CopyLine({ value, label }: { value: string; label: string }) {
|
|
452
|
+
return (
|
|
453
|
+
<div className="copy-line">
|
|
454
|
+
<code className="mono">{value}</code>
|
|
455
|
+
<CopyButton value={value} label={label} />
|
|
456
|
+
</div>
|
|
457
|
+
);
|
|
458
|
+
}
|
|
459
|
+
|
|
378
460
|
/** The MCP clients you connected, such as Claude: each acts as you until it is disconnected or expires. */
|
|
379
461
|
function ConnectedApps() {
|
|
380
462
|
const client = useCoffre();
|
|
@@ -383,12 +465,8 @@ function ConnectedApps() {
|
|
|
383
465
|
<ConnectedAppsCard
|
|
384
466
|
apps={apps.ok ? apps.apps : { error: apps.error }}
|
|
385
467
|
change={disconnectApp(client)}
|
|
386
|
-
description="
|
|
387
|
-
empty=
|
|
388
|
-
<>
|
|
389
|
-
An app such as Claude connects through coffre's MCP endpoint, at <span className="mono">/mcp</span>, after you approve it here.
|
|
390
|
-
</>
|
|
391
|
-
}
|
|
468
|
+
description="Each acts as you, never beyond your access, and every call it makes is in the audit log. Disconnecting one stops it at its next request."
|
|
469
|
+
empty="An app you connect shows here once you approve it."
|
|
392
470
|
/>
|
|
393
471
|
);
|
|
394
472
|
}
|
|
@@ -1892,8 +1892,8 @@ function ImportEnv({ project, environment }: { project: string; environment: str
|
|
|
1892
1892
|
<ul style={{ margin: '0.375rem 0 0', paddingLeft: '1.1rem' }}>
|
|
1893
1893
|
{problems.map((problem) => (
|
|
1894
1894
|
<li key={problem.line}>
|
|
1895
|
-
Line {problem.line}: {problem.reason}
|
|
1896
|
-
<span className="mono">({problem.
|
|
1895
|
+
Line {problem.line}: {problem.reason}
|
|
1896
|
+
{problem.key !== undefined && <span className="mono"> ({problem.key})</span>}
|
|
1897
1897
|
</li>
|
|
1898
1898
|
))}
|
|
1899
1899
|
</ul>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import type { AuthorizationView, RouteInput } from '@coffre/client';
|
|
3
|
-
import { MCP_SCOPE_INFO, supersedes, type McpScope } from '@coffre/core/mcp';
|
|
3
|
+
import { MCP_SCOPE_INFO, MCP_SCOPES, supersedes, type McpScope } from '@coffre/core/mcp';
|
|
4
4
|
|
|
5
5
|
import { failureMessage, statusOf, useCoffre } from '../lib/coffre';
|
|
6
6
|
import { ClosedDoor } from '../components/page';
|
|
@@ -15,7 +15,8 @@ type Ready = Extract<AuthorizationView, { status: 'ready' }>;
|
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Where an MCP client, such as Claude, sends you to connect: who it is,
|
|
18
|
-
* where coffre's answer goes, and what it may do as you
|
|
18
|
+
* where coffre's answer goes, and what it may do as you, of every scope,
|
|
19
|
+
* whatever it asked for: what it asked for starts ticked. Nothing is granted
|
|
19
20
|
* until you press Approve, and every connection asks again: there is no
|
|
20
21
|
* silent re-consent. Either answer goes back to the app by `location`,
|
|
21
22
|
* never a form post, which the page's `form-action 'self'` would stop.
|
|
@@ -98,7 +99,7 @@ function Approve({
|
|
|
98
99
|
const { client } = view;
|
|
99
100
|
const unverified = client.registration === 'dcr';
|
|
100
101
|
// A step-up: the connections this one grants all of and more end once the app has its new one.
|
|
101
|
-
const granted =
|
|
102
|
+
const granted = MCP_SCOPES.filter((scope) => chosen.has(scope));
|
|
102
103
|
const replaced = view.connections.filter((held) => supersedes(granted, held)).length;
|
|
103
104
|
const kept = view.connections.length - replaced;
|
|
104
105
|
|
|
@@ -166,10 +167,12 @@ function Approve({
|
|
|
166
167
|
</dl>
|
|
167
168
|
|
|
168
169
|
<fieldset className="consent-scopes">
|
|
169
|
-
<legend className="label">
|
|
170
|
-
|
|
170
|
+
<legend className="label">
|
|
171
|
+
It may <span className="hint">· to add a scope later, you connect it again</span>
|
|
172
|
+
</legend>
|
|
173
|
+
{MCP_SCOPES.map((scope) => {
|
|
171
174
|
const { label, description } = MCP_SCOPE_INFO[scope];
|
|
172
|
-
const locked = scope === '
|
|
175
|
+
const locked = scope === 'read';
|
|
173
176
|
return (
|
|
174
177
|
<label key={scope} className="consent-scope">
|
|
175
178
|
<input
|
|
@@ -191,7 +194,7 @@ function Approve({
|
|
|
191
194
|
</fieldset>
|
|
192
195
|
|
|
193
196
|
<div className="consent-notices">
|
|
194
|
-
{chosen.has('
|
|
197
|
+
{chosen.has('reveal') && (
|
|
195
198
|
<Notice tone="bad">
|
|
196
199
|
Values will be sent to {client.name}. They become part of the conversation: whoever can read
|
|
197
200
|
that conversation, and wherever {client.name} stores it, has them.
|
package/src/parity.ts
CHANGED
|
@@ -138,9 +138,9 @@ export const UI_PARITY: { [K in RouteKey]: Reach } = {
|
|
|
138
138
|
],
|
|
139
139
|
},
|
|
140
140
|
'GET /sessions': { ui: [{ does: 'Account › Sessions', in: 'pages/account.tsx', call: 'sessions.list' }] },
|
|
141
|
-
'DELETE /sessions/:id': { ui: [{ does: 'Account › a session › End', in: 'pages/account.tsx', call: 'sessions.revoke' }] },
|
|
142
|
-
'GET /identities': { ui: [{ does: 'Account › Sign-in accounts', in: 'pages/account.tsx', call: 'identities.list' }] },
|
|
143
|
-
'DELETE /identities/:id': { ui: [{ does: 'Account › a sign-in account › Unlink', in: 'pages/account.tsx', call: 'identities.unlink' }] },
|
|
141
|
+
'DELETE /sessions/:id': { ui: [{ does: 'Account › Sessions › a session › End', in: 'pages/account.tsx', call: 'sessions.revoke' }] },
|
|
142
|
+
'GET /identities': { ui: [{ does: 'Account › Profile › Sign-in accounts', in: 'pages/account.tsx', call: 'identities.list' }] },
|
|
143
|
+
'DELETE /identities/:id': { ui: [{ does: 'Account › Profile › a sign-in account › Unlink', in: 'pages/account.tsx', call: 'identities.unlink' }] },
|
|
144
144
|
'GET /device-logins/:code': { ui: [{ does: "the page `coffre login` opens: the login's code", in: 'pages/device-login.tsx', call: 'deviceLogins.get' }] },
|
|
145
145
|
'POST /device-logins/:code': { ui: [{ does: 'that page › Approve, Deny', in: 'pages/device-login.tsx', call: 'deviceLogins.decide' }] },
|
|
146
146
|
'GET /oauth/authorizations': { ui: [{ does: 'the page an MCP client opens to connect: what it asks for', in: 'pages/oauth-authorize.tsx', call: 'oauth.describe' }] },
|
|
@@ -148,7 +148,7 @@ export const UI_PARITY: { [K in RouteKey]: Reach } = {
|
|
|
148
148
|
'GET /approvals/:id': { ui: [{ does: 'the page an MCP client sends you to, to decide a change it asked for', in: 'pages/approval.tsx', call: 'approvals.get' }] },
|
|
149
149
|
'POST /approvals/:id': { ui: [{ does: 'that page › Approve, Deny', in: 'pages/approval.tsx', call: 'approvals.decide' }] },
|
|
150
150
|
'GET /apps': { ui: [{ does: 'Account › Connected apps', in: 'pages/account.tsx', call: 'apps.list' }] },
|
|
151
|
-
'DELETE /apps/:id': { ui: [{ does: 'Account › a connected app › Disconnect', in: 'pages/account.tsx', call: 'apps.disconnect' }] },
|
|
151
|
+
'DELETE /apps/:id': { ui: [{ does: 'Account › Connected apps › a connected app › Disconnect', in: 'pages/account.tsx', call: 'apps.disconnect' }] },
|
|
152
152
|
'GET /audit': {
|
|
153
153
|
ui: [
|
|
154
154
|
{ does: 'Audit', in: 'pages/audit.tsx', call: 'audit.list' },
|
package/src/register.ts
CHANGED
|
@@ -8,6 +8,10 @@ import { createRootRouteWithContext, createRoute } from '@tanstack/react-router'
|
|
|
8
8
|
import type { createRouter } from './router';
|
|
9
9
|
import {
|
|
10
10
|
account,
|
|
11
|
+
accountAppearance,
|
|
12
|
+
accountApps,
|
|
13
|
+
accountProfile,
|
|
14
|
+
accountSessions,
|
|
11
15
|
audit,
|
|
12
16
|
deviceLogin,
|
|
13
17
|
environment,
|
|
@@ -34,7 +38,7 @@ import {
|
|
|
34
38
|
users,
|
|
35
39
|
type CoffreContext,
|
|
36
40
|
} from './options';
|
|
37
|
-
import { AccountPage } from './pages/account';
|
|
41
|
+
import { AccountAppearancePage, AccountAppsPage, AccountPage, AccountProfilePage, AccountSessionsPage } from './pages/account';
|
|
38
42
|
import { AuditPage } from './pages/audit';
|
|
39
43
|
import { DevicePage } from './pages/device-login';
|
|
40
44
|
import { EnvironmentPage } from './pages/environment';
|
|
@@ -60,7 +64,8 @@ const under = <T extends string>(path: T) => ({ getParentRoute: () => nav, path
|
|
|
60
64
|
const projectPage = createRoute({ ...under('/projects/$project'), ...project, component: ProjectLayout });
|
|
61
65
|
const userPage = createRoute({ ...under('/users/$user'), ...user, component: UserLayout });
|
|
62
66
|
const serviceAccountPage = createRoute({ ...under('/service-accounts/$account'), ...serviceAccount, component: ServiceAccountLayout });
|
|
63
|
-
const
|
|
67
|
+
const accountPage = createRoute({ ...under('/account'), ...account, component: AccountPage });
|
|
68
|
+
const tab = <P extends typeof projectPage | typeof userPage | typeof serviceAccountPage | typeof accountPage, T extends string>(parent: P, path: T) => ({ getParentRoute: () => parent, path });
|
|
64
69
|
|
|
65
70
|
const routeTree = root.addChildren([
|
|
66
71
|
frame.addChildren([
|
|
@@ -91,7 +96,12 @@ const routeTree = root.addChildren([
|
|
|
91
96
|
createRoute({ ...tab(serviceAccountPage, '/activity'), ...serviceAccountActivity, component: ServiceAccountActivityPage }),
|
|
92
97
|
]),
|
|
93
98
|
createRoute({ ...under('/settings'), ...settings, component: SettingsPage }),
|
|
94
|
-
|
|
99
|
+
accountPage.addChildren([
|
|
100
|
+
createRoute({ ...tab(accountPage, '/'), ...accountProfile, component: AccountProfilePage }),
|
|
101
|
+
createRoute({ ...tab(accountPage, '/sessions'), ...accountSessions, component: AccountSessionsPage }),
|
|
102
|
+
createRoute({ ...tab(accountPage, '/apps'), ...accountApps, component: AccountAppsPage }),
|
|
103
|
+
createRoute({ ...tab(accountPage, '/appearance'), ...accountAppearance, component: AccountAppearancePage }),
|
|
104
|
+
]),
|
|
95
105
|
]),
|
|
96
106
|
]);
|
|
97
107
|
|
package/src/shared/models.ts
CHANGED
|
@@ -52,4 +52,4 @@ export type ImportPlanEntry = { key: string; action: ImportAction; version: numb
|
|
|
52
52
|
export type PrincipalReport = OffboardingReport;
|
|
53
53
|
export type RemovedPrincipal = RemovedMember;
|
|
54
54
|
|
|
55
|
-
export type ImportProblem = { line: number;
|
|
55
|
+
export type ImportProblem = { line: number; key?: string; reason: string };
|
package/src/styles/globals.css
CHANGED
|
@@ -722,8 +722,9 @@ a.crumb-link:hover {
|
|
|
722
722
|
margin-bottom: 1.5rem;
|
|
723
723
|
}
|
|
724
724
|
|
|
725
|
-
/* Its actions end where the page's cards do. */
|
|
726
|
-
.content:has(.card-wide) > .page-head
|
|
725
|
+
/* Its actions, and the tab bar under it, end where the page's cards do. */
|
|
726
|
+
.content:has(.card-wide) > .page-head,
|
|
727
|
+
.content:has(.card-wide) > .tabs {
|
|
727
728
|
max-width: none;
|
|
728
729
|
}
|
|
729
730
|
|
|
@@ -1803,7 +1804,7 @@ a.crumb-link:hover {
|
|
|
1803
1804
|
color: var(--ink-3);
|
|
1804
1805
|
}
|
|
1805
1806
|
|
|
1806
|
-
.
|
|
1807
|
+
.copy-line {
|
|
1807
1808
|
display: flex;
|
|
1808
1809
|
align-items: center;
|
|
1809
1810
|
gap: 0.5rem;
|
|
@@ -1813,9 +1814,12 @@ a.crumb-link:hover {
|
|
|
1813
1814
|
background: var(--canvas);
|
|
1814
1815
|
}
|
|
1815
1816
|
|
|
1816
|
-
.
|
|
1817
|
+
.copy-line code {
|
|
1817
1818
|
flex: 1;
|
|
1818
1819
|
min-width: 0;
|
|
1820
|
+
padding: 0;
|
|
1821
|
+
border: 0;
|
|
1822
|
+
background: none;
|
|
1819
1823
|
font-size: 0.8125rem;
|
|
1820
1824
|
overflow-wrap: anywhere;
|
|
1821
1825
|
}
|
|
@@ -2715,6 +2719,7 @@ span.env-link {
|
|
|
2715
2719
|
.tabs {
|
|
2716
2720
|
display: flex;
|
|
2717
2721
|
gap: 0.25rem;
|
|
2722
|
+
max-width: var(--card-max);
|
|
2718
2723
|
margin: -0.25rem 0 1.5rem;
|
|
2719
2724
|
/* A shadow rather than a border: the scroll box clips at its padding
|
|
2720
2725
|
edge, and the current tab's underline has to cover this line. */
|