@coffre/ui 0.3.0 → 0.4.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/chunks/audit-sentence-BhHmvQX_.js +660 -0
- package/dist/chunks/audit-sentence-BhHmvQX_.js.map +1 -0
- package/dist/chunks/delete-place-CRX7ntE8.js +206 -0
- package/dist/chunks/delete-place-CRX7ntE8.js.map +1 -0
- package/dist/chunks/{directory-CSjWWUQ1.js → directory-zr3ek7Mc.js} +175 -60
- package/dist/chunks/directory-zr3ek7Mc.js.map +1 -0
- package/dist/chunks/folders-DoBmCwOi.js +207 -0
- package/dist/chunks/folders-DoBmCwOi.js.map +1 -0
- package/dist/chunks/grants-Cw1FyGID.js +669 -0
- package/dist/chunks/grants-Cw1FyGID.js.map +1 -0
- package/dist/chunks/offboarding-CE6d7um1.js +305 -0
- package/dist/chunks/offboarding-CE6d7um1.js.map +1 -0
- package/dist/chunks/one-time-DXEl9hbg.js +35 -0
- package/dist/chunks/one-time-DXEl9hbg.js.map +1 -0
- package/dist/chunks/page-DvsgZ2Hd.js +391 -0
- package/dist/chunks/page-DvsgZ2Hd.js.map +1 -0
- package/dist/chunks/principal-BIN-xwZw.js +42 -0
- package/dist/chunks/principal-BIN-xwZw.js.map +1 -0
- package/dist/chunks/{principal-page-D_91OA0l.js → principal-page-DhjO76GH.js} +245 -251
- package/dist/chunks/principal-page-DhjO76GH.js.map +1 -0
- package/dist/chunks/project-page-SRCtRe2g.js +17 -0
- package/dist/chunks/project-page-SRCtRe2g.js.map +1 -0
- package/dist/chunks/{queries-CQ81o4so.js → queries-DVR_i3rA.js} +132 -30
- package/dist/chunks/queries-DVR_i3rA.js.map +1 -0
- package/dist/chunks/references-B6pLT1uQ.js +343 -0
- package/dist/chunks/references-B6pLT1uQ.js.map +1 -0
- package/dist/chunks/{row-state-0PsrEzOL.js → row-state-DOPUsjQK.js} +3 -3
- package/dist/chunks/{row-state-0PsrEzOL.js.map → row-state-DOPUsjQK.js.map} +1 -1
- package/dist/chunks/signin-errors--ykMFuqN.js +57 -0
- package/dist/chunks/signin-errors--ykMFuqN.js.map +1 -0
- package/dist/chunks/tabs-BmwKfUeK.js +22 -0
- package/dist/chunks/tabs-BmwKfUeK.js.map +1 -0
- package/dist/chunks/{theme-B2vQolVR.js → theme-DJuz-xLM.js} +3 -3
- package/dist/chunks/{theme-B2vQolVR.js.map → theme-DJuz-xLM.js.map} +1 -1
- package/dist/chunks/{ui-DixXLQvQ.js → ui-DJje3gST.js} +6 -3
- package/dist/chunks/ui-DJje3gST.js.map +1 -0
- package/dist/chunks/{use-change-c6CeLRin.js → use-change-DUiGO19U.js} +52 -21
- package/dist/chunks/use-change-DUiGO19U.js.map +1 -0
- package/dist/chunks/{use-shell-jxd7Tzd-.js → use-shell-rNKfGjdj.js} +3 -3
- package/dist/chunks/{use-shell-jxd7Tzd-.js.map → use-shell-rNKfGjdj.js.map} +1 -1
- package/dist/chunks/validation-D312_NLf.js +87 -0
- package/dist/chunks/validation-D312_NLf.js.map +1 -0
- package/dist/index.d.ts +361 -27
- package/dist/index.js +188 -98
- package/dist/index.js.map +1 -1
- package/dist/pages/account.d.ts +2 -2
- package/dist/pages/account.js +297 -135
- package/dist/pages/account.js.map +1 -1
- package/dist/pages/approval.d.ts +9 -0
- package/dist/pages/approval.js +207 -0
- package/dist/pages/approval.js.map +1 -0
- package/dist/pages/audit.js +17 -542
- package/dist/pages/audit.js.map +1 -1
- package/dist/pages/device-login.js +2 -3
- package/dist/pages/device-login.js.map +1 -1
- package/dist/pages/environment.js +647 -257
- package/dist/pages/environment.js.map +1 -1
- package/dist/pages/login.js +18 -7
- package/dist/pages/login.js.map +1 -1
- package/dist/pages/oauth-authorize.d.ts +10 -0
- package/dist/pages/oauth-authorize.js +249 -0
- package/dist/pages/oauth-authorize.js.map +1 -0
- package/dist/pages/project-access.d.ts +6 -0
- package/dist/pages/project-access.js +370 -0
- package/dist/pages/project-access.js.map +1 -0
- package/dist/pages/project-environments.d.ts +4 -0
- package/dist/pages/project-environments.js +593 -0
- package/dist/pages/project-environments.js.map +1 -0
- package/dist/pages/project-settings.d.ts +4 -0
- package/dist/pages/project-settings.js +242 -0
- package/dist/pages/project-settings.js.map +1 -0
- package/dist/pages/project.d.ts +10 -2
- package/dist/pages/project.js +57 -934
- package/dist/pages/project.js.map +1 -1
- package/dist/pages/projects.js +53 -21
- package/dist/pages/projects.js.map +1 -1
- package/dist/pages/service-account.d.ts +10 -0
- package/dist/pages/{token.js → service-account.js} +112 -54
- package/dist/pages/service-account.js.map +1 -0
- package/dist/pages/service-accounts.d.ts +3 -0
- package/dist/pages/service-accounts.js +38 -0
- package/dist/pages/service-accounts.js.map +1 -0
- package/dist/pages/settings.d.ts +1 -0
- package/dist/pages/settings.js +104 -42
- package/dist/pages/settings.js.map +1 -1
- package/dist/pages/unregistered.js +2 -3
- package/dist/pages/unregistered.js.map +1 -1
- package/dist/pages/user.d.ts +6 -1
- package/dist/pages/user.js +18 -6
- package/dist/pages/user.js.map +1 -1
- package/dist/pages/users.js +6 -10
- package/dist/pages/users.js.map +1 -1
- package/package.json +3 -3
- package/src/components/actions-log.tsx +117 -0
- package/src/components/audit-sentence.tsx +55 -0
- package/src/components/command-palette.tsx +4 -4
- package/src/components/delete-place.tsx +180 -0
- package/src/components/directory.tsx +259 -110
- package/src/components/every-project.tsx +287 -0
- package/src/components/expiry-field.tsx +42 -0
- package/src/components/folders.tsx +219 -0
- package/src/components/grants.tsx +11 -4
- package/src/components/icons.tsx +2 -0
- package/src/components/missing.tsx +110 -0
- package/src/components/offboarding.tsx +61 -33
- package/src/components/page.tsx +4 -1
- package/src/components/principal-page.tsx +136 -106
- package/src/components/principal-picker.tsx +5 -5
- package/src/components/principal.tsx +4 -4
- package/src/components/references.tsx +323 -0
- package/src/components/service-tokens.tsx +112 -93
- package/src/components/shell.tsx +11 -32
- package/src/components/tabs.tsx +18 -0
- package/src/components/trusted-workloads.tsx +97 -79
- package/src/components/ui.tsx +8 -1
- package/src/index.ts +13 -2
- package/src/layout.tsx +2 -2
- package/src/lib/access-plan.ts +2 -2
- package/src/lib/audit-sentences.ts +161 -77
- package/src/lib/changes.ts +56 -5
- package/src/lib/coffre.ts +3 -2
- package/src/lib/one-time.ts +32 -0
- package/src/lib/project-access.ts +11 -23
- package/src/lib/project-page.ts +14 -0
- package/src/lib/queries.ts +126 -32
- package/src/lib/search.ts +25 -0
- package/src/lib/signin-errors.ts +45 -1
- package/src/lib/validation.ts +14 -0
- package/src/options.ts +187 -35
- package/src/pages/account.tsx +274 -129
- package/src/pages/approval.tsx +197 -0
- package/src/pages/audit.tsx +9 -61
- package/src/pages/environment.tsx +585 -286
- package/src/pages/login.tsx +8 -2
- package/src/pages/oauth-authorize.tsx +233 -0
- package/src/pages/project-access.tsx +219 -0
- package/src/pages/project-environments.tsx +582 -0
- package/src/pages/project-settings.tsx +259 -0
- package/src/pages/project.tsx +52 -879
- package/src/pages/projects.tsx +55 -18
- package/src/pages/service-account.tsx +50 -0
- package/src/pages/{tokens.tsx → service-accounts.tsx} +9 -6
- package/src/pages/settings.tsx +62 -8
- package/src/pages/user.tsx +16 -4
- package/src/pages/users.tsx +2 -2
- package/src/parity.ts +160 -0
- package/src/register.ts +58 -9
- package/src/router.tsx +4 -0
- package/src/shared/models.ts +6 -2
- package/src/styles/globals.css +536 -31
- package/dist/chunks/directory-CSjWWUQ1.js.map +0 -1
- package/dist/chunks/grants-saMQagmG.js +0 -160
- package/dist/chunks/grants-saMQagmG.js.map +0 -1
- package/dist/chunks/icons-D-PfAfnH.js +0 -203
- package/dist/chunks/icons-D-PfAfnH.js.map +0 -1
- package/dist/chunks/offboarding-C6l30DZR.js +0 -263
- package/dist/chunks/offboarding-C6l30DZR.js.map +0 -1
- package/dist/chunks/page-C5HcNqf2.js +0 -190
- package/dist/chunks/page-C5HcNqf2.js.map +0 -1
- package/dist/chunks/principal-page-D_91OA0l.js.map +0 -1
- package/dist/chunks/queries-CQ81o4so.js.map +0 -1
- package/dist/chunks/signin-errors-BEFlVDbQ.js +0 -30
- package/dist/chunks/signin-errors-BEFlVDbQ.js.map +0 -1
- package/dist/chunks/ui-DixXLQvQ.js.map +0 -1
- package/dist/chunks/use-action-CWsg_YWU.js +0 -49
- package/dist/chunks/use-action-CWsg_YWU.js.map +0 -1
- package/dist/chunks/use-change-c6CeLRin.js.map +0 -1
- package/dist/chunks/validation-BQtqPe2V.js +0 -29
- package/dist/chunks/validation-BQtqPe2V.js.map +0 -1
- package/dist/pages/token.d.ts +0 -3
- package/dist/pages/token.js.map +0 -1
- package/dist/pages/tokens.d.ts +0 -3
- package/dist/pages/tokens.js +0 -39
- package/dist/pages/tokens.js.map +0 -1
- package/dist/project-BqIy8gYR.d.ts +0 -5
- package/src/lib/instance.ts +0 -13
- package/src/pages/token.tsx +0 -34
package/src/pages/account.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { IdentityRow, SessionRow } from '@coffre/client';
|
|
2
|
-
import {
|
|
1
|
+
import type { ConnectedApp, IdentityRow, SessionRow } from '@coffre/client';
|
|
2
|
+
import { MCP_SCOPE_INFO } from '@coffre/core/mcp';
|
|
3
|
+
import { useSuspenseQueries, useSuspenseQuery } from '@tanstack/react-query';
|
|
3
4
|
|
|
4
5
|
import { Fragment } from 'react';
|
|
5
6
|
import { useShell } from '../lib/use-shell';
|
|
@@ -7,10 +8,11 @@ import { Card, Fact, PageHeader } from '../components/page';
|
|
|
7
8
|
import { ThemeCards } from '../components/theme';
|
|
8
9
|
import { InstanceRole } from '../components/directory';
|
|
9
10
|
import { ConfirmButton, EmptyState, ErrorLine, Notice, Timestamp } from '../components/ui';
|
|
10
|
-
import { Monitor, ProviderMark, SignOut, Terminal, X } from '../components/icons';
|
|
11
|
+
import { Link as LinkIcon, Monitor, ProviderMark, SignOut, Terminal, X } from '../components/icons';
|
|
11
12
|
import { signinErrorMessage } from '../lib/signin-errors';
|
|
13
|
+
import { useOneTime } from '../lib/one-time';
|
|
12
14
|
import { useCoffre } from '../lib/coffre';
|
|
13
|
-
import { endSession, unlinkIdentity } from '../lib/changes';
|
|
15
|
+
import { disconnectApp, endSession, unlinkIdentity } from '../lib/changes';
|
|
14
16
|
import { queries } from '../lib/queries';
|
|
15
17
|
import { useChange, useChangeStatus } from '../lib/use-change';
|
|
16
18
|
import { RowFailure, RowPending, rowClass } from '../components/row-state';
|
|
@@ -23,13 +25,13 @@ type Search = { linked?: string; error?: string };
|
|
|
23
25
|
|
|
24
26
|
/**
|
|
25
27
|
* Your own settings: how coffre looks here, who it takes you for and, when
|
|
26
|
-
* coffre runs its own sign-in, which accounts you sign in with
|
|
27
|
-
* are signed in. The sidebar's Settings is the instance's; this page is
|
|
28
|
+
* coffre runs its own sign-in, which accounts you sign in with, where you
|
|
29
|
+
* are signed in, and the MCP clients you connected. The sidebar's Settings is the instance's; this page is
|
|
28
30
|
* reached from your account at the sidebar's foot.
|
|
29
31
|
*/
|
|
30
32
|
|
|
31
33
|
export function AccountPage() {
|
|
32
|
-
const { principal, instanceRole, auth } = useShell();
|
|
34
|
+
const { principal, instanceRole, auth, features } = useShell();
|
|
33
35
|
|
|
34
36
|
return (
|
|
35
37
|
<>
|
|
@@ -67,6 +69,8 @@ export function AccountPage() {
|
|
|
67
69
|
{auth.signin !== null && principal?.type === 'user' && (
|
|
68
70
|
<SignIn email={principal.id} providers={auth.signin.providers} />
|
|
69
71
|
)}
|
|
72
|
+
|
|
73
|
+
{features.mcp && principal?.type === 'user' && <ConnectedApps />}
|
|
70
74
|
</>
|
|
71
75
|
);
|
|
72
76
|
}
|
|
@@ -117,101 +121,239 @@ function SigninAccounts({
|
|
|
117
121
|
providers: Provider[];
|
|
118
122
|
identities: IdentityRow[];
|
|
119
123
|
}) {
|
|
120
|
-
|
|
124
|
+
// Shown once: a reload shows the accounts, not the last link's outcome again.
|
|
125
|
+
const { linked, error } = useOneTime(Route.useSearch(), ['linked', 'error']);
|
|
121
126
|
const message = signinErrorMessage(error);
|
|
122
127
|
const change = unlinkIdentity(useCoffre());
|
|
123
128
|
const unlink = useChange(change);
|
|
124
129
|
const { status, dismiss } = useChangeStatus(change.list.queryKey);
|
|
125
130
|
|
|
126
131
|
return (
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
132
|
+
<>
|
|
133
|
+
<Card
|
|
134
|
+
labelledBy="signin-accounts"
|
|
135
|
+
title="Sign-in accounts"
|
|
136
|
+
description="coffre recognises you by these accounts, never by an email address alone. A new account is linked here, while you are signed in."
|
|
137
|
+
>
|
|
138
|
+
{(linked !== undefined || message !== null) && (
|
|
139
|
+
<div className="card-body">
|
|
140
|
+
{linked !== undefined && (
|
|
141
|
+
<Notice tone="good">{providerLabel(providers, linked)} account linked.</Notice>
|
|
142
|
+
)}
|
|
143
|
+
<ErrorLine error={message} />
|
|
144
|
+
</div>
|
|
145
|
+
)}
|
|
146
|
+
|
|
147
|
+
{identities.length === 0 ? (
|
|
148
|
+
<EmptyState title="No account linked">
|
|
149
|
+
Your next sign-in with a verified <span className="mono">{email}</span> links that
|
|
150
|
+
account.
|
|
151
|
+
</EmptyState>
|
|
152
|
+
) : (
|
|
153
|
+
<div className="dt-wrap">
|
|
154
|
+
<table className="dt stacks stacks-inline">
|
|
155
|
+
<thead>
|
|
156
|
+
<tr>
|
|
157
|
+
<th>Account</th>
|
|
158
|
+
<th className="col-shrink">Linked (UTC)</th>
|
|
159
|
+
<th className="col-shrink">Last sign-in</th>
|
|
160
|
+
<th className="col-actions">
|
|
161
|
+
<span className="visually-hidden">Actions</span>
|
|
162
|
+
</th>
|
|
163
|
+
</tr>
|
|
164
|
+
</thead>
|
|
165
|
+
<tbody>
|
|
166
|
+
{identities.map((identity) => {
|
|
167
|
+
const label = providerLabel(providers, identity.provider);
|
|
168
|
+
const brand = providers.find((p) => p.id === identity.provider)?.brand ?? 'oidc';
|
|
169
|
+
const state = status(identity.id);
|
|
170
|
+
return (
|
|
171
|
+
<Fragment key={identity.id}>
|
|
172
|
+
<tr className={rowClass(state)}>
|
|
173
|
+
<td>
|
|
174
|
+
<span className="cell-account">
|
|
175
|
+
<ProviderMark brand={brand} />
|
|
176
|
+
<span className="cell-stack">
|
|
177
|
+
<span>{label}</span>
|
|
178
|
+
{identity.email !== null && <small className="mono">{identity.email}</small>}
|
|
179
|
+
</span>
|
|
180
|
+
</span>
|
|
181
|
+
</td>
|
|
182
|
+
<td className="nowrap" data-label="Linked (UTC)">
|
|
183
|
+
<Timestamp iso={identity.createdAt} />
|
|
184
|
+
</td>
|
|
185
|
+
<td className="nowrap cell-muted" data-label="Last sign-in">
|
|
186
|
+
{identity.lastSignInAt === null ? (
|
|
187
|
+
'Never'
|
|
188
|
+
) : (
|
|
189
|
+
<Timestamp iso={identity.lastSignInAt} display="relative" />
|
|
190
|
+
)}
|
|
191
|
+
</td>
|
|
192
|
+
<td className="col-actions">
|
|
193
|
+
{state.state === 'pending' ? (
|
|
194
|
+
<RowPending status={state} />
|
|
195
|
+
) : (
|
|
196
|
+
<ConfirmButton
|
|
197
|
+
trigger={
|
|
198
|
+
<button className="act">
|
|
199
|
+
<X size={13} />
|
|
200
|
+
Unlink
|
|
201
|
+
</button>
|
|
202
|
+
}
|
|
203
|
+
title={`Unlink this ${label} account?`}
|
|
204
|
+
body={
|
|
205
|
+
identities.length === 1 ? (
|
|
206
|
+
<>
|
|
207
|
+
It stops signing you in, and every session it opened ends now,
|
|
208
|
+
this one included if you signed in with it. Your next sign-in
|
|
209
|
+
with any account whose verified email is{' '}
|
|
210
|
+
<span className="mono">{email}</span> links that account instead.
|
|
211
|
+
</>
|
|
212
|
+
) : (
|
|
213
|
+
<>
|
|
214
|
+
It stops signing you in, and every session it opened ends now,
|
|
215
|
+
this one included if you signed in with it.
|
|
216
|
+
</>
|
|
217
|
+
)
|
|
218
|
+
}
|
|
219
|
+
confirmLabel="Unlink"
|
|
220
|
+
onConfirm={() => unlink({ ...identity, label })}
|
|
221
|
+
/>
|
|
222
|
+
)}
|
|
223
|
+
</td>
|
|
224
|
+
</tr>
|
|
225
|
+
<RowFailure
|
|
226
|
+
status={state}
|
|
227
|
+
columns={4}
|
|
228
|
+
onDismiss={() => state.state === 'failed' && dismiss(state.mutationId)}
|
|
229
|
+
/>
|
|
230
|
+
</Fragment>
|
|
231
|
+
);
|
|
232
|
+
})}
|
|
233
|
+
</tbody>
|
|
234
|
+
</table>
|
|
235
|
+
</div>
|
|
236
|
+
)}
|
|
237
|
+
</Card>
|
|
238
|
+
{providers.length > 0 && (
|
|
239
|
+
<div className="table-actions">
|
|
240
|
+
<span className="hint">Link another account</span>
|
|
241
|
+
{providers.map((provider) => (
|
|
242
|
+
<a
|
|
243
|
+
key={provider.id}
|
|
244
|
+
className="btn"
|
|
245
|
+
href={`/auth/signin/${encodeURIComponent(provider.id)}?link=1`}
|
|
246
|
+
>
|
|
247
|
+
<ProviderMark brand={provider.brand} size={14} />
|
|
248
|
+
{provider.label}
|
|
249
|
+
</a>
|
|
250
|
+
))}
|
|
138
251
|
</div>
|
|
139
252
|
)}
|
|
253
|
+
</>
|
|
254
|
+
);
|
|
255
|
+
}
|
|
140
256
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
257
|
+
function Sessions({
|
|
258
|
+
sessions,
|
|
259
|
+
providers,
|
|
260
|
+
}: {
|
|
261
|
+
sessions: SessionRow[];
|
|
262
|
+
providers: Provider[];
|
|
263
|
+
}) {
|
|
264
|
+
const change = endSession(useCoffre());
|
|
265
|
+
const end = useChange(change);
|
|
266
|
+
const { status, dismiss } = useChangeStatus(change.list.queryKey);
|
|
267
|
+
|
|
268
|
+
return (
|
|
269
|
+
<Card
|
|
270
|
+
labelledBy="sessions"
|
|
271
|
+
title="Sessions"
|
|
272
|
+
description="Browsers and command lines signed in as you. Ending one signs it out at its next request."
|
|
273
|
+
>
|
|
274
|
+
{sessions.length === 0 ? (
|
|
275
|
+
<EmptyState title="No sessions">Nothing is signed in as you right now.</EmptyState>
|
|
146
276
|
) : (
|
|
147
277
|
<div className="dt-wrap">
|
|
148
|
-
<table className="dt">
|
|
278
|
+
<table className="dt stacks stacks-inline">
|
|
149
279
|
<thead>
|
|
150
280
|
<tr>
|
|
151
|
-
<th>
|
|
152
|
-
<th className="col-shrink">
|
|
153
|
-
<th className="col-shrink">
|
|
281
|
+
<th>Where</th>
|
|
282
|
+
<th className="col-shrink">Last active</th>
|
|
283
|
+
<th className="col-shrink">Expires</th>
|
|
154
284
|
<th className="col-actions">
|
|
155
285
|
<span className="visually-hidden">Actions</span>
|
|
156
286
|
</th>
|
|
157
287
|
</tr>
|
|
158
288
|
</thead>
|
|
159
289
|
<tbody>
|
|
160
|
-
{
|
|
161
|
-
const
|
|
162
|
-
const brand = providers.find((p) => p.id === identity.provider)?.brand ?? 'oidc';
|
|
163
|
-
const state = status(identity.id);
|
|
290
|
+
{sessions.map((session) => {
|
|
291
|
+
const state = status(session.id);
|
|
164
292
|
return (
|
|
165
|
-
<Fragment key={
|
|
293
|
+
<Fragment key={session.id}>
|
|
166
294
|
<tr className={rowClass(state)}>
|
|
167
295
|
<td>
|
|
168
296
|
<span className="cell-account">
|
|
169
|
-
<
|
|
297
|
+
{session.kind === 'cli' ? <Terminal size={15} /> : <Monitor size={15} />}
|
|
170
298
|
<span className="cell-stack">
|
|
171
|
-
<span>
|
|
172
|
-
|
|
299
|
+
<span>
|
|
300
|
+
{session.label ?? (session.kind === 'cli' ? 'Command line' : 'Browser')}{' '}
|
|
301
|
+
{session.current && <span className="tag tag-blue">This browser</span>}
|
|
302
|
+
</span>
|
|
303
|
+
<small>
|
|
304
|
+
{session.kind === 'cli'
|
|
305
|
+
? 'coffre login'
|
|
306
|
+
: `via ${providerLabel(providers, session.provider)}`}
|
|
307
|
+
{session.lastUsedIp !== null && (
|
|
308
|
+
<>
|
|
309
|
+
{' · '}
|
|
310
|
+
<span className="mono">{session.lastUsedIp}</span>
|
|
311
|
+
</>
|
|
312
|
+
)}
|
|
313
|
+
</small>
|
|
173
314
|
</span>
|
|
174
315
|
</span>
|
|
175
316
|
</td>
|
|
176
|
-
<td className="nowrap">
|
|
177
|
-
<Timestamp iso={
|
|
317
|
+
<td className="nowrap cell-muted" data-label="Last active">
|
|
318
|
+
<Timestamp iso={session.lastUsedAt ?? session.createdAt} display="relative" />
|
|
178
319
|
</td>
|
|
179
|
-
<td className="nowrap cell-muted">
|
|
180
|
-
{
|
|
181
|
-
'Never'
|
|
182
|
-
) : (
|
|
183
|
-
<Timestamp iso={identity.lastSignInAt} display="relative" />
|
|
184
|
-
)}
|
|
320
|
+
<td className="nowrap cell-muted" data-label="Expires">
|
|
321
|
+
<Timestamp iso={session.expiresAt} display="relative" />
|
|
185
322
|
</td>
|
|
186
323
|
<td className="col-actions">
|
|
187
|
-
{
|
|
324
|
+
{session.current ? (
|
|
325
|
+
<form method="post" action="/auth/signout">
|
|
326
|
+
<button className="act" type="submit">
|
|
327
|
+
<SignOut size={13} />
|
|
328
|
+
Sign out
|
|
329
|
+
</button>
|
|
330
|
+
</form>
|
|
331
|
+
) : state.state === 'pending' ? (
|
|
188
332
|
<RowPending status={state} />
|
|
189
333
|
) : (
|
|
190
334
|
<ConfirmButton
|
|
191
335
|
trigger={
|
|
192
336
|
<button className="act">
|
|
193
337
|
<X size={13} />
|
|
194
|
-
|
|
338
|
+
End
|
|
195
339
|
</button>
|
|
196
340
|
}
|
|
197
|
-
title={`
|
|
341
|
+
title={`End this ${session.kind === 'cli' ? 'command line' : 'browser'} session?`}
|
|
198
342
|
body={
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
</>
|
|
211
|
-
)
|
|
343
|
+
<>
|
|
344
|
+
{session.label ?? (session.kind === 'cli' ? 'The command line' : 'The browser')}
|
|
345
|
+
{session.lastUsedIp !== null && (
|
|
346
|
+
<>
|
|
347
|
+
{' '}at <span className="mono">{session.lastUsedIp}</span>
|
|
348
|
+
</>
|
|
349
|
+
)}
|
|
350
|
+
, last active{' '}
|
|
351
|
+
<Timestamp iso={session.lastUsedAt ?? session.createdAt} display="relative" />, is
|
|
352
|
+
signed out at its next request.
|
|
353
|
+
</>
|
|
212
354
|
}
|
|
213
|
-
confirmLabel="
|
|
214
|
-
onConfirm={() =>
|
|
355
|
+
confirmLabel="End session"
|
|
356
|
+
onConfirm={() => end(session)}
|
|
215
357
|
/>
|
|
216
358
|
)}
|
|
217
359
|
</td>
|
|
@@ -228,54 +370,41 @@ function SigninAccounts({
|
|
|
228
370
|
</table>
|
|
229
371
|
</div>
|
|
230
372
|
)}
|
|
231
|
-
|
|
232
|
-
{providers.length > 0 && (
|
|
233
|
-
<div className="card-foot">
|
|
234
|
-
<span className="hint">Link another account</span>
|
|
235
|
-
<div className="link-providers">
|
|
236
|
-
{providers.map((provider) => (
|
|
237
|
-
<a
|
|
238
|
-
key={provider.id}
|
|
239
|
-
className="btn btn-sm"
|
|
240
|
-
href={`/auth/signin/${encodeURIComponent(provider.id)}?link=1`}
|
|
241
|
-
>
|
|
242
|
-
<ProviderMark brand={provider.brand} size={14} />
|
|
243
|
-
{provider.label}
|
|
244
|
-
</a>
|
|
245
|
-
))}
|
|
246
|
-
</div>
|
|
247
|
-
</div>
|
|
248
|
-
)}
|
|
249
373
|
</Card>
|
|
250
374
|
);
|
|
251
375
|
}
|
|
252
376
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
}) {
|
|
260
|
-
const change = endSession(useCoffre());
|
|
261
|
-
const end = useChange(change);
|
|
377
|
+
/** The MCP clients you connected, such as Claude: each acts as you until it is disconnected or expires. */
|
|
378
|
+
function ConnectedApps() {
|
|
379
|
+
const client = useCoffre();
|
|
380
|
+
const { data: apps } = useSuspenseQuery(queries.apps(client));
|
|
381
|
+
const change = disconnectApp(client);
|
|
382
|
+
const disconnect = useChange(change);
|
|
262
383
|
const { status, dismiss } = useChangeStatus(change.list.queryKey);
|
|
263
384
|
|
|
264
385
|
return (
|
|
265
386
|
<Card
|
|
266
|
-
labelledBy="
|
|
267
|
-
title="
|
|
268
|
-
description="
|
|
387
|
+
labelledBy="apps"
|
|
388
|
+
title="Connected apps"
|
|
389
|
+
description="AI assistants and other MCP clients you connected. 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."
|
|
269
390
|
>
|
|
270
|
-
{
|
|
271
|
-
<
|
|
391
|
+
{!apps.ok ? (
|
|
392
|
+
<div className="card-body">
|
|
393
|
+
<ErrorLine error={apps.error} />
|
|
394
|
+
</div>
|
|
395
|
+
) : apps.apps.length === 0 ? (
|
|
396
|
+
<EmptyState title="No connected apps">
|
|
397
|
+
An app such as Claude connects through coffre's MCP endpoint, at{' '}
|
|
398
|
+
<span className="mono">/mcp</span>, after you approve it here.
|
|
399
|
+
</EmptyState>
|
|
272
400
|
) : (
|
|
273
401
|
<div className="dt-wrap">
|
|
274
|
-
<table className="dt">
|
|
402
|
+
<table className="dt stacks stacks-inline">
|
|
275
403
|
<thead>
|
|
276
404
|
<tr>
|
|
277
|
-
<th>
|
|
278
|
-
<th
|
|
405
|
+
<th>App</th>
|
|
406
|
+
<th>May</th>
|
|
407
|
+
<th className="col-shrink">Last used</th>
|
|
279
408
|
<th className="col-shrink">Expires</th>
|
|
280
409
|
<th className="col-actions">
|
|
281
410
|
<span className="visually-hidden">Actions</span>
|
|
@@ -283,60 +412,72 @@ function Sessions({
|
|
|
283
412
|
</tr>
|
|
284
413
|
</thead>
|
|
285
414
|
<tbody>
|
|
286
|
-
{
|
|
287
|
-
const state = status(
|
|
415
|
+
{apps.apps.map((app) => {
|
|
416
|
+
const state = status(app.id);
|
|
288
417
|
return (
|
|
289
|
-
<Fragment key={
|
|
418
|
+
<Fragment key={app.id}>
|
|
290
419
|
<tr className={rowClass(state)}>
|
|
291
420
|
<td>
|
|
292
421
|
<span className="cell-account">
|
|
293
|
-
|
|
422
|
+
<LinkIcon size={15} />
|
|
294
423
|
<span className="cell-stack">
|
|
295
424
|
<span>
|
|
296
|
-
{
|
|
297
|
-
{
|
|
425
|
+
{app.name}{' '}
|
|
426
|
+
{app.registration === 'dcr' && (
|
|
427
|
+
<span className="tag tag-amber" title="It registered itself: its name is its own claim">
|
|
428
|
+
Unverified
|
|
429
|
+
</span>
|
|
430
|
+
)}
|
|
298
431
|
</span>
|
|
299
432
|
<small>
|
|
300
|
-
{
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
{session.lastUsedIp !== null && (
|
|
304
|
-
<>
|
|
305
|
-
{' · '}
|
|
306
|
-
<span className="mono">{session.lastUsedIp}</span>
|
|
307
|
-
</>
|
|
308
|
-
)}
|
|
433
|
+
{app.host === null ? 'no website' : <span className="mono">{app.host}</span>}
|
|
434
|
+
{' · connected '}
|
|
435
|
+
<Timestamp iso={app.createdAt} display="relative" />
|
|
309
436
|
</small>
|
|
310
437
|
</span>
|
|
311
438
|
</span>
|
|
312
439
|
</td>
|
|
313
|
-
<td
|
|
314
|
-
|
|
440
|
+
<td data-label="May">{scopeLabels(app)}</td>
|
|
441
|
+
<td className="nowrap cell-muted" data-label="Last used">
|
|
442
|
+
{app.lastUsedAt === null ? 'Never' : <Timestamp iso={app.lastUsedAt} display="relative" />}
|
|
315
443
|
</td>
|
|
316
|
-
<td className="nowrap cell-muted">
|
|
317
|
-
<Timestamp iso={
|
|
444
|
+
<td className="nowrap cell-muted" data-label="Expires">
|
|
445
|
+
<Timestamp iso={app.expiresAt} display="relative" />
|
|
318
446
|
</td>
|
|
319
447
|
<td className="col-actions">
|
|
320
|
-
{
|
|
321
|
-
<form method="post" action="/auth/signout">
|
|
322
|
-
<button className="act" type="submit">
|
|
323
|
-
<SignOut size={13} />
|
|
324
|
-
Sign out
|
|
325
|
-
</button>
|
|
326
|
-
</form>
|
|
327
|
-
) : state.state === 'pending' ? (
|
|
448
|
+
{state.state === 'pending' ? (
|
|
328
449
|
<RowPending status={state} />
|
|
329
450
|
) : (
|
|
330
|
-
<
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
451
|
+
<ConfirmButton
|
|
452
|
+
trigger={
|
|
453
|
+
<button className="act">
|
|
454
|
+
<X size={13} />
|
|
455
|
+
Disconnect
|
|
456
|
+
</button>
|
|
457
|
+
}
|
|
458
|
+
title={`Disconnect ${app.name}?`}
|
|
459
|
+
body={
|
|
460
|
+
<>
|
|
461
|
+
{app.name}
|
|
462
|
+
{app.host !== null && (
|
|
463
|
+
<>
|
|
464
|
+
{' '}at <span className="mono">{app.host}</span>
|
|
465
|
+
</>
|
|
466
|
+
)}
|
|
467
|
+
, last used{' '}
|
|
468
|
+
{app.lastUsedAt === null ? 'never' : <Timestamp iso={app.lastUsedAt} display="relative" />},
|
|
469
|
+
stops at its next request. To use it again, connect it again.
|
|
470
|
+
</>
|
|
471
|
+
}
|
|
472
|
+
confirmLabel="Disconnect"
|
|
473
|
+
onConfirm={() => disconnect(app)}
|
|
474
|
+
/>
|
|
334
475
|
)}
|
|
335
476
|
</td>
|
|
336
477
|
</tr>
|
|
337
478
|
<RowFailure
|
|
338
479
|
status={state}
|
|
339
|
-
columns={
|
|
480
|
+
columns={5}
|
|
340
481
|
onDismiss={() => state.state === 'failed' && dismiss(state.mutationId)}
|
|
341
482
|
/>
|
|
342
483
|
</Fragment>
|
|
@@ -349,3 +490,7 @@ function Sessions({
|
|
|
349
490
|
</Card>
|
|
350
491
|
);
|
|
351
492
|
}
|
|
493
|
+
|
|
494
|
+
function scopeLabels(app: ConnectedApp): string {
|
|
495
|
+
return app.scopes.map((scope) => MCP_SCOPE_INFO[scope].label).join(', ');
|
|
496
|
+
}
|