@sixb/server 0.1.23 → 0.1.25

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/index.js CHANGED
@@ -10,7 +10,6 @@ import { setApiPublicOrigin } from "@sixb/core/internal/runtime";
10
10
  import { checkPipelineMarkings, warmAppliedMarkings } from "@sixb/core/internal/security";
11
11
  import { Elysia, ParseError } from "elysia";
12
12
  import { websocket as elysiaWebSocket } from "elysia/ws";
13
- import { zodToJsonSchema as zodToJsonSchema3 } from "zod-to-json-schema";
14
13
 
15
14
  // src/auth/browser-origin.ts
16
15
  class BrowserOriginError extends Error {
@@ -1451,6 +1450,9 @@ var ModelCatalogSchema = z7.object({
1451
1450
  audio: z7.object({
1452
1451
  speech: z7.array(SpeechModelSchema),
1453
1452
  transcription: z7.array(TranscriptionModelSchema)
1453
+ }),
1454
+ capabilities: z7.object({
1455
+ run: z7.boolean()
1454
1456
  })
1455
1457
  });
1456
1458
  var ModelReasoningLevelSchema = z7.enum(MODEL_REASONING_LEVELS);
@@ -1527,8 +1529,13 @@ var FileGenerationSchema = GenerationResultBase.extend({
1527
1529
  files: z7.array(FileRefSchema),
1528
1530
  warnings: z7.array(z7.string())
1529
1531
  });
1532
+ var BASE64_PATTERN = /^[A-Za-z0-9+/]*={0,2}$/;
1533
+ var InlineAudioSchema = z7.object({
1534
+ data: z7.string().min(1).regex(BASE64_PATTERN, "Invalid base64").refine((data) => data.length % 4 === 0, "Invalid base64"),
1535
+ mediaType: z7.string().min(1)
1536
+ });
1530
1537
  var TranscriptionBodySchema = GenerationBodyBase.extend({
1531
- audio: FileRefSchema
1538
+ audio: z7.union([FileRefSchema, InlineAudioSchema])
1532
1539
  });
1533
1540
  var TranscriptionSchema = GenerationResultBase.extend({
1534
1541
  text: z7.string()
@@ -2191,6 +2198,17 @@ function openApiOverride(except) {
2191
2198
  return name === undefined ? ignoreOverride2 : { $ref: `#/components/schemas/${name}` };
2192
2199
  };
2193
2200
  }
2201
+ function openApiJsonSchema(schema) {
2202
+ return zodToJsonSchema(schema, {
2203
+ $refStrategy: "none",
2204
+ target: "openApi3",
2205
+ override: openApiOverride()
2206
+ });
2207
+ }
2208
+ function jsonRequestBody(schema) {
2209
+ const jsonSchema = openApiJsonSchema(schema);
2210
+ return { required: true, content: { "application/json": { schema: jsonSchema } } };
2211
+ }
2194
2212
  var NamedOpenApiSchemas = Object.fromEntries(NAMED.map(([name, schema]) => [
2195
2213
  name,
2196
2214
  zodToJsonSchema(schema, {
@@ -10964,6 +10982,27 @@ function generationError(error, set) {
10964
10982
  }
10965
10983
  return handleRouteError(error, set);
10966
10984
  }
10985
+ async function readTranscriptionBody(request) {
10986
+ const bytes = await readRequestBodyWithLimit(request, DEFAULT_SIMPLE_FILE_UPLOAD_BODY_BYTES);
10987
+ let json;
10988
+ try {
10989
+ json = JSON.parse(new TextDecoder().decode(bytes));
10990
+ } catch {
10991
+ throw new TypeError("[SixbServer] Transcription request body must be JSON.");
10992
+ }
10993
+ const parsed = TranscriptionBodySchema.safeParse(json);
10994
+ if (!parsed.success) {
10995
+ const [issue] = parsed.error.issues;
10996
+ throw new TypeError(`[SixbServer] Invalid transcription request: ${issue?.path.join(".") || "body"}: ${issue?.message}`);
10997
+ }
10998
+ return parsed.data;
10999
+ }
11000
+ function transcriptionAudio(audio) {
11001
+ if ("data" in audio) {
11002
+ return { data: Buffer.from(audio.data, "base64"), mediaType: audio.mediaType };
11003
+ }
11004
+ return audio;
11005
+ }
10967
11006
  var responses = {
10968
11007
  400: ErrorResponseSchema,
10969
11008
  403: ErrorResponseSchema,
@@ -11054,12 +11093,17 @@ function registerModelGenerationRoutes(app, host) {
11054
11093
  response: { 200: FileGenerationSchema, ...responses },
11055
11094
  detail: detail("generateSpeech", "Generate speech with a speech model")
11056
11095
  }).post("/api/models/audio/transcriptions", async (context) => {
11057
- const { body, request, set } = context;
11096
+ const { request, set } = context;
11058
11097
  try {
11059
11098
  const sixb = requireRequestSixb(context);
11099
+ if (!sixb.models.canRun()) {
11100
+ set.status = 403;
11101
+ return { error: "[SixbServer] Transcribing audio requires can.run(project.models)." };
11102
+ }
11103
+ const body = await readTranscriptionBody(request);
11060
11104
  const entry = selectBinding(catalog()?.audio?.transcription, "transcription", body.model);
11061
11105
  const call = await sixb.models.audio.transcribe({
11062
- audio: body.audio,
11106
+ audio: transcriptionAudio(body.audio),
11063
11107
  model: entry.model,
11064
11108
  signal: request.signal
11065
11109
  });
@@ -11068,9 +11112,12 @@ function registerModelGenerationRoutes(app, host) {
11068
11112
  return generationError(error, set);
11069
11113
  }
11070
11114
  }, {
11071
- body: TranscriptionBodySchema,
11072
- response: { 200: TranscriptionSchema, ...responses },
11073
- detail: detail("transcribeAudio", "Transcribe audio with a transcription model")
11115
+ parse: "none",
11116
+ response: { 200: TranscriptionSchema, 413: ErrorResponseSchema, ...responses },
11117
+ detail: {
11118
+ ...detail("transcribeAudio", "Transcribe audio with a transcription model"),
11119
+ requestBody: jsonRequestBody(TranscriptionBodySchema)
11120
+ }
11074
11121
  });
11075
11122
  }
11076
11123
 
@@ -11240,7 +11287,7 @@ async function serializeTranscriptionModel(entry, defaultEntry) {
11240
11287
  };
11241
11288
  }
11242
11289
  function registerModelRoutes(app, host) {
11243
- return app.get("/api/models", async () => {
11290
+ return app.get("/api/models", async (context) => {
11244
11291
  const models = host.definitions.models;
11245
11292
  const language = models?.language;
11246
11293
  const image = models?.image;
@@ -11253,7 +11300,8 @@ function registerModelRoutes(app, host) {
11253
11300
  audio: {
11254
11301
  speech: speech ? await Promise.all(speech.list().map((entry) => serializeSpeechModel(entry, speech.default))) : [],
11255
11302
  transcription: transcription ? await Promise.all(transcription.list().map((entry) => serializeTranscriptionModel(entry, transcription.default))) : []
11256
- }
11303
+ },
11304
+ capabilities: { run: requireRequestSixb(context).models.canRun() }
11257
11305
  });
11258
11306
  }, {
11259
11307
  response: { 200: ModelCatalogSchema },
@@ -14863,24 +14911,26 @@ function registerAuthRoutes(app, host, options) {
14863
14911
  }).get("/auth/device", async ({ request }) => {
14864
14912
  const rawUserCode = new URL(request.url).searchParams.get("user_code");
14865
14913
  if (!rawUserCode) {
14866
- return authPageResponse([
14914
+ return devicePageResponse([
14915
+ deviceTileEmblem("monitor"),
14867
14916
  "<h1>Authorize a device</h1>",
14917
+ "<p>Enter the code shown on the device you're signing in.</p>",
14868
14918
  '<form method="get" action="/auth/device">',
14869
- '<input name="user_code" autocomplete="one-time-code" placeholder="BCDF-HJKM" aria-label="Device code" required autofocus>',
14919
+ '<input class="code-input" name="user_code" type="text" autocomplete="one-time-code" autocapitalize="characters" spellcheck="false" placeholder="BCDF-HJKM" aria-label="Device code" required autofocus>',
14870
14920
  '<button type="submit">Continue</button>',
14871
14921
  "</form>"
14872
14922
  ].join(""));
14873
14923
  }
14874
14924
  const userCode = normalizeDeviceUserCode(rawUserCode);
14875
14925
  if (!userCode)
14876
- return authPageResponse("<h1>Invalid authorization</h1>", 400);
14926
+ return invalidDeviceAuthorizationResponse();
14877
14927
  const authorization = await requireAuthStorage(host).deviceAuthorizations.getByUserCode({
14878
14928
  projectId: host.id,
14879
14929
  userCode
14880
14930
  });
14881
14931
  const now = new Date;
14882
14932
  if (!authorization || authorization.status !== "pending" || authorization.expiresAt <= now) {
14883
- return authPageResponse("<h1>This authorization has expired</h1>", 400);
14933
+ return expiredDeviceAuthorizationResponse();
14884
14934
  }
14885
14935
  const session = await host.auth.getSession(request);
14886
14936
  if (!session.authenticated)
@@ -14891,20 +14941,25 @@ function registerAuthRoutes(app, host, options) {
14891
14941
  cookieOptions,
14892
14942
  expiresAt: session.session.expiresAt
14893
14943
  });
14894
- const groups = session.groupIds.length ? `<p>Groups: ${escapeHtml(session.groupIds.join(", "))}</p>` : "<p>Groups: none</p>";
14895
- const response = authPageResponse([
14944
+ const groupLabels = new Map(host.definitions.security.listGroups().map((group) => [group.id, group.label ?? group.id]));
14945
+ const groups = session.groupIds.map((id) => groupLabels.get(id) ?? id).join(", ") || "None";
14946
+ const response = devicePageResponse([
14947
+ deviceLinkEmblem("waiting", accountInitials(session.user)),
14896
14948
  "<h1>Authorize this device?</h1>",
14897
14949
  `<p><strong>${escapeHtml(authorization.clientName)}</strong> is requesting to sign in as you.</p>`,
14898
- `<p>Code: <strong>${escapeHtml(authorization.userCode)}</strong></p>`,
14899
- "<p>Authorize it only if you started this sign-in, and the device asking shows this same code.</p>",
14900
- "<p>It stays signed in until you sign it out or it goes unused for a while.</p>",
14901
- groups,
14902
- '<form method="post" action="/auth/device">',
14950
+ deviceUserCodeHtml(authorization.userCode),
14951
+ '<p class="hint">Authorize it only if you started this sign-in, and the device asking shows this same code.</p>',
14952
+ '<dl class="details">',
14953
+ `<div><dt>Account</dt><dd title="${escapeHtml(session.user.email)}">${escapeHtml(session.user.email)}</dd></div>`,
14954
+ `<div><dt>Groups</dt><dd title="${escapeHtml(groups)}">${escapeHtml(groups)}</dd></div>`,
14955
+ "</dl>",
14956
+ '<form class="actions" method="post" action="/auth/device">',
14903
14957
  `<input type="hidden" name="userCode" value="${escapeHtml(userCode)}">`,
14904
14958
  `<input type="hidden" name="csrfToken" value="${escapeHtml(csrf.token)}">`,
14959
+ '<button class="secondary" name="decision" value="deny" type="submit">Deny</button>',
14905
14960
  '<button name="decision" value="approve" type="submit">Authorize</button>',
14906
- '<button name="decision" value="deny" type="submit">Deny</button>',
14907
- "</form>"
14961
+ "</form>",
14962
+ '<p class="footnote">It stays signed in until you sign it out or it goes unused for a while.</p>'
14908
14963
  ].join(""));
14909
14964
  if (csrf.setCookie)
14910
14965
  response.headers.append("set-cookie", csrf.setCookie);
@@ -14916,7 +14971,11 @@ function registerAuthRoutes(app, host, options) {
14916
14971
  return authPageResponse("<h1>Authentication required</h1>", 401);
14917
14972
  const csrfCookieName = host.auth.getCookieOptions().csrfCookieName;
14918
14973
  if (!verifyCsrfToken(request, { cookieName: csrfCookieName, token: parsed.csrfToken })) {
14919
- return authPageResponse("<h1>Invalid authorization request</h1>", 403);
14974
+ return devicePageResponse([
14975
+ deviceTileEmblem("alert"),
14976
+ "<h1>Invalid authorization request</h1>",
14977
+ "<p>Reload the approval page and try again.</p>"
14978
+ ].join(""), { status: 403 });
14920
14979
  }
14921
14980
  const storage = requireAuthStorage(host);
14922
14981
  const authorization = await storage.deviceAuthorizations.getByUserCode({
@@ -14924,7 +14983,7 @@ function registerAuthRoutes(app, host, options) {
14924
14983
  userCode: parsed.userCode
14925
14984
  });
14926
14985
  if (!authorization)
14927
- return authPageResponse("<h1>Invalid authorization</h1>", 400);
14986
+ return invalidDeviceAuthorizationResponse();
14928
14987
  const decidedAt = new Date;
14929
14988
  try {
14930
14989
  if (parsed.decision === "approve") {
@@ -14944,11 +15003,22 @@ function registerAuthRoutes(app, host, options) {
14944
15003
  }
14945
15004
  } catch (error) {
14946
15005
  if (error instanceof AuthStorageError && error.code === "invalid_device_authorization") {
14947
- return authPageResponse("<h1>This authorization has expired</h1>", 400);
15006
+ return expiredDeviceAuthorizationResponse();
14948
15007
  }
14949
15008
  throw error;
14950
15009
  }
14951
- return authPageResponse(parsed.decision === "approve" ? "<h1>Device authorized</h1><p>You can close this window.</p>" : "<h1>Authorization denied</h1><p>You can close this window.</p>");
15010
+ const client = `<strong>${escapeHtml(authorization.clientName)}</strong>`;
15011
+ return devicePageResponse((parsed.decision === "approve" ? [
15012
+ deviceLinkEmblem("approved", accountInitials(session.user)),
15013
+ "<h1>Device authorized</h1>",
15014
+ `<p>${client} is signed in as you.</p>`,
15015
+ '<p class="footnote">You can close this window.<br>Sign it out anytime from Settings &rsaquo; Personal.</p>'
15016
+ ] : [
15017
+ deviceLinkEmblem("denied", accountInitials(session.user)),
15018
+ "<h1>Authorization denied</h1>",
15019
+ `<p>${client} was not signed in.</p>`,
15020
+ '<p class="footnote">You can close this window.</p>'
15021
+ ]).join(""));
14952
15022
  }, {
14953
15023
  body: t.Object({
14954
15024
  userCode: t.String(),
@@ -15016,10 +15086,11 @@ function registerAuthRoutes(app, host, options) {
15016
15086
  return deviceSignInPendingResponse(authorization.userCode, deviceVerificationUrl(options, request, authorization.userCode));
15017
15087
  }
15018
15088
  if (authorization || url.searchParams.has("user_code")) {
15019
- const response = authPageResponse([
15020
- authorization?.status === "denied" ? "<h1>Sign-in was denied</h1>" : "<h1>This sign-in request has expired</h1>",
15021
- `<p><a href="${escapeHtml(deviceSignInPath(url, null))}">Try again</a></p>`
15022
- ].join(""), 400);
15089
+ const response = devicePageResponse([
15090
+ ...authorization?.status === "denied" ? [deviceLinkEmblem("denied", null), "<h1>Sign-in was denied</h1>"] : [deviceTileEmblem("clock"), "<h1>This sign-in request has expired</h1>"],
15091
+ "<p>Start again to get a new code.</p>",
15092
+ `<a class="button" href="${escapeHtml(deviceSignInPath(url, null))}">Try again</a>`
15093
+ ].join(""), { status: 400, title: "Sign in" });
15023
15094
  response.headers.append("set-cookie", clearCookie);
15024
15095
  return response;
15025
15096
  }
@@ -16011,19 +16082,79 @@ function deviceVerificationUrl(options, request, userCode) {
16011
16082
  return url.toString();
16012
16083
  }
16013
16084
  function deviceSignInPendingResponse(userCode, verificationUrl) {
16014
- return new Response(authPageDocument([
16085
+ return devicePageResponse([
16086
+ deviceLinkEmblem("waiting", null),
16015
16087
  "<h1>Continue in your browser</h1>",
16016
16088
  "<p>Approve this sign-in from a browser where you are signed in. This page continues on its own.</p>",
16017
- `<p>Code: <strong>${escapeHtml(userCode)}</strong></p>`,
16018
- `<p><a href="${escapeHtml(verificationUrl)}" target="_blank" rel="noopener">Open the approval page</a></p>`
16019
- ].join(""), "Sign in", `<meta http-equiv="refresh" content="${DEVICE_AUTHORIZATION_POLL_INTERVAL_SECONDS}">`), {
16020
- status: 200,
16089
+ deviceUserCodeHtml(userCode),
16090
+ `<a class="button secondary" href="${escapeHtml(verificationUrl)}" target="_blank" rel="noopener">Open the approval page</a>`,
16091
+ '<p class="status">Waiting for approval</p>'
16092
+ ].join(""), {
16093
+ title: "Sign in",
16094
+ head: `<meta http-equiv="refresh" content="${DEVICE_AUTHORIZATION_POLL_INTERVAL_SECONDS}">`
16095
+ });
16096
+ }
16097
+ function devicePageResponse(body, options = {}) {
16098
+ return new Response(authPageDocument(`<div class="device">${body}</div>`, options.title ?? "Authorize device", `${DEVICE_PAGE_STYLE}${options.head ?? ""}`), {
16099
+ status: options.status ?? 200,
16021
16100
  headers: {
16022
16101
  "content-type": "text/html; charset=utf-8",
16023
16102
  "cache-control": "no-store"
16024
16103
  }
16025
16104
  });
16026
16105
  }
16106
+ function expiredDeviceAuthorizationResponse() {
16107
+ return devicePageResponse([
16108
+ deviceTileEmblem("clock"),
16109
+ "<h1>This authorization has expired</h1>",
16110
+ "<p>Start the sign-in again on your device to get a new code.</p>"
16111
+ ].join(""), { status: 400 });
16112
+ }
16113
+ function invalidDeviceAuthorizationResponse() {
16114
+ return devicePageResponse([
16115
+ deviceTileEmblem("alert"),
16116
+ "<h1>Invalid authorization</h1>",
16117
+ "<p>Check the code shown on your device and enter it again.</p>",
16118
+ '<a class="button" href="/auth/device">Enter the code</a>'
16119
+ ].join(""), { status: 400 });
16120
+ }
16121
+ var DEVICE_ICONS = {
16122
+ monitor: '<rect width="20" height="14" x="2" y="3" rx="2"/><path d="M8 21h8"/><path d="M12 17v4"/>',
16123
+ user: '<circle cx="12" cy="8" r="4"/><path d="M20 21a8 8 0 0 0-16 0"/>',
16124
+ check: '<path d="M20 6 9 17l-5-5"/>',
16125
+ cross: '<path d="M18 6 6 18"/><path d="m6 6 12 12"/>',
16126
+ clock: '<circle cx="12" cy="12" r="10"/><path d="M12 6v6l4 2"/>',
16127
+ alert: '<circle cx="12" cy="12" r="10"/><path d="M12 8v4"/><path d="M12 16h.01"/>'
16128
+ };
16129
+ function deviceIcon(name) {
16130
+ return `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${DEVICE_ICONS[name]}</svg>`;
16131
+ }
16132
+ function deviceLinkEmblem(state, initials) {
16133
+ const badge = state === "waiting" ? "" : `<span class="badge">${deviceIcon(state === "approved" ? "check" : "cross")}</span>`;
16134
+ return [
16135
+ `<div class="emblem emblem-${state}" aria-hidden="true">`,
16136
+ `<span class="tile">${deviceIcon("monitor")}</span>`,
16137
+ `<span class="link">${badge}</span>`,
16138
+ `<span class="tile tile-account">${initials ? escapeHtml(initials) : deviceIcon("user")}</span>`,
16139
+ "</div>"
16140
+ ].join("");
16141
+ }
16142
+ function deviceTileEmblem(icon) {
16143
+ return `<div class="emblem" aria-hidden="true"><span class="tile">${deviceIcon(icon)}</span></div>`;
16144
+ }
16145
+ function deviceUserCodeHtml(userCode) {
16146
+ const cells = [...userCode].map((character) => character === "-" ? '<span class="code-dash"></span>' : `<span>${escapeHtml(character)}</span>`);
16147
+ return [
16148
+ `<p class="sr-only">Code: ${escapeHtml(userCode)}</p>`,
16149
+ `<div class="code" aria-hidden="true">${cells.join("")}</div>`
16150
+ ].join("");
16151
+ }
16152
+ function accountInitials(user) {
16153
+ const words = (user.displayName?.trim() || user.email).split(/\s+/);
16154
+ const first = words[0] ?? "";
16155
+ const last = words.length > 1 ? words.at(-1) ?? "" : "";
16156
+ return `${[...first][0] ?? ""}${[...last][0] ?? ""}`.toUpperCase();
16157
+ }
16027
16158
  var MAGIC_LINK_PENDING_COOKIE_NAME = "sixb_pending";
16028
16159
  var MAGIC_LINK_PENDING_COOKIE_FALLBACK_MAX_AGE_SECONDS = 15 * 60;
16029
16160
  function magicLinkPendingCookieMaxAgeSeconds(strategy) {
@@ -16265,7 +16396,9 @@ var AUTH_PAGE_STYLE = `<style>
16265
16396
  --primary: #0a0a0a;
16266
16397
  --primary-foreground: #ffffff;
16267
16398
  --border: #e2e2e2;
16399
+ --muted: #f4f4f4;
16268
16400
  --muted-foreground: #5f5f5f;
16401
+ --success: #16a34a;
16269
16402
  --ring: #0a0a0a;
16270
16403
  --radius: 0.5rem;
16271
16404
  }
@@ -16277,7 +16410,9 @@ var AUTH_PAGE_STYLE = `<style>
16277
16410
  --primary: #f4f4f4;
16278
16411
  --primary-foreground: #0a0a0a;
16279
16412
  --border: #262626;
16413
+ --muted: #1c1c1c;
16280
16414
  --muted-foreground: #8a8a8a;
16415
+ --success: #22c55e;
16281
16416
  --ring: #f4f4f4;
16282
16417
  }
16283
16418
  }
@@ -16376,6 +16511,232 @@ button:disabled { cursor: default; }
16376
16511
  }
16377
16512
  @keyframes spin { to { transform: rotate(360deg); } }
16378
16513
  </style>`;
16514
+ var DEVICE_PAGE_STYLE = `<style>
16515
+ .device {
16516
+ --line: color-mix(in srgb, var(--muted-foreground) 55%, transparent);
16517
+ text-align: center;
16518
+ }
16519
+ .device h1 { margin-top: 1.5rem; }
16520
+ .device h1,
16521
+ .device p { text-wrap: balance; }
16522
+ .device p strong { overflow-wrap: anywhere; }
16523
+ .sr-only {
16524
+ position: absolute;
16525
+ width: 1px;
16526
+ height: 1px;
16527
+ margin: -1px;
16528
+ overflow: hidden;
16529
+ clip: rect(0, 0, 0, 0);
16530
+ white-space: nowrap;
16531
+ }
16532
+ .emblem {
16533
+ display: flex;
16534
+ align-items: center;
16535
+ justify-content: center;
16536
+ }
16537
+ .tile {
16538
+ display: grid;
16539
+ flex: none;
16540
+ place-items: center;
16541
+ width: 3rem;
16542
+ height: 3rem;
16543
+ color: var(--foreground);
16544
+ background: var(--card);
16545
+ border: 1px solid var(--border);
16546
+ border-radius: 0.875rem;
16547
+ box-shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 6px 16px -8px rgb(0 0 0 / 0.14);
16548
+ }
16549
+ .tile svg { width: 1.375rem; height: 1.375rem; }
16550
+ .tile-account {
16551
+ color: var(--primary-foreground);
16552
+ background: var(--primary);
16553
+ border-color: var(--primary);
16554
+ font-size: 0.9375rem;
16555
+ font-weight: 600;
16556
+ letter-spacing: 0.02em;
16557
+ }
16558
+ .link {
16559
+ position: relative;
16560
+ width: 4rem;
16561
+ height: 1px;
16562
+ margin: 0 0.5rem;
16563
+ background: linear-gradient(to right, var(--line) 50%, transparent 0) 50% 0 / 6px 1px repeat-x;
16564
+ }
16565
+ .emblem-waiting .link::after {
16566
+ content: "";
16567
+ position: absolute;
16568
+ top: 50%;
16569
+ left: 0;
16570
+ width: 5px;
16571
+ height: 5px;
16572
+ margin: -2.5px 0 0 -2.5px;
16573
+ background: var(--foreground);
16574
+ border-radius: 50%;
16575
+ animation: travel 2s cubic-bezier(0.45, 0, 0.55, 1) infinite;
16576
+ }
16577
+ .emblem-approved .link { background: var(--success); }
16578
+ .badge {
16579
+ position: absolute;
16580
+ top: 50%;
16581
+ left: 50%;
16582
+ display: grid;
16583
+ place-items: center;
16584
+ width: 1.5rem;
16585
+ height: 1.5rem;
16586
+ margin: -0.75rem 0 0 -0.75rem;
16587
+ border-radius: 50%;
16588
+ box-shadow: 0 0 0 4px var(--background);
16589
+ animation: pop 0.5s 0.15s cubic-bezier(0.34, 1.56, 0.64, 1) both;
16590
+ }
16591
+ .badge svg { width: 0.875rem; height: 0.875rem; stroke-width: 3; }
16592
+ .badge path {
16593
+ stroke-dasharray: 24;
16594
+ stroke-dashoffset: 24;
16595
+ animation: draw 0.35s 0.4s ease-out forwards;
16596
+ }
16597
+ .emblem-approved .badge { color: #ffffff; background: var(--success); }
16598
+ .emblem-denied .badge {
16599
+ color: var(--muted-foreground);
16600
+ background: var(--muted);
16601
+ box-shadow: 0 0 0 4px var(--background), inset 0 0 0 1px var(--border);
16602
+ }
16603
+ .code {
16604
+ display: grid;
16605
+ grid-template-columns: repeat(4, 1fr) 0.75rem repeat(4, 1fr);
16606
+ gap: 0.25rem;
16607
+ margin-top: 1.5rem;
16608
+ }
16609
+ .code span {
16610
+ display: grid;
16611
+ place-items: center;
16612
+ height: 2.75rem;
16613
+ font-family: "SF Mono", "Geist Mono", "JetBrains Mono", ui-monospace, monospace;
16614
+ font-size: 1.125rem;
16615
+ font-weight: 500;
16616
+ background: var(--card);
16617
+ border: 1px solid var(--border);
16618
+ border-radius: calc(var(--radius) - 2px);
16619
+ box-shadow: 0 1px 2px rgb(0 0 0 / 0.04);
16620
+ }
16621
+ .code .code-dash {
16622
+ align-self: center;
16623
+ height: 2px;
16624
+ background: var(--border);
16625
+ border: 0;
16626
+ border-radius: 1px;
16627
+ box-shadow: none;
16628
+ }
16629
+ .hint { margin-top: 0.875rem; font-size: 0.8125rem; }
16630
+ .details {
16631
+ margin: 1.5rem 0 0;
16632
+ padding: 0 0.875rem;
16633
+ text-align: left;
16634
+ font-size: 0.8125rem;
16635
+ background: var(--card);
16636
+ border: 1px solid var(--border);
16637
+ border-radius: var(--radius);
16638
+ }
16639
+ .details div {
16640
+ display: flex;
16641
+ justify-content: space-between;
16642
+ gap: 1rem;
16643
+ padding: 0.625rem 0;
16644
+ }
16645
+ .details div + div { border-top: 1px solid var(--border); }
16646
+ .details dt { flex: none; color: var(--muted-foreground); }
16647
+ .details dd {
16648
+ min-width: 0;
16649
+ margin: 0;
16650
+ overflow: hidden;
16651
+ font-weight: 500;
16652
+ text-overflow: ellipsis;
16653
+ white-space: nowrap;
16654
+ }
16655
+ .device form { margin-top: 1.5rem; }
16656
+ .device input.code-input {
16657
+ height: 3rem;
16658
+ font-family: "SF Mono", "Geist Mono", "JetBrains Mono", ui-monospace, monospace;
16659
+ font-size: 1.25rem;
16660
+ font-weight: 500;
16661
+ text-align: center;
16662
+ /* Letter spacing trails the last character; the indent balances it. */
16663
+ text-indent: 0.2em;
16664
+ letter-spacing: 0.2em;
16665
+ text-transform: uppercase;
16666
+ }
16667
+ .device input.code-input::placeholder {
16668
+ color: color-mix(in srgb, var(--muted-foreground) 50%, transparent);
16669
+ }
16670
+ .actions {
16671
+ display: grid;
16672
+ grid-template-columns: 1fr 1fr;
16673
+ gap: 0.5rem;
16674
+ }
16675
+ .actions button { margin-top: 0; }
16676
+ .button {
16677
+ display: flex;
16678
+ align-items: center;
16679
+ justify-content: center;
16680
+ height: 2.5rem;
16681
+ margin-top: 1.5rem;
16682
+ font-size: 0.875rem;
16683
+ font-weight: 500;
16684
+ color: var(--primary-foreground);
16685
+ text-decoration: none;
16686
+ background: var(--primary);
16687
+ border-radius: calc(var(--radius) - 2px);
16688
+ }
16689
+ .button:hover { opacity: 0.9; }
16690
+ .button:focus-visible {
16691
+ outline: 2px solid var(--ring);
16692
+ outline-offset: 2px;
16693
+ }
16694
+ .device button,
16695
+ .button { transition: opacity 0.15s, background-color 0.15s, transform 0.1s; }
16696
+ .device button:active,
16697
+ .button:active { transform: scale(0.98); }
16698
+ .secondary {
16699
+ color: var(--foreground);
16700
+ background: var(--card);
16701
+ border: 1px solid var(--border);
16702
+ }
16703
+ .secondary:hover:not(:disabled) { opacity: 1; background: var(--muted); }
16704
+ .footnote { margin-top: 1.25rem; font-size: 0.75rem; }
16705
+ .status {
16706
+ display: flex;
16707
+ align-items: center;
16708
+ justify-content: center;
16709
+ gap: 0.5rem;
16710
+ margin-top: 1.25rem;
16711
+ font-size: 0.8125rem;
16712
+ }
16713
+ .status::before {
16714
+ content: "";
16715
+ width: 0.375rem;
16716
+ height: 0.375rem;
16717
+ background: currentColor;
16718
+ border-radius: 50%;
16719
+ animation: pulse 2s ease-in-out infinite;
16720
+ }
16721
+ @keyframes travel {
16722
+ 0% { opacity: 0; transform: translateX(0); }
16723
+ 20%, 80% { opacity: 1; }
16724
+ 100% { opacity: 0; transform: translateX(4rem); }
16725
+ }
16726
+ @keyframes pop {
16727
+ from { opacity: 0; transform: scale(0.4); }
16728
+ to { opacity: 1; transform: scale(1); }
16729
+ }
16730
+ @keyframes draw { to { stroke-dashoffset: 0; } }
16731
+ @keyframes pulse { 50% { opacity: 0.3; } }
16732
+ @media (prefers-reduced-motion: reduce) {
16733
+ .emblem-waiting .link::after { display: none; }
16734
+ .badge,
16735
+ .badge path,
16736
+ .status::before { animation: none; }
16737
+ .badge path { stroke-dashoffset: 0; }
16738
+ }
16739
+ </style>`;
16379
16740
  function authPageDocument(body, title = "Sign in", head = "") {
16380
16741
  return [
16381
16742
  "<!doctype html>",
@@ -16384,8 +16745,8 @@ function authPageDocument(body, title = "Sign in", head = "") {
16384
16745
  '<meta charset="utf-8">',
16385
16746
  '<meta name="viewport" content="width=device-width, initial-scale=1">',
16386
16747
  `<title>${escapeHtml(title)}</title>`,
16387
- head,
16388
16748
  AUTH_PAGE_STYLE,
16749
+ head,
16389
16750
  "</head>",
16390
16751
  "<body>",
16391
16752
  '<main class="shell">',
@@ -18301,11 +18662,7 @@ function createSixbApi(server) {
18301
18662
  withCredentials: true
18302
18663
  },
18303
18664
  mapJsonSchema: {
18304
- zod: (schema) => zodToJsonSchema3(schema, {
18305
- $refStrategy: "none",
18306
- target: "openApi3",
18307
- override: openApiOverride()
18308
- })
18665
+ zod: openApiJsonSchema
18309
18666
  }
18310
18667
  }));
18311
18668
  const authExperience = server.getAuthExperience();
@@ -18407,4 +18764,4 @@ export {
18407
18764
  createSixbServer
18408
18765
  };
18409
18766
 
18410
- //# debugId=1150621A9E3CEF9764756E2164756E21
18767
+ //# debugId=4C032B4AA5D609BC64756E2164756E21