bazilion 0.51.0 → 0.53.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/cli.js +74 -28
- package/dist/cli.js.map +1 -1
- package/dist/daemon.js +547 -187
- package/dist/daemon.js.map +1 -1
- package/dist/web/client/assets/AddProviderDialog-CO_uijWF.js +1 -0
- package/dist/web/client/assets/AgentTemplateParts-Dl35c-Ux.js +1 -0
- package/dist/web/client/assets/ConfigPage-DiQiJXP6.js +1 -0
- package/dist/web/client/assets/ConfirmDialog-BVytx3kN.js +1 -0
- package/dist/web/client/assets/ConnectionsView-DDrBaiLg.js +1 -0
- package/dist/web/client/assets/Dialog-BTDzv3J5.js +1 -0
- package/dist/web/client/assets/ManagePage-xlePXXx5.js +1 -0
- package/dist/web/client/assets/SectionTabs-BMiRKFfb.js +1 -0
- package/dist/web/client/assets/Segmented-Co4n2C5X.js +1 -0
- package/dist/web/client/assets/SpawnDialog-ejwXnyxy.js +1 -0
- package/dist/web/client/assets/SpawnTeamModal-Cp-nAvIC.js +1 -0
- package/dist/web/client/assets/TeamForm-Cz9uDVvb.js +1 -0
- package/dist/web/client/assets/TeamThread-D8xqE_gb.js +1 -0
- package/dist/web/client/assets/UnsavedChangesGuard-DmT4nBQU.js +1 -0
- package/dist/web/client/assets/_id-DEQxwq2v.js +1 -0
- package/dist/web/client/assets/_id-DSRgpxEc.js +1 -0
- package/dist/web/client/assets/access-34_ShgHU.js +1 -0
- package/dist/web/client/assets/agent-actions--EO4yJ4Q.js +1 -0
- package/dist/web/client/assets/agents-C87yBHaR.js +1 -0
- package/dist/web/client/assets/agents-DvCSl1Ro.js +1 -0
- package/dist/web/client/assets/api-CoLs57oO.js +1 -0
- package/dist/web/client/assets/arrow-right-BhTWtC9z.js +1 -0
- package/dist/web/client/assets/attention-CteEeRvX.js +1 -0
- package/dist/web/client/assets/chevron-right-BqOIX9UM.js +1 -0
- package/dist/web/client/assets/config-XJuQeEP4.js +1 -0
- package/dist/web/client/assets/createLucideIcon-dN8ooBD1.js +1 -0
- package/dist/web/client/assets/download-Dj-1ltZb.js +1 -0
- package/dist/web/client/assets/file-text-DiP-LaEg.js +1 -0
- package/dist/web/client/assets/form-Bvr_f9lR.js +1 -0
- package/dist/web/client/assets/images-BKjyhYUc.js +1 -0
- package/dist/web/client/assets/index-J_Uqj4md.js +54 -0
- package/dist/web/client/assets/key-round-QpqZklz6.js +1 -0
- package/dist/web/client/assets/list-checks-BeyG5SVQ.js +1 -0
- package/dist/web/client/assets/login-076Bc601.js +1 -0
- package/dist/web/client/assets/manage-CsrV2hhK.js +1 -0
- package/dist/web/client/assets/mcp-8N0BqZ0G.js +1 -0
- package/dist/web/client/assets/message-square-DnpSOYv4.js +1 -0
- package/dist/web/client/assets/model-facts-DoB6QD5y.js +1 -0
- package/dist/web/client/assets/network-BC7rNaOC.js +1 -0
- package/dist/web/client/assets/parts-B0JBolvG.js +1 -0
- package/dist/web/client/assets/plus-DZ3KVo7E.js +1 -0
- package/dist/web/client/assets/routes-3HkZZOOe.js +76 -0
- package/dist/web/client/assets/skills-DiaqZRXT.js +1 -0
- package/dist/web/client/assets/square-terminal-hQZ6pexU.js +1 -0
- package/dist/web/client/assets/style-BtcFIkOS.js +7 -0
- package/dist/web/client/assets/styles-C7Ztw15K.css +2 -0
- package/dist/web/client/assets/system-YWlJ8ogO.js +1 -0
- package/dist/web/client/assets/teams-DQwceMvk.js +1 -0
- package/dist/web/client/assets/teams-DTC3plIH.js +1 -0
- package/dist/web/client/assets/telegram-D4wINntt.js +1 -0
- package/dist/web/client/assets/tools-CZeQ9pDx.js +1 -0
- package/dist/web/client/assets/use-resource-BaTkTGvG.js +1 -0
- package/dist/web/client/assets/welcome-CnxP_RCk.js +1 -0
- package/dist/web/client/assets/wrench-BrwBswfo.js +1 -0
- package/dist/web/server/assets/{AddProviderDialog-CR6TRYdZ.js → AddProviderDialog-Di5crZUB.js} +9 -205
- package/dist/web/server/assets/AgentTemplateParts-Cqy7kSzx.js +269 -0
- package/dist/web/server/assets/{ConfigPage-CIh3ohea.js → ConfigPage-oXM3wyOU.js} +2 -2
- package/dist/web/server/assets/{ConfirmDialog-B79K2KEW.js → ConfirmDialog-DfaJ--A6.js} +2 -2
- package/dist/web/server/assets/{ConnectionsView-BIMYdp9C.js → ConnectionsView-DZrLoNoW.js} +7 -7
- package/dist/web/server/assets/{Dialog-CVqpXxuN.js → Dialog-aup_yJv5.js} +1 -1
- package/dist/web/server/assets/ManagePage-0LKHEcT_.js +29 -0
- package/dist/web/server/assets/ModelMenu-BAZeARx6.js +138 -0
- package/dist/web/server/assets/{Rail-Cg-efcpA.js → Rail-7JU6ly2O.js} +17 -107
- package/dist/web/server/assets/{SectionTabs-DrcgVeZd.js → SectionTabs-CWQ5orUW.js} +12 -5
- package/dist/web/server/assets/SpawnDialog-CYkwzETs.js +124 -0
- package/dist/web/server/assets/SpawnTeamModal-CCe6P82H.js +127 -0
- package/dist/web/server/assets/TeamForm-BzQmdhVi.js +141 -0
- package/dist/web/server/assets/{TeamThread-5CjVPcDr.js → TeamThread-SyQpUvz5.js} +3 -3
- package/dist/web/server/assets/{UnsavedChangesGuard-CyF2Z9p1.js → UnsavedChangesGuard-DrOvPV14.js} +1 -1
- package/dist/web/server/assets/_id-AcyGvFrE.js +400 -0
- package/dist/web/server/assets/{_id-8bsYEcGg.js → _id-BGTgqsWm.js} +8 -4
- package/dist/web/server/assets/{_id-TVruGcOd.js → _id-BKzOw78O.js} +11 -3
- package/dist/web/server/assets/{_id-0fEWiVZX.js → _id-DPGzfmjG.js} +258 -206
- package/dist/web/server/assets/_id-DXm9W55C.js +16 -0
- package/dist/web/server/assets/_id-DojvxRZn.js +39 -0
- package/dist/web/server/assets/_tanstack-start-manifest_v-D7RvKGRH.js +285 -0
- package/dist/web/server/assets/{tokens-C-oDTqnp.js → access-BJe-NduL.js} +5 -5
- package/dist/web/server/assets/access-CKSW7MFH.js +297 -0
- package/dist/web/server/assets/{tokens-CEdl8puR.js → access-WWspT0v4.js} +5 -4
- package/dist/web/server/assets/agent-actions-CUDMCG0F.js +20 -0
- package/dist/web/server/assets/agents-1sjSvp5p.js +12 -0
- package/dist/web/server/assets/{agents-BnWgFo6o.js → agents-6d9WxbYF.js} +9 -6
- package/dist/web/server/assets/agents-DKVGUwD1.js +31 -0
- package/dist/web/server/assets/agents-DUI4Yjtg.js +13 -0
- package/dist/web/server/assets/agents-DsHeRaLq.js +327 -0
- package/dist/web/server/assets/agents-DtLDoZ_u.js +136 -0
- package/dist/web/server/assets/{attention-Cr7puThv.js → attention-B6sSDR_4.js} +2 -1
- package/dist/web/server/assets/{attention-CHQEQiZl.js → attention-DefKwvgm.js} +2 -2
- package/dist/web/server/assets/attention-johfkM0_.js +203 -0
- package/dist/web/server/assets/{config-DOp28gcy.js → config-Clz57LuN.js} +186 -87
- package/dist/web/server/assets/{config-DzgkbBoD.js → config-DYAaaE9Z.js} +2 -2
- package/dist/web/server/assets/{createSsrRpc-CcLbajrF.js → createSsrRpc-BijMHgqE.js} +2 -46
- package/dist/web/server/assets/form-BRQAsKKq.js +319 -0
- package/dist/web/server/assets/manage-Ppyi3Y5y.js +230 -0
- package/dist/web/server/assets/mcp-Ce6O8Qs2.js +378 -0
- package/dist/web/server/assets/{mcp-D3OCoHtO.js → mcp-DB38leWS.js} +2 -2
- package/dist/web/server/assets/model-facts-mrfrWQne.js +136 -0
- package/dist/web/server/assets/parts-mabERIJZ.js +380 -0
- package/dist/web/server/assets/{router-Cs2Ak4II.js → router-C97bwlXi.js} +55 -50
- package/dist/web/server/assets/{routes-BSNOKE-C.js → routes-C4aGqXfr.js} +65 -17
- package/dist/web/server/assets/{routes-CO4l-GJ0.js → routes-DuOShl4q.js} +2 -2
- package/dist/web/server/assets/{routes-BVwqgZGI.js → routes-IHMVKpDK.js} +3 -3
- package/dist/web/server/assets/{skills-CggQJk6a.js → skills-B7sg0QKS.js} +2 -2
- package/dist/web/server/assets/{skills-h5aHa7Q8.js → skills-DWzlT_hC.js} +9 -1
- package/dist/web/server/assets/skills-hfTSwqsG.js +353 -0
- package/dist/web/server/assets/{style-GYDODk2F.js → style-BR7ufS6Z.js} +1 -1
- package/dist/web/server/assets/system-CNQpt3JB.js +145 -0
- package/dist/web/server/assets/{system-DtswhLW62.js → system-D3th6n2E.js} +4 -2
- package/dist/web/server/assets/{system-DsJfpBPl.js → system-DaP0ol67.js} +2 -2
- package/dist/web/server/assets/{teams-B6lBhvdL.js → teams-4cEZ4_rw.js} +4 -2
- package/dist/web/server/assets/{teams-BxnvFTyn.js → teams-70u1XQTr.js} +1 -3
- package/dist/web/server/assets/teams-BKHe67f3.js +176 -0
- package/dist/web/server/assets/{teams-YrmyutM4.js → teams-BopOP4x7.js} +8 -1
- package/dist/web/server/assets/teams-C3xwTz8-.js +219 -0
- package/dist/web/server/assets/{teams-Bp2tERZe.js → teams-CuKE5iAK.js} +2 -2
- package/dist/web/server/assets/{telegram-D2RZriz_.js → telegram-BnQADwnj.js} +5 -5
- package/dist/web/server/assets/telegram-BpmK-HHV.js +1059 -0
- package/dist/web/server/assets/{telegram-Gy7_9yih.js → telegram-CGol0CKX.js} +3 -3
- package/dist/web/server/assets/tools-BQeWn7Tj.js +12 -0
- package/dist/web/server/assets/tools-C-wwWjLI.js +12 -0
- package/dist/web/server/assets/tools-CURTfG2q.js +341 -0
- package/dist/web/server/assets/{use-resource-ChQozXVI.js → use-resource-DVzK0toP.js} +1 -1
- package/dist/web/server/assets/utils-C_uf36nf.js +8 -0
- package/dist/web/server/assets/{welcome-BLw1G6SS.js → welcome-OiZCAIHZ.js} +5 -5
- package/dist/web/server/assets/{welcome-ByAkvHSP.js → welcome-SNsE49JO.js} +2 -2
- package/dist/web/server/assets/{workspace-DeEYMPDX.js → workspace-DaitCM0t.js} +1 -8
- package/dist/web/server/server.js +30 -30
- package/dist/worker.js +202 -120
- package/dist/worker.js.map +1 -1
- package/package.json +1 -1
- package/dist/web/client/assets/AddProviderDialog-Diic36c_.js +0 -1
- package/dist/web/client/assets/ConfigPage-pupvtSCX.js +0 -1
- package/dist/web/client/assets/ConfirmDialog-GFDcHI1L.js +0 -1
- package/dist/web/client/assets/ConnectionsView-y1CeY-6U.js +0 -1
- package/dist/web/client/assets/Dialog-bg86_x4v.js +0 -1
- package/dist/web/client/assets/FieldRow-B8eIni5r.js +0 -1
- package/dist/web/client/assets/ModelSelect-DvCLUmkW.js +0 -1
- package/dist/web/client/assets/SectionTabs-D4ezA6U4.js +0 -1
- package/dist/web/client/assets/Segmented-Dh77vmpp.js +0 -1
- package/dist/web/client/assets/SkillFindings-BzLO1lNA.js +0 -1
- package/dist/web/client/assets/SkillsPicker-hI3YXvib.js +0 -1
- package/dist/web/client/assets/SpawnDialog-YJX6UMBC.js +0 -1
- package/dist/web/client/assets/Tabs-f6bHvCGn.js +0 -1
- package/dist/web/client/assets/TeamForm-kda1HYZG.js +0 -1
- package/dist/web/client/assets/TeamThread-DFvbakHo.js +0 -1
- package/dist/web/client/assets/UnsavedChangesGuard-DBJikVgc.js +0 -1
- package/dist/web/client/assets/_id-BjNtLwak.js +0 -1
- package/dist/web/client/assets/_id-BklaQf3z.js +0 -1
- package/dist/web/client/assets/agents-D9cUF2d9.js +0 -1
- package/dist/web/client/assets/agents-wuBlzx4e.js +0 -1
- package/dist/web/client/assets/api-HC_YzjBy.js +0 -1
- package/dist/web/client/assets/arrow-right-Gm_FDWJ_.js +0 -1
- package/dist/web/client/assets/attention-8ZkSLl2e.js +0 -1
- package/dist/web/client/assets/check-BjgKoGvU.js +0 -1
- package/dist/web/client/assets/config-Con_BbSh.js +0 -1
- package/dist/web/client/assets/createLucideIcon-C6gOo8sD.js +0 -1
- package/dist/web/client/assets/index-Br9qkGM-.js +0 -54
- package/dist/web/client/assets/link-Cbztlp_R.js +0 -1
- package/dist/web/client/assets/login-llnOKSJc.js +0 -1
- package/dist/web/client/assets/mcp-zIUguMSI.js +0 -1
- package/dist/web/client/assets/plus-CWrKMtvA.js +0 -1
- package/dist/web/client/assets/routes-BY5uqJ2n.js +0 -76
- package/dist/web/client/assets/save-f9O-CQia.js +0 -1
- package/dist/web/client/assets/services-esLrcTwe.js +0 -1
- package/dist/web/client/assets/skills-DzYXksM0.js +0 -1
- package/dist/web/client/assets/style-Cdzqt_TJ.js +0 -7
- package/dist/web/client/assets/styles-BRSS6yrm.css +0 -2
- package/dist/web/client/assets/system-CsI66nyZ.js +0 -1
- package/dist/web/client/assets/teams-CHE_zpxS.js +0 -1
- package/dist/web/client/assets/teams-dxG9OESG.js +0 -1
- package/dist/web/client/assets/telegram-C3dGndJV.js +0 -1
- package/dist/web/client/assets/tokens-CNNH-Wr9.js +0 -1
- package/dist/web/client/assets/use-resource-BjnxgGvh.js +0 -1
- package/dist/web/client/assets/welcome-C8EOtc8P.js +0 -1
- package/dist/web/server/assets/FieldRow-CHVhX2rS.js +0 -173
- package/dist/web/server/assets/ModelSelect-DrZrdndo.js +0 -43
- package/dist/web/server/assets/SkillFindings-DSDiL6hn.js +0 -46
- package/dist/web/server/assets/SkillsPicker-DlqEfRWh.js +0 -67
- package/dist/web/server/assets/SpawnDialog-BUUlLxE9.js +0 -129
- package/dist/web/server/assets/Tabs-BhF41MfQ.js +0 -20
- package/dist/web/server/assets/TeamForm-CvQAs2FA.js +0 -96
- package/dist/web/server/assets/_id-BvAaRSUW.js +0 -18
- package/dist/web/server/assets/_id-Dg6M_qfr.js +0 -383
- package/dist/web/server/assets/_id-Dji7xr9C.js +0 -28
- package/dist/web/server/assets/_tanstack-start-manifest_v-sxiIH4M7.js +0 -214
- package/dist/web/server/assets/agents-BDA5yYZ2.js +0 -130
- package/dist/web/server/assets/agents-BTDxmp-F.js +0 -12
- package/dist/web/server/assets/agents-DM7guWF2.js +0 -14
- package/dist/web/server/assets/agents-DktqUffG.js +0 -327
- package/dist/web/server/assets/agents-xgZ9rsac.js +0 -27
- package/dist/web/server/assets/attention-De3-ehuf.js +0 -216
- package/dist/web/server/assets/mcp-CO_tycXU.js +0 -250
- package/dist/web/server/assets/services-DZLxUSG8.js +0 -13
- package/dist/web/server/assets/services-DsHRLL8q.js +0 -12
- package/dist/web/server/assets/services-DsvpaF3L.js +0 -74
- package/dist/web/server/assets/skills-DKYV7PTk.js +0 -275
- package/dist/web/server/assets/system-CZ2qzBz3.js +0 -138
- package/dist/web/server/assets/teams-B6PzNcoy.js +0 -88
- package/dist/web/server/assets/teams-C-8iz-uV.js +0 -108
- package/dist/web/server/assets/telegram-CXrP3hMp.js +0 -984
- package/dist/web/server/assets/tokens-DSLwQ1Pw.js +0 -232
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
import { E as errorMessage, d as Button, w as api } from "./workspace-DeEYMPDX.js";
|
|
2
|
-
import { t as ConfirmDialog } from "./ConfirmDialog-B79K2KEW.js";
|
|
3
|
-
import { i as ItemRow, l as StatusBadge, r as ItemList, s as SectionCard } from "./createSsrRpc-CcLbajrF.js";
|
|
4
|
-
import { t as Route } from "./tokens-C-oDTqnp.js";
|
|
5
|
-
import { t as ConfigPage } from "./ConfigPage-CIh3ohea.js";
|
|
6
|
-
import { useState } from "react";
|
|
7
|
-
import { useRouter } from "@tanstack/react-router";
|
|
8
|
-
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
-
//#region src/routes/config/tokens.tsx?tsr-split=component
|
|
10
|
-
function when(timestamp) {
|
|
11
|
-
return new Date(timestamp).toISOString().slice(0, 16).replace("T", " ");
|
|
12
|
-
}
|
|
13
|
-
function TokensPage() {
|
|
14
|
-
const { tokens, sessions } = Route.useLoaderData();
|
|
15
|
-
const includeRevoked = Route.useSearch().all === 1;
|
|
16
|
-
const router = useRouter();
|
|
17
|
-
const [revokeToken, setRevokeToken] = useState(null);
|
|
18
|
-
const [revokeSession, setRevokeSession] = useState(null);
|
|
19
|
-
const usesToken = (token) => sessions.some((session) => session.current && session.tokenId === token?.id);
|
|
20
|
-
/** Revoking the session this browser uses signs it out. */
|
|
21
|
-
async function afterRevoke(signedOut) {
|
|
22
|
-
if (signedOut) window.location.assign("/login");
|
|
23
|
-
else await router.invalidate();
|
|
24
|
-
}
|
|
25
|
-
return /* @__PURE__ */ jsxs(ConfigPage, {
|
|
26
|
-
title: "API tokens",
|
|
27
|
-
description: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
28
|
-
"Every token has full access to the HTTP API, the CLI and browser login. The",
|
|
29
|
-
" ",
|
|
30
|
-
/* @__PURE__ */ jsx("code", {
|
|
31
|
-
className: "font-mono",
|
|
32
|
-
children: "bootstrap"
|
|
33
|
-
}),
|
|
34
|
-
" token from",
|
|
35
|
-
" ",
|
|
36
|
-
/* @__PURE__ */ jsx("code", {
|
|
37
|
-
className: "font-mono",
|
|
38
|
-
children: "~/.bazilion/auth.json"
|
|
39
|
-
}),
|
|
40
|
-
" cannot be revoked; mint a separate, revocable token for each other device."
|
|
41
|
-
] }),
|
|
42
|
-
children: [
|
|
43
|
-
/* @__PURE__ */ jsx(MintTokenForm, { onMinted: () => router.invalidate() }),
|
|
44
|
-
/* @__PURE__ */ jsx(SectionCard, {
|
|
45
|
-
title: "Tokens",
|
|
46
|
-
actions: /* @__PURE__ */ jsx("a", {
|
|
47
|
-
className: "ghost-btn",
|
|
48
|
-
href: includeRevoked ? "/config/tokens" : "/config/tokens?all=1",
|
|
49
|
-
children: includeRevoked ? "Hide revoked" : "Show revoked"
|
|
50
|
-
}),
|
|
51
|
-
children: tokens.length === 0 ? /* @__PURE__ */ jsx("p", {
|
|
52
|
-
className: "muted",
|
|
53
|
-
children: "No tokens yet; mint one above."
|
|
54
|
-
}) : /* @__PURE__ */ jsx(ItemList, { children: tokens.map((token) => {
|
|
55
|
-
const bootstrap = token.kind === "bootstrap";
|
|
56
|
-
const expired = token.expiresAt !== null && token.expiresAt <= Date.now();
|
|
57
|
-
return /* @__PURE__ */ jsx(ItemRow, {
|
|
58
|
-
title: token.label,
|
|
59
|
-
meta: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
60
|
-
/* @__PURE__ */ jsx(StatusBadge, {
|
|
61
|
-
variant: token.revokedAt || expired ? "neutral" : "success",
|
|
62
|
-
children: token.revokedAt ? "revoked" : expired ? "expired" : "active"
|
|
63
|
-
}),
|
|
64
|
-
/* @__PURE__ */ jsx("span", { children: bootstrap ? "bootstrap (auth.json)" : token.kind }),
|
|
65
|
-
/* @__PURE__ */ jsxs("span", { children: ["created ", when(token.createdAt)] }),
|
|
66
|
-
/* @__PURE__ */ jsxs("span", { children: ["last used ", token.lastUsedAt ? when(token.lastUsedAt) : "never"] }),
|
|
67
|
-
/* @__PURE__ */ jsxs("span", { children: ["expires ", token.expiresAt ? when(token.expiresAt) : "never"] }),
|
|
68
|
-
/* @__PURE__ */ jsx("code", { children: token.id })
|
|
69
|
-
] }),
|
|
70
|
-
actions: !token.revokedAt && !bootstrap && /* @__PURE__ */ jsx(Button, {
|
|
71
|
-
variant: "danger",
|
|
72
|
-
onClick: () => setRevokeToken(token),
|
|
73
|
-
children: "Revoke"
|
|
74
|
-
})
|
|
75
|
-
}, token.id);
|
|
76
|
-
}) })
|
|
77
|
-
}),
|
|
78
|
-
/* @__PURE__ */ jsx(SectionCard, {
|
|
79
|
-
title: "Browser sessions",
|
|
80
|
-
description: "A session ends after 30 days without use. Revoking a token also ends every session opened with it.",
|
|
81
|
-
children: sessions.length === 0 ? /* @__PURE__ */ jsx("p", {
|
|
82
|
-
className: "muted",
|
|
83
|
-
children: "No active browser sessions."
|
|
84
|
-
}) : /* @__PURE__ */ jsx(ItemList, { children: sessions.map((session) => /* @__PURE__ */ jsx(ItemRow, {
|
|
85
|
-
title: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
86
|
-
session.tokenLabel,
|
|
87
|
-
" ",
|
|
88
|
-
session.current && /* @__PURE__ */ jsx(StatusBadge, {
|
|
89
|
-
variant: "success",
|
|
90
|
-
children: "current"
|
|
91
|
-
})
|
|
92
|
-
] }),
|
|
93
|
-
meta: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
94
|
-
/* @__PURE__ */ jsxs("span", { children: ["last seen ", when(session.lastSeenAt)] }),
|
|
95
|
-
/* @__PURE__ */ jsxs("span", { children: ["expires ", when(session.expiresAt)] }),
|
|
96
|
-
/* @__PURE__ */ jsx("code", { children: session.id })
|
|
97
|
-
] }),
|
|
98
|
-
actions: /* @__PURE__ */ jsx(Button, {
|
|
99
|
-
variant: "danger",
|
|
100
|
-
onClick: () => setRevokeSession(session),
|
|
101
|
-
children: "Revoke"
|
|
102
|
-
})
|
|
103
|
-
}, session.id)) })
|
|
104
|
-
}),
|
|
105
|
-
/* @__PURE__ */ jsx(ConfirmDialog, {
|
|
106
|
-
open: revokeToken !== null,
|
|
107
|
-
title: `Revoke ${revokeToken?.label ?? ""}?`,
|
|
108
|
-
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
109
|
-
"This permanently revokes token ",
|
|
110
|
-
/* @__PURE__ */ jsx("code", {
|
|
111
|
-
className: "font-mono",
|
|
112
|
-
children: revokeToken?.id
|
|
113
|
-
}),
|
|
114
|
-
" and ends every browser session opened with it.",
|
|
115
|
-
usesToken(revokeToken) && " This includes the session you are using now."
|
|
116
|
-
] }),
|
|
117
|
-
confirmLabel: "Revoke token and sessions",
|
|
118
|
-
onConfirm: async () => {
|
|
119
|
-
if (!revokeToken) return;
|
|
120
|
-
await api(`/api/tokens/${encodeURIComponent(revokeToken.id)}`, { method: "DELETE" });
|
|
121
|
-
await afterRevoke(usesToken(revokeToken));
|
|
122
|
-
},
|
|
123
|
-
onOpenChange: (open) => {
|
|
124
|
-
if (!open) setRevokeToken(null);
|
|
125
|
-
}
|
|
126
|
-
}),
|
|
127
|
-
/* @__PURE__ */ jsx(ConfirmDialog, {
|
|
128
|
-
open: revokeSession !== null,
|
|
129
|
-
title: `Revoke the ${revokeSession?.tokenLabel ?? ""} browser session?`,
|
|
130
|
-
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
131
|
-
"This ends browser session ",
|
|
132
|
-
/* @__PURE__ */ jsx("code", {
|
|
133
|
-
className: "font-mono",
|
|
134
|
-
children: revokeSession?.id
|
|
135
|
-
}),
|
|
136
|
-
revokeSession?.current ? " and signs this browser out." : ". The token stays active for later logins."
|
|
137
|
-
] }),
|
|
138
|
-
confirmLabel: revokeSession?.current ? "Sign out this browser" : "Revoke session",
|
|
139
|
-
onConfirm: async () => {
|
|
140
|
-
if (!revokeSession) return;
|
|
141
|
-
await api(`/api/sessions/${encodeURIComponent(revokeSession.id)}`, { method: "DELETE" });
|
|
142
|
-
await afterRevoke(revokeSession.current);
|
|
143
|
-
},
|
|
144
|
-
onOpenChange: (open) => {
|
|
145
|
-
if (!open) setRevokeSession(null);
|
|
146
|
-
}
|
|
147
|
-
})
|
|
148
|
-
]
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
function MintTokenForm({ onMinted }) {
|
|
152
|
-
const [label, setLabel] = useState("");
|
|
153
|
-
const [expiresDays, setExpiresDays] = useState("");
|
|
154
|
-
const [created, setCreated] = useState(null);
|
|
155
|
-
const [error, setError] = useState(null);
|
|
156
|
-
const [busy, setBusy] = useState(false);
|
|
157
|
-
async function mint(event) {
|
|
158
|
-
event.preventDefault();
|
|
159
|
-
setError(null);
|
|
160
|
-
setBusy(true);
|
|
161
|
-
try {
|
|
162
|
-
const { token } = await api("/api/tokens", { body: {
|
|
163
|
-
label,
|
|
164
|
-
...expiresDays ? { expiresInDays: Number(expiresDays) } : {}
|
|
165
|
-
} });
|
|
166
|
-
setCreated(token);
|
|
167
|
-
setLabel("");
|
|
168
|
-
setExpiresDays("");
|
|
169
|
-
await onMinted();
|
|
170
|
-
} catch (cause) {
|
|
171
|
-
setError(errorMessage(cause));
|
|
172
|
-
} finally {
|
|
173
|
-
setBusy(false);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
return /* @__PURE__ */ jsxs(SectionCard, {
|
|
177
|
-
title: "Mint a new token",
|
|
178
|
-
children: [
|
|
179
|
-
/* @__PURE__ */ jsxs("form", {
|
|
180
|
-
onSubmit: (event) => void mint(event),
|
|
181
|
-
className: "flex flex-col items-stretch gap-x-3 sm:flex-row sm:items-end",
|
|
182
|
-
children: [
|
|
183
|
-
/* @__PURE__ */ jsxs("label", {
|
|
184
|
-
className: "sm:w-72",
|
|
185
|
-
children: ["Label", /* @__PURE__ */ jsx("input", {
|
|
186
|
-
type: "text",
|
|
187
|
-
value: label,
|
|
188
|
-
onChange: (event) => setLabel(event.target.value),
|
|
189
|
-
required: true,
|
|
190
|
-
placeholder: "e.g. laptop-tailscale",
|
|
191
|
-
autoComplete: "off"
|
|
192
|
-
})]
|
|
193
|
-
}),
|
|
194
|
-
/* @__PURE__ */ jsxs("label", {
|
|
195
|
-
className: "sm:w-40",
|
|
196
|
-
children: ["Expires in days", /* @__PURE__ */ jsx("input", {
|
|
197
|
-
type: "number",
|
|
198
|
-
min: 1,
|
|
199
|
-
value: expiresDays,
|
|
200
|
-
onChange: (event) => setExpiresDays(event.target.value),
|
|
201
|
-
placeholder: "never"
|
|
202
|
-
})]
|
|
203
|
-
}),
|
|
204
|
-
/* @__PURE__ */ jsx(Button, {
|
|
205
|
-
variant: "primary",
|
|
206
|
-
type: "submit",
|
|
207
|
-
disabled: busy,
|
|
208
|
-
className: "mb-[0.6rem]",
|
|
209
|
-
children: busy ? "Creating…" : "Create"
|
|
210
|
-
})
|
|
211
|
-
]
|
|
212
|
-
}),
|
|
213
|
-
created && /* @__PURE__ */ jsxs("div", {
|
|
214
|
-
className: "rounded-md border border-warning/25 bg-warning/10 p-3",
|
|
215
|
-
children: [/* @__PURE__ */ jsx("p", {
|
|
216
|
-
className: "mb-1 text-xs text-warning",
|
|
217
|
-
children: "Copy this token now; it cannot be shown again."
|
|
218
|
-
}), /* @__PURE__ */ jsx("pre", {
|
|
219
|
-
className: "whitespace-pre-wrap break-all font-mono text-xs",
|
|
220
|
-
children: created
|
|
221
|
-
})]
|
|
222
|
-
}),
|
|
223
|
-
error && /* @__PURE__ */ jsx("p", {
|
|
224
|
-
role: "alert",
|
|
225
|
-
className: "text-sm text-danger",
|
|
226
|
-
children: error
|
|
227
|
-
})
|
|
228
|
-
]
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
//#endregion
|
|
232
|
-
export { TokensPage as component };
|