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