Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
feat(system-status): platform status banner set by staff (#9357)
Eric Hayes53bc31a7843d
diff --git a/.github/workspace-dep-closures.json b/.github/workspace-dep-closures.jsonindex cc7f622d9d..63b3cf434e 100644--- a/.github/workspace-dep-closures.json+++ b/.github/workspace-dep-closures.json@@ -2422,6 +2422,7 @@"crates/sync_service_client","crates/system_properties","crates/system_skills",+ "crates/system_status","crates/task_dedup","crates/teams","crates/trigger_context",@@ -13741,6 +13742,28 @@"crates/system_skills","crates/workspace-hack"],+ "system_status": [+ "crates/bot_id",+ "crates/bot_token",+ "crates/connection_gateway_client",+ "crates/connection_gateway_models",+ "crates/cowlike",+ "crates/harness_id",+ "crates/harness_token",+ "crates/macro_auth",+ "crates/macro_authorization",+ "crates/macro_env",+ "crates/macro_env_var",+ "crates/macro_tower_layers",+ "crates/macro_user_id",+ "crates/macro_uuid",+ "crates/model-entity",+ "crates/model-error-response",+ "crates/model_user",+ "crates/remote_env_var",+ "crates/system_status",+ "crates/workspace-hack"+ ],"task_dedup": ["crates/activity","crates/agent",diff --git a/.sqlx/query-529762c0bc500755e47cc07e1e391b96bef62b8a7af1627eefd0dff8de4d8e00.json b/.sqlx/query-529762c0bc500755e47cc07e1e391b96bef62b8a7af1627eefd0dff8de4d8e00.jsonnew file mode 100644index 0000000000..cb930ec380--- /dev/null+++ b/.sqlx/query-529762c0bc500755e47cc07e1e391b96bef62b8a7af1627eefd0dff8de4d8e00.json@@ -0,0 +1,18 @@+{+ "db_name": "PostgreSQL",+ "query": "\n INSERT INTO system_status (id, status, message, user_id, created_at)\n VALUES ($1, $2, $3, $4, $5)\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Text",+ "Text",+ "Text",+ "Timestamptz"+ ]+ },+ "nullable": []+ },+ "hash": "529762c0bc500755e47cc07e1e391b96bef62b8a7af1627eefd0dff8de4d8e00"+}diff --git a/.sqlx/query-9ce85834b533c83c4ad21a268b4f8d7b5ff02be9b4a15abb72cbd4fd01338d2a.json b/.sqlx/query-9ce85834b533c83c4ad21a268b4f8d7b5ff02be9b4a15abb72cbd4fd01338d2a.jsonnew file mode 100644index 0000000000..9b6533c0a7--- /dev/null+++ b/.sqlx/query-9ce85834b533c83c4ad21a268b4f8d7b5ff02be9b4a15abb72cbd4fd01338d2a.json@@ -0,0 +1,44 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT id, status, message, user_id, created_at\n FROM system_status\n ORDER BY created_at DESC, id DESC\n LIMIT 1\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "status",+ "type_info": "Text"+ },+ {+ "ordinal": 2,+ "name": "message",+ "type_info": "Text"+ },+ {+ "ordinal": 3,+ "name": "user_id",+ "type_info": "Text"+ },+ {+ "ordinal": 4,+ "name": "created_at",+ "type_info": "Timestamptz"+ }+ ],+ "parameters": {+ "Left": []+ },+ "nullable": [+ false,+ false,+ true,+ false,+ false+ ]+ },+ "hash": "9ce85834b533c83c4ad21a268b4f8d7b5ff02be9b4a15abb72cbd4fd01338d2a"+}diff --git a/.sqlx/query-e7428a2353733f6b2b2ffbb5e24e1127dab325ee4d83087b4e53d11caa612222.json b/.sqlx/query-e7428a2353733f6b2b2ffbb5e24e1127dab325ee4d83087b4e53d11caa612222.jsonnew file mode 100644index 0000000000..a1a74fb223--- /dev/null+++ b/.sqlx/query-e7428a2353733f6b2b2ffbb5e24e1127dab325ee4d83087b4e53d11caa612222.json@@ -0,0 +1,46 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT id, status, message, user_id, created_at\n FROM system_status\n ORDER BY created_at DESC, id DESC\n LIMIT $1\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "status",+ "type_info": "Text"+ },+ {+ "ordinal": 2,+ "name": "message",+ "type_info": "Text"+ },+ {+ "ordinal": 3,+ "name": "user_id",+ "type_info": "Text"+ },+ {+ "ordinal": 4,+ "name": "created_at",+ "type_info": "Timestamptz"+ }+ ],+ "parameters": {+ "Left": [+ "Int8"+ ]+ },+ "nullable": [+ false,+ false,+ true,+ false,+ false+ ]+ },+ "hash": "e7428a2353733f6b2b2ffbb5e24e1127dab325ee4d83087b4e53d11caa612222"+}diff --git a/Cargo.lock b/Cargo.lockindex e2cc3813b6..e63ba6427a 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -2239,6 +2239,7 @@ dependencies = ["sqlx","sqs_client","strum 0.27.2",+ "system_status","teams","thiserror 2.0.18","time",@@ -19821,6 +19822,33 @@ dependencies = ["workspace-hack",]+[[package]]+name = "system_status"+version = "0.1.0"+dependencies = [+ "axum",+ "chrono",+ "connection_gateway_client",+ "http-body-util",+ "macro_authorization",+ "macro_db_migrator",+ "macro_user_id",+ "macro_uuid",+ "model-error-response",+ "model_user",+ "rootcause",+ "serde",+ "serde_json",+ "sqlx",+ "thiserror 2.0.18",+ "tokio",+ "tower 0.5.3",+ "tracing",+ "utoipa",+ "uuid",+ "workspace-hack",+]+[[package]]name = "tabular"version = "0.2.0"diff --git a/Cargo.toml b/Cargo.tomlindex 25606907e9..f14974db70 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -129,6 +129,7 @@ members = ["crates/soup_filter_projection","crates/soup_realtime","crates/system_skills",+ "crates/system_status","crates/task_dedup","crates/unfurl","crates/upstream_error",diff --git a/apps/web/src/components/app/Layout.tsx b/apps/web/src/components/app/Layout.tsxindex 05fda03bbc..1f198f86af 100644--- a/apps/web/src/components/app/Layout.tsx+++ b/apps/web/src/components/app/Layout.tsx@@ -28,6 +28,8 @@ import { AiUsageLimitDialog } from '@app/features/paywall/AiUsageLimitDialog';import { observeAiUsageLimitMutations } from '@app/features/paywall/ai-usage-limit-handling';import { MobileSettingsProvider } from '@app/features/settings/context/mobile-settings';import { NativeShareSheet } from '@app/features/sharing/native-share-sheet/NativeShareSheet';+import { StatusBanner } from '@app/features/system-status/components/StatusBanner';+import { useBannerStatus } from '@app/features/system-status/primitives/use-banner-status';import { ShowFeatureFlag } from '@app/lib/analytics/posthog';import { mountGlobalFocusListener } from '@app/signal/focus';import { CreateChannelModal } from '@channel/CreateChannelModal';@@ -261,6 +263,7 @@ export function AppChrome(props: ParentProps) {// Route mailto: links (via openExternalUrl) to the in-app email composer.registerMailtoComposerHandler();useNewOnboardingRedirect();+ const systemStatus = useBannerStatus();const companyDialogUsed = hasOpened(companyCreation.open);const contactDialogUsed = hasOpened(@@ -324,7 +327,14 @@ export function AppChrome(props: ParentProps) {</Show></Show></Suspense>- <div class="min-h-0 flex-1 flex">+ <Show when={systemStatus()}>+ {(status) => <StatusBanner {...status()} />}+ </Show>+ {/* The banner already sits below the status bar on touch devices. */}+ <div+ class="min-h-0 flex-1 flex"+ classList={{ 'touch:[--safe-top:0px]': systemStatus() !== undefined }}+ ><ItemDndProvider>{/* The rail and each view's switcher share the rail preferences. */}<SidebarPrefsProvider>diff --git a/apps/web/src/features/system-status/components/StatusBanner.tsx b/apps/web/src/features/system-status/components/StatusBanner.tsxnew file mode 100644index 0000000000..6f7848b0a5--- /dev/null+++ b/apps/web/src/features/system-status/components/StatusBanner.tsx@@ -0,0 +1,40 @@+import WarningIcon from '@phosphor/warning.svg';+import WarningOctagonIcon from '@phosphor/warning-octagon.svg';+import { cn } from '@ui';+import { Show } from 'solid-js';+import { type BannerStatus, STATUS_LABELS } from '../core/status';++/**+ * The full-width bar across the top of the app while Macro is degraded or+ * down. On touch devices it sits under the status bar, so it pads itself by+ * the top safe area.+ */+export function StatusBanner(props: BannerStatus & { class?: string }) {+ const isOutage = () => props.level === 'major_outage';+ return (+ <div+ role="status"+ class={cn(+ 'w-full shrink-0 border-b px-4 py-1.5 text-sm touch:pt-[calc(var(--safe-top,0px)+0.375rem)]',+ isOutage()+ ? 'border-failure/20 bg-failure-bg text-failure-ink'+ : 'border-alert/20 bg-alert-bg text-alert-ink',+ props.class+ )}+ >+ <div class="mx-auto flex max-w-5xl items-center justify-center gap-2">+ <Show+ when={isOutage()}+ fallback={<WarningIcon class="size-4 shrink-0" />}+ >+ <WarningOctagonIcon class="size-4 shrink-0" />+ </Show>+ <p class="min-w-0 line-clamp-2" title={props.message}>+ <span class="font-semibold">{STATUS_LABELS[props.level]}</span>+ <span class="mx-1.5 opacity-60">·</span>+ {props.message}+ </p>+ </div>+ </div>+ );+}diff --git a/apps/web/src/features/system-status/core/status.ts b/apps/web/src/features/system-status/core/status.tsnew file mode 100644index 0000000000..e384820789--- /dev/null+++ b/apps/web/src/features/system-status/core/status.ts@@ -0,0 +1,37 @@+import type { CurrentSystemStatus } from '@queries/system-status/status';+import { match } from 'ts-pattern';++export type StatusLevel = 'operational' | 'degraded' | 'major_outage';++/** A status that shows a banner. */+export type BannerStatus = {+ level: Exclude<StatusLevel, 'operational'>;+ message: string;+};++export const STATUS_LEVELS: readonly StatusLevel[] = [+ 'operational',+ 'degraded',+ 'major_outage',+];++export const STATUS_LABELS: Record<StatusLevel, string> = {+ operational: 'Operational',+ degraded: 'Degraded performance',+ major_outage: 'Major outage',+};++export const MAX_MESSAGE_LENGTH = 500;++/** The banner to show for `status`, or nothing while operational. */+export function bannerStatus(+ status: CurrentSystemStatus+): BannerStatus | undefined {+ return match(status)+ .with({ status: 'operational' }, () => undefined)+ .with({ status: 'degraded' }, { status: 'major_outage' }, (s) => ({+ level: s.status,+ message: s.message,+ }))+ .exhaustive();+}diff --git a/apps/web/src/features/system-status/primitives/use-banner-status.ts b/apps/web/src/features/system-status/primitives/use-banner-status.tsnew file mode 100644index 0000000000..7b48647858--- /dev/null+++ b/apps/web/src/features/system-status/primitives/use-banner-status.ts@@ -0,0 +1,15 @@+import { useCurrentSystemStatusQuery } from '@queries/system-status/status';+import { type BannerStatus, bannerStatus } from '../core/status';++/**+ * The banner every user sees while Macro is not operational. Never suspends:+ * until the status loads, and through failed refetches, it shows whatever was+ * last known (nothing at first).+ */+export function useBannerStatus(): () => BannerStatus | undefined {+ const query = useCurrentSystemStatusQuery();+ return () => {+ if (query.isPending) return undefined;+ return query.data ? bannerStatus(query.data) : undefined;+ };+}diff --git a/apps/web/src/features/system-status/views/SystemStatusDashboard.tsx b/apps/web/src/features/system-status/views/SystemStatusDashboard.tsxnew file mode 100644index 0000000000..a036e59733--- /dev/null+++ b/apps/web/src/features/system-status/views/SystemStatusDashboard.tsx@@ -0,0 +1,307 @@+import { SERVER_HOSTS } from '@core/constant/servers';+import { useEmail, useIsAuthenticated } from '@core/context/user';+import { idToDisplayName } from '@core/user/util';+import CopyIcon from '@phosphor/copy.svg';+import {+ type StatusUpdate,+ useCurrentSystemStatusQuery,+ useSetSystemStatusMutation,+ useSystemStatusHistoryQuery,+} from '@queries/system-status/status';+import { Button, ConfirmDialog, CopyButton, Tabs, TextField } from '@ui';+import { createSignal, For, type JSX, Match, Show, Switch } from 'solid-js';+import { match } from 'ts-pattern';+import { StatusBanner } from '../components/StatusBanner';+import {+ bannerStatus,+ MAX_MESSAGE_LENGTH,+ STATUS_LABELS,+ STATUS_LEVELS,+ type StatusLevel,+} from '../core/status';++const STAFF_EMAIL_DOMAIN = '@macro.com';++/**+ * Internal dashboard for setting the status banner every user sees. Reachable+ * at `/internal/status`; the auth service only accepts staff, this gate just+ * keeps everyone else from seeing an empty shell.+ */+export function SystemStatusDashboard() {+ const isAuthenticated = useIsAuthenticated();+ const email = useEmail();+ const isStaff = () =>+ email()?.toLowerCase().endsWith(STAFF_EMAIL_DOMAIN) ?? false;++ return (+ <div class="size-full overflow-y-auto bg-surface font-sans text-ink">+ <div class="mx-auto flex w-full max-w-4xl flex-col gap-8 px-4 py-10 touch:pt-[calc(var(--mobile-content-inset-top,0px)+1.5rem)] sm:px-6">+ <header class="flex flex-col gap-1">+ <h1 class="text-xl font-semibold tracking-tight">System status</h1>+ <p class="text-sm text-ink-muted">+ While Macro isn't operational, every user sees a banner with the+ status and your message. Changes reach open apps immediately.+ </p>+ </header>++ <Switch>+ <Match when={isAuthenticated() === false}>+ <Gate body="Log in with a @macro.com account to continue." />+ </Match>+ <Match when={isAuthenticated() === true && !isStaff()}>+ <Gate body="Only @macro.com accounts can set the system status." />+ </Match>+ <Match when={isAuthenticated() === true && isStaff()}>+ <CurrentStatus />+ <SetStatusForm />+ <History />+ <ApiDocs />+ </Match>+ </Switch>+ </div>+ </div>+ );+}++function Gate(props: { body: string }) {+ return (+ <div class="flex flex-col gap-1 rounded-xl border border-edge p-6">+ <h2 class="text-base font-semibold">Macro staff only</h2>+ <p class="text-sm text-ink-muted">{props.body}</p>+ </div>+ );+}++function Section(props: { title: string; children: JSX.Element }) {+ return (+ <section class="flex flex-col gap-3">+ <h2 class="text-base font-semibold">{props.title}</h2>+ {props.children}+ </section>+ );+}++function CurrentStatus() {+ const query = useCurrentSystemStatusQuery();+ const banner = () =>+ !query.isPending && query.data ? bannerStatus(query.data) : undefined;++ return (+ <Section title="Current status">+ <Switch>+ <Match when={query.isPending}>+ <p class="text-sm text-ink-muted">Loading…</p>+ </Match>+ <Match when={query.isError && !query.data}>+ <p class="text-sm text-failure">+ Couldn't load the current status — refresh to try again.+ </p>+ </Match>+ <Match when={banner()}>+ {(status) => (+ <StatusBanner+ {...status()}+ class="rounded-lg border touch:pt-1.5"+ />+ )}+ </Match>+ <Match when={query.data}>+ <p class="rounded-lg border border-success/20 bg-success-bg px-4 py-2 text-sm text-success-ink">+ Operational — no banner is showing.+ </p>+ </Match>+ </Switch>+ </Section>+ );+}++function SetStatusForm() {+ const [level, setLevel] = createSignal<StatusLevel>('degraded');+ const [message, setMessage] = createSignal('');+ const [confirming, setConfirming] = createSignal(false);+ const setStatus = useSetSystemStatusMutation();++ const trimmed = () => message().trim();+ const needsMessage = () => level() !== 'operational';+ const canSubmit = () =>+ !setStatus.isPending &&+ (!needsMessage() ||+ (trimmed().length > 0 && trimmed().length <= MAX_MESSAGE_LENGTH));++ const publish = () => {+ const status = match(level())+ .with('operational', () => ({ status: 'operational' as const }))+ .with('degraded', 'major_outage', (status) => ({+ status,+ message: trimmed(),+ }))+ .exhaustive();+ setStatus.mutate(status, {+ onSuccess: () => setMessage(''),+ });+ };++ return (+ <Section title="Set status">+ <form+ class="flex flex-col gap-4 rounded-xl border border-edge p-5"+ onSubmit={(e) => {+ e.preventDefault();+ if (canSubmit()) setConfirming(true);+ }}+ >+ <Tabs+ aria-label="Status"+ value={level()}+ onChange={setLevel}+ options={STATUS_LEVELS.map((value) => ({+ value,+ label: STATUS_LABELS[value],+ }))}+ />+ <Show when={needsMessage()}>+ <TextField value={message()} onChange={setMessage} required>+ <TextField.Label>Message</TextField.Label>+ <TextField.TextArea+ autoResize+ maxLength={MAX_MESSAGE_LENGTH}+ placeholder="Search results are delayed. We're working on a fix."+ />+ <TextField.Description>+ {trimmed().length}/{MAX_MESSAGE_LENGTH} · shown to every user+ </TextField.Description>+ </TextField>+ <Show when={trimmed()}>+ <div class="flex flex-col gap-1.5">+ <span class="text-xs font-medium text-ink-muted">Preview</span>+ <StatusBanner+ level={level() === 'major_outage' ? 'major_outage' : 'degraded'}+ message={trimmed()}+ class="rounded-lg border touch:pt-1.5"+ />+ </div>+ </Show>+ </Show>+ <div class="flex justify-end">+ <Button+ variant="primary"+ size="lg"+ type="submit"+ disabled={!canSubmit()}+ >+ {setStatus.isPending ? 'Publishing…' : 'Publish'}+ </Button>+ </div>+ </form>+ <ConfirmDialog+ open={confirming()}+ onOpenChange={setConfirming}+ title={`Set status to ${STATUS_LABELS[level()]}?`}+ body={+ needsMessage()+ ? 'Every user will see this banner right away.'+ : 'The banner will disappear for every user.'+ }+ confirmLabel="Publish"+ tone={level() === 'major_outage' ? 'danger' : 'default'}+ onConfirm={publish}+ />+ </Section>+ );+}++const dateTime = new Intl.DateTimeFormat(undefined, {+ month: 'short',+ day: 'numeric',+ hour: 'numeric',+ minute: '2-digit',+});++function History() {+ const query = useSystemStatusHistoryQuery();+ const updates = (): StatusUpdate[] =>+ !query.isPending && query.data ? query.data : [];++ return (+ <Section title="History">+ <Switch>+ <Match when={query.isPending}>+ <p class="text-sm text-ink-muted">Loading…</p>+ </Match>+ <Match when={query.isError && !query.data}>+ <p class="text-sm text-failure">+ Couldn't load the history — refresh to try again.+ </p>+ </Match>+ <Match when={updates().length === 0}>+ <p class="rounded-xl border border-dashed border-edge px-4 py-6 text-center text-sm text-ink-muted">+ No status has been set yet.+ </p>+ </Match>+ <Match when={updates().length > 0}>+ <ul class="flex flex-col divide-y divide-edge-muted rounded-xl border border-edge">+ <For each={updates()}>+ {(update) => (+ <li class="flex flex-col gap-1 px-4 py-3 text-sm">+ <div class="flex flex-wrap items-center gap-x-3 gap-y-1">+ <span class="font-medium">+ {STATUS_LABELS[update.status]}+ </span>+ <span class="text-xs text-ink-muted">+ {dateTime.format(new Date(update.createdAt))} ·{' '}+ {idToDisplayName(update.userId)}+ </span>+ </div>+ <Show when={'message' in update ? update.message : undefined}>+ {(text) => <p class="text-ink-muted">{text()}</p>}+ </Show>+ </li>+ )}+ </For>+ </ul>+ </Match>+ </Switch>+ </Section>+ );+}++function ApiDocs() {+ const endpoint = `${SERVER_HOSTS['auth-service']}/system-status`;+ const example = () =>+ [+ `curl -X POST ${endpoint} \\`,+ ` -H 'x-macro-user-api-key: <your API key>' \\`,+ ` -H 'content-type: application/json' \\`,+ ` -d '{"status": "degraded", "message": "Search is slow to update."}'`,+ ].join('\n');++ return (+ <Section title="API">+ <div class="flex flex-col gap-3 text-sm text-ink-muted">+ <p>+ Any @macro.com account can set the status from a script with a+ personal API key (Settings → API keys). <code>status</code> is{' '}+ <code>operational</code>, <code>degraded</code>, or{' '}+ <code>major_outage</code>; the latter two require a 1–+ {MAX_MESSAGE_LENGTH} character <code>message</code>, and operational+ takes none. <code>GET {endpoint}</code> returns the current status (no+ auth), and <code>GET {endpoint}/history</code> the recent updates.+ </p>+ <div class="relative">+ <pre class="overflow-x-auto rounded-lg border border-edge bg-ink/[0.03] p-3 pr-12 text-xs text-ink">+ {example()}+ </pre>+ <CopyButton+ variant="ghost"+ size="sm"+ class="absolute top-2 right-2"+ aria-label="Copy example"+ onClick={() => navigator.clipboard.writeText(example())}+ >+ <CopyIcon class="size-4" />+ </CopyButton>+ </div>+ </div>+ </Section>+ );+}diff --git a/apps/web/src/lib/queries/sync/use-query-sync.ts b/apps/web/src/lib/queries/sync/use-query-sync.tsindex b044acc9b6..9429586266 100644--- a/apps/web/src/lib/queries/sync/use-query-sync.ts+++ b/apps/web/src/lib/queries/sync/use-query-sync.ts@@ -47,6 +47,11 @@ import {invalidatePullRequestMentions,} from '@queries/storage/pr-mention-sync';import { handleTaskDuplicateMatchesUpdated } from '@queries/storage/task-duplicates';+import {+ handleSystemStatusMessage,+ invalidateCurrentSystemStatus,+ SYSTEM_STATUS_MESSAGE_TYPE,+} from '@queries/system-status/status';import { handleRefreshCalendar } from '../calendar/sync';// Side-effect import: registers the scheduled-action live-update websocket// listener. Must be imported somewhere that always loads on app start — this@@ -87,6 +92,10 @@ export function useQuerySync(userId: Accessor<string | undefined>): void {onCleanup(() =>ws.removeEventListener(WebsocketEvent.Open, invalidatePullRequestMentions));+ ws.addEventListener(WebsocketEvent.Open, invalidateCurrentSystemStatus);+ onCleanup(() =>+ ws.removeEventListener(WebsocketEvent.Open, invalidateCurrentSystemStatus)+ );createConnectionWebsocketEffect((data) => {match(data)@@ -209,6 +218,9 @@ export function useQuerySync(userId: Accessor<string | undefined>): void {invalidateAllProperties();invalidateAllSoup();})+ .with({ type: SYSTEM_STATUS_MESSAGE_TYPE }, () => {+ handleSystemStatusMessage(data.data);+ }).with({ type: 'task_duplicate_matches_updated' }, () => {withParsedWebsocketPayload(data.type,diff --git a/apps/web/src/lib/queries/system-status/keys.ts b/apps/web/src/lib/queries/system-status/keys.tsnew file mode 100644index 0000000000..023256f5f9--- /dev/null+++ b/apps/web/src/lib/queries/system-status/keys.ts@@ -0,0 +1,6 @@+import { createQueryKeys } from '@lukemorales/query-key-factory';++export const systemStatusKeys = createQueryKeys('systemStatus', {+ current: null,+ history: null,+});diff --git a/apps/web/src/lib/queries/system-status/status.test.ts b/apps/web/src/lib/queries/system-status/status.test.tsnew file mode 100644index 0000000000..7240f52cf2--- /dev/null+++ b/apps/web/src/lib/queries/system-status/status.test.ts@@ -0,0 +1,75 @@+import { ok } from 'neverthrow';+import { beforeEach, expect, it, vi } from 'vitest';+import { queryClient } from '../client';+import { systemStatusKeys } from './keys';+import {+ currentSystemStatusQueryOptions,+ handleSystemStatusMessage,+} from './status';++const mocks = vi.hoisted(() => ({ getSystemStatus: vi.fn() }));+vi.mock('@service-auth/client', () => ({+ authServiceClient: { getSystemStatus: mocks.getSystemStatus },+}));+vi.mock('@core/component/Toast/Toast', () => ({ toast: {} }));+vi.mock('../client', async () => {+ const { QueryClient } = await import('@tanstack/solid-query');+ return { queryClient: new QueryClient() };+});++const cached = () =>+ queryClient.getQueryData(systemStatusKeys.current.queryKey);++const outage = {+ status: 'major_outage',+ message: 'Macro is down',+ updatedAt: '2026-10-28T12:00:00.000Z',+} as const;+const recovered = {+ status: 'operational',+ updatedAt: '2026-10-28T12:30:00.000Z',+} as const;++beforeEach(() => {+ queryClient.clear();+ vi.resetAllMocks();+});++it('applies a pushed status, as JSON text or an object', () => {+ handleSystemStatusMessage(JSON.stringify(outage));+ expect(cached()).toEqual(outage);++ handleSystemStatusMessage(recovered);+ expect(cached()).toEqual(recovered);+});++it('ignores a pushed status older than the one shown', () => {+ handleSystemStatusMessage(recovered);+ handleSystemStatusMessage(outage);++ expect(cached()).toEqual(recovered);+});++it('ignores malformed pushes', () => {+ handleSystemStatusMessage(outage);+ handleSystemStatusMessage('{not json');+ handleSystemStatusMessage({ status: 'degraded' });++ expect(cached()).toEqual(outage);+});++it('keeps a newer pushed status over a fetch that started before it', async () => {+ let resolveFetch: (value: unknown) => void = () => {};+ mocks.getSystemStatus.mockReturnValue(+ new Promise((resolve) => {+ resolveFetch = resolve;+ })+ );++ const fetching = queryClient.fetchQuery(currentSystemStatusQueryOptions());+ handleSystemStatusMessage(recovered);+ resolveFetch(ok(outage));+ await fetching;++ expect(cached()).toEqual(recovered);+});diff --git a/apps/web/src/lib/queries/system-status/status.ts b/apps/web/src/lib/queries/system-status/status.tsnew file mode 100644index 0000000000..0c5ab1df86--- /dev/null+++ b/apps/web/src/lib/queries/system-status/status.ts@@ -0,0 +1,141 @@+/**+ * The platform status banner: the current status every user sees, kept live+ * by `system_status` websocket broadcasts, plus the staff dashboard's history+ * and setter.+ */+import { toast } from '@core/component/Toast/Toast';+import { throwOnErr } from '@core/util/result';+import { authServiceClient } from '@service-auth/client';+import type { CurrentSystemStatus } from '@service-auth/generated/schemas/currentSystemStatus';+import type { StatusUpdate } from '@service-auth/generated/schemas/statusUpdate';+import type { SystemStatus } from '@service-auth/generated/schemas/systemStatus';+import { queryOptions, useMutation, useQuery } from '@tanstack/solid-query';+import { z } from 'zod';+import { queryClient } from '../client';+import { systemStatusKeys } from './keys';++export type { CurrentSystemStatus, StatusUpdate, SystemStatus };++export const SYSTEM_STATUS_MESSAGE_TYPE = 'system_status';++// Broadcasts keep open apps current; the interval only covers a missed one.+const STATUS_REFETCH_INTERVAL_MS = 5 * 60_000;++const updatedAtSchema = z.string().nullish();+const currentSystemStatusSchema = z.discriminatedUnion('status', [+ z.object({ status: z.literal('operational'), updatedAt: updatedAtSchema }),+ z.object({+ status: z.literal('degraded'),+ message: z.string(),+ updatedAt: updatedAtSchema,+ }),+ z.object({+ status: z.literal('major_outage'),+ message: z.string(),+ updatedAt: updatedAtSchema,+ }),+]);++const jsonStringSchema = z.string().transform((value, ctx) => {+ try {+ return JSON.parse(value) as unknown;+ } catch {+ ctx.addIssue({ code: 'custom', message: 'invalid JSON' });+ return z.NEVER;+ }+});++const systemStatusPayloadSchema = z.union([+ currentSystemStatusSchema,+ jsonStringSchema.pipe(currentSystemStatusSchema),+]);++function updatedAtMs(status: CurrentSystemStatus | undefined): number {+ return status?.updatedAt ? Date.parse(status.updatedAt) : 0;+}++/**+ * Keeps whichever of the cached and incoming status was set last, so a fetch+ * that started before a broadcast can't put an older status back.+ */+function keepNewest(+ incoming: CurrentSystemStatus,+ cached: CurrentSystemStatus | undefined+): CurrentSystemStatus {+ return cached && updatedAtMs(cached) > updatedAtMs(incoming)+ ? cached+ : incoming;+}++export function currentSystemStatusQueryOptions() {+ return queryOptions({+ queryKey: systemStatusKeys.current.queryKey,+ queryFn: async () => {+ const fetched = await throwOnErr(() =>+ authServiceClient.getSystemStatus()+ );+ return keepNewest(+ fetched,+ queryClient.getQueryData<CurrentSystemStatus>(+ systemStatusKeys.current.queryKey+ )+ );+ },+ refetchInterval: STATUS_REFETCH_INTERVAL_MS,+ });+}++/** The status every user sees. */+export function useCurrentSystemStatusQuery() {+ return useQuery(() => currentSystemStatusQueryOptions());+}++/** Applies a `system_status` websocket broadcast. */+export function handleSystemStatusMessage(payload: unknown) {+ const result = systemStatusPayloadSchema.safeParse(payload);+ if (!result.success) {+ console.warn('Malformed system status payload', payload);+ return;+ }+ queryClient.setQueryData<CurrentSystemStatus>(+ systemStatusKeys.current.queryKey,+ (cached) => keepNewest(result.data, cached)+ );+ queryClient.invalidateQueries({+ queryKey: systemStatusKeys.history.queryKey,+ });+}++/** Catches up on a broadcast missed while the websocket was down. */+export function invalidateCurrentSystemStatus() {+ queryClient.invalidateQueries({+ queryKey: systemStatusKeys.current.queryKey,+ });+}++function systemStatusHistoryQueryOptions() {+ return queryOptions({+ queryKey: systemStatusKeys.history.queryKey,+ queryFn: async () =>+ await throwOnErr(() => authServiceClient.listSystemStatusHistory()),+ });+}++/** Staff dashboard: recent updates, newest first. */+export function useSystemStatusHistoryQuery() {+ return useQuery(() => systemStatusHistoryQueryOptions());+}++export function useSetSystemStatusMutation() {+ return useMutation(() => ({+ mutationFn: async (status: SystemStatus) =>+ await throwOnErr(() => authServiceClient.setSystemStatus(status)),+ onSuccess: () => {+ queryClient.invalidateQueries({ queryKey: systemStatusKeys._def });+ toast.success('Status updated');+ },+ onError: (error: Error) => {+ toast.failure(error.message || "Couldn't update the status");+ },+ }));+}diff --git a/apps/web/src/lib/service-clients/service-auth/client.ts b/apps/web/src/lib/service-clients/service-auth/client.tsindex 6cd5d1b073..842d0deeb6 100644--- a/apps/web/src/lib/service-clients/service-auth/client.ts+++ b/apps/web/src/lib/service-clients/service-auth/client.ts@@ -52,6 +52,7 @@ import type { AppleLoginRequest } from './generated/schemas/appleLoginRequest';import type { CreatedTeamInviteLinkResponse } from './generated/schemas/createdTeamInviteLinkResponse';import type { CreateGtmInviteLinkRequest } from './generated/schemas/createGtmInviteLinkRequest';import type { CreateTeamRequest } from './generated/schemas/createTeamRequest';+import type { CurrentSystemStatus } from './generated/schemas/currentSystemStatus';import type { EmptyResponse } from './generated/schemas/emptyResponse';import type { GenericSuccessResponse } from './generated/schemas/genericSuccessResponse';import type { GetLegacyUserPermissionsResponse } from './generated/schemas/getLegacyUserPermissionsResponse';@@ -73,6 +74,9 @@ import type { ProfilePictures } from './generated/schemas/profilePictures';import type { PublicGtmInviteLink } from './generated/schemas/publicGtmInviteLink';import type { PutProfilePictureParams } from './generated/schemas/putProfilePictureParams';import type { PutUserNameQueryParams } from './generated/schemas/putUserNameQueryParams';+import type { StatusUpdate } from './generated/schemas/statusUpdate';+import type { SystemStatus } from './generated/schemas/systemStatus';+import type { SystemStatusHistory } from './generated/schemas/systemStatusHistory';import type { Team } from './generated/schemas/team';import type { TeamInviteLinkResponse } from './generated/schemas/teamInviteLinkResponse';import type { TeamInviteLinkTeam } from './generated/schemas/teamInviteLinkTeam';@@ -779,6 +783,35 @@ export const authServiceClient = {).map((result) => result.offer ?? null);},+ /** Public: the status banner shows signed in or not. */+ async getSystemStatus() {+ return (+ await authApiFetch<CurrentSystemStatus>('/system-status', {+ method: 'GET',+ })+ ).map((status) => status);+ },++ /** Macro staff only; the server rejects everyone else. */+ async setSystemStatus(status: SystemStatus) {+ return (+ await fetchWithAuth<StatusUpdate>(`${authHost}/system-status`, {+ method: 'POST',+ body: JSON.stringify(status),+ })+ ).map((update) => update);+ },++ /** Macro staff only. */+ async listSystemStatusHistory() {+ return (+ await fetchWithAuth<SystemStatusHistory>(+ `${authHost}/system-status/history`,+ { method: 'GET' }+ )+ ).map((result) => result.updates);+ },+// Stripe HTTP methods (replacing RPC calls)async getTrialEligibility() {return await fetchWithAuth<TrialEligibility>(diff --git a/apps/web/src/lib/service-clients/service-auth/generated/client.ts b/apps/web/src/lib/service-clients/service-auth/generated/client.tsindex d59143c378..d219031122 100644--- a/apps/web/src/lib/service-clients/service-auth/generated/client.ts+++ b/apps/web/src/lib/service-clients/service-auth/generated/client.ts@@ -25,6 +25,7 @@ import type {CreateTeamRequest,CreditCheckoutRequestBody,CreditCheckoutResponse,+ CurrentSystemStatus,CursorApiKeyStatus,CursorModelsResponse,EmailConnectionProviders,@@ -93,8 +94,11 @@ import type {SetGithubPullRequestStateResponse,SsoLoginParams,SsoRequiredResponse,+ StatusUpdate,StripeSessionResponse,SubscriptionStatus,+ SystemStatus,+ SystemStatusHistory,Team,TeamInviteLinkResponse,TeamInviteLinkTeam,@@ -4169,6 +4173,196 @@ export const sessionLogin = async (} as sessionLoginResponse;};+/**+ * @summary The status every user sees. Public: the banner shows wherever the app+runs, signed in or not.+ */+export type getSystemStatusResponse200 = {+ data: CurrentSystemStatus;+ status: 200;+};++export type getSystemStatusResponse500 = {+ data: ErrorResponse;+ status: 500;+};++export type getSystemStatusResponseSuccess = getSystemStatusResponse200 & {+ headers: Headers;+};+export type getSystemStatusResponseError = getSystemStatusResponse500 & {+ headers: Headers;+};++export type getSystemStatusResponse =+ | getSystemStatusResponseSuccess+ | getSystemStatusResponseError;++export const getGetSystemStatusUrl = () => {+ return `/system-status`;+};++export const getSystemStatus = async (+ options?: RequestInit+): Promise<getSystemStatusResponse> => {+ const res = await fetch(getGetSystemStatusUrl(), {+ ...options,+ method: 'GET',+ });++ const body = [204, 205, 304].includes(res.status) ? null : await res.text();++ const data: getSystemStatusResponse['data'] = body ? JSON.parse(body) : {};+ return {+ data,+ status: res.status,+ headers: res.headers,+ } as getSystemStatusResponse;+};++/**+ * Authenticate with a Macro session, or from a script with a personal API+key (Settings → API keys) in the `x-macro-user-api-key` header. The body+is the new status:++- `{"status": "operational"}` clears the banner. It takes no message.+- `{"status": "degraded", "message": "Search is slow to update."}`+- `{"status": "major_outage", "message": "Macro is unavailable. We're on it."}`++Messages are trimmed and must be 1–500 characters. Every call is kept in+the history, even when it repeats the current status.+ * @summary Sets the status every user sees and pushes it to every open app. Macro+staff only.+ */+export type setSystemStatusResponse200 = {+ data: StatusUpdate;+ status: 200;+};++export type setSystemStatusResponse401 = {+ data: ErrorResponse;+ status: 401;+};++export type setSystemStatusResponse403 = {+ data: ErrorResponse;+ status: 403;+};++export type setSystemStatusResponse422 = {+ data: void;+ status: 422;+};++export type setSystemStatusResponse500 = {+ data: ErrorResponse;+ status: 500;+};++export type setSystemStatusResponseSuccess = setSystemStatusResponse200 & {+ headers: Headers;+};+export type setSystemStatusResponseError = (+ | setSystemStatusResponse401+ | setSystemStatusResponse403+ | setSystemStatusResponse422+ | setSystemStatusResponse500+) & {+ headers: Headers;+};++export type setSystemStatusResponse =+ | setSystemStatusResponseSuccess+ | setSystemStatusResponseError;++export const getSetSystemStatusUrl = () => {+ return `/system-status`;+};++export const setSystemStatus = async (+ systemStatus: SystemStatus,+ options?: RequestInit+): Promise<setSystemStatusResponse> => {+ const res = await fetch(getSetSystemStatusUrl(), {+ ...options,+ method: 'POST',+ headers: { 'Content-Type': 'application/json', ...options?.headers },+ body: JSON.stringify(systemStatus),+ });++ const body = [204, 205, 304].includes(res.status) ? null : await res.text();++ const data: setSystemStatusResponse['data'] = body ? JSON.parse(body) : {};+ return {+ data,+ status: res.status,+ headers: res.headers,+ } as setSystemStatusResponse;+};++/**+ * @summary Recent status updates, newest first, with who set each. Macro staff only.+ */+export type listSystemStatusHistoryResponse200 = {+ data: SystemStatusHistory;+ status: 200;+};++export type listSystemStatusHistoryResponse401 = {+ data: ErrorResponse;+ status: 401;+};++export type listSystemStatusHistoryResponse403 = {+ data: ErrorResponse;+ status: 403;+};++export type listSystemStatusHistoryResponse500 = {+ data: ErrorResponse;+ status: 500;+};++export type listSystemStatusHistoryResponseSuccess =+ listSystemStatusHistoryResponse200 & {+ headers: Headers;+ };+export type listSystemStatusHistoryResponseError = (+ | listSystemStatusHistoryResponse401+ | listSystemStatusHistoryResponse403+ | listSystemStatusHistoryResponse500+) & {+ headers: Headers;+};++export type listSystemStatusHistoryResponse =+ | listSystemStatusHistoryResponseSuccess+ | listSystemStatusHistoryResponseError;++export const getListSystemStatusHistoryUrl = () => {+ return `/system-status/history`;+};++export const listSystemStatusHistory = async (+ options?: RequestInit+): Promise<listSystemStatusHistoryResponse> => {+ const res = await fetch(getListSystemStatusHistoryUrl(), {+ ...options,+ method: 'GET',+ });++ const body = [204, 205, 304].includes(res.status) ? null : await res.text();++ const data: listSystemStatusHistoryResponse['data'] = body+ ? JSON.parse(body)+ : {};+ return {+ data,+ status: res.status,+ headers: res.headers,+ } as listSystemStatusHistoryResponse;+};+/*** @summary Gets a team by ID.*/diff --git a/apps/web/src/lib/service-clients/service-auth/generated/schemas/currentSystemStatus.ts b/apps/web/src/lib/service-clients/service-auth/generated/schemas/currentSystemStatus.tsnew file mode 100644index 0000000000..e38530bff1--- /dev/null+++ b/apps/web/src/lib/service-clients/service-auth/generated/schemas/currentSystemStatus.ts@@ -0,0 +1,14 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * authentication_service+ * OpenAPI spec version: 0.1.0+ */++import type { CurrentSystemStatusAllOf } from './currentSystemStatusAllOf';+import type { SystemStatus } from './systemStatus';++/**+ * The status every user sees, without who set it.+ */+export type CurrentSystemStatus = SystemStatus & CurrentSystemStatusAllOf;diff --git a/apps/web/src/lib/service-clients/service-auth/generated/schemas/currentSystemStatusAllOf.ts b/apps/web/src/lib/service-clients/service-auth/generated/schemas/currentSystemStatusAllOf.tsnew file mode 100644index 0000000000..46084d17df--- /dev/null+++ b/apps/web/src/lib/service-clients/service-auth/generated/schemas/currentSystemStatusAllOf.ts@@ -0,0 +1,13 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * authentication_service+ * OpenAPI spec version: 0.1.0+ */+import type { CurrentSystemStatusAllOfUpdatedAt } from './currentSystemStatusAllOfUpdatedAt';++export type CurrentSystemStatusAllOf = {+ /** When it was set; absent when no status was ever set. Clients keep the+newest status they have seen, whether fetched or pushed. */+ updatedAt?: CurrentSystemStatusAllOfUpdatedAt;+};diff --git a/apps/web/src/lib/service-clients/service-auth/generated/schemas/currentSystemStatusAllOfUpdatedAt.ts b/apps/web/src/lib/service-clients/service-auth/generated/schemas/currentSystemStatusAllOfUpdatedAt.tsnew file mode 100644index 0000000000..43bfbf1c3d--- /dev/null+++ b/apps/web/src/lib/service-clients/service-auth/generated/schemas/currentSystemStatusAllOfUpdatedAt.ts@@ -0,0 +1,12 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * authentication_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * When it was set; absent when no status was ever set. Clients keep the+newest status they have seen, whether fetched or pushed.+ */+export type CurrentSystemStatusAllOfUpdatedAt = string | null;diff --git a/apps/web/src/lib/service-clients/service-auth/generated/schemas/index.ts b/apps/web/src/lib/service-clients/service-auth/generated/schemas/index.tsindex 23d9d7022e..0107412f7b 100644--- a/apps/web/src/lib/service-clients/service-auth/generated/schemas/index.ts+++ b/apps/web/src/lib/service-clients/service-auth/generated/schemas/index.ts@@ -48,6 +48,9 @@ export * from './createPortalSessionRequest';export * from './createTeamRequest';export * from './creditCheckoutRequestBody';export * from './creditCheckoutResponse';+export * from './currentSystemStatus';+export * from './currentSystemStatusAllOf';+export * from './currentSystemStatusAllOfUpdatedAt';export * from './cursorApiKeyStatus';export * from './cursorApiKeyStatusDefaultModelId';export * from './cursorApiKeyStatusUpdatedAt';@@ -206,10 +209,20 @@ export * from './setGithubPullRequestStateResponse';export * from './setGithubPullRequestStateResponsePullRequest';export * from './ssoLoginParams';export * from './ssoRequiredResponse';+export * from './statusUpdate';+export * from './statusUpdateAllOf';export * from './stripeSessionResponse';export * from './subscriptionStatus';export * from './subscriptionStatusRenewalDate';export * from './subscriptionStatusScheduledChange';+export * from './systemStatus';+export * from './systemStatusHistory';+export * from './systemStatusOneOf';+export * from './systemStatusOneOfFive';+export * from './systemStatusOneOfFiveStatus';+export * from './systemStatusOneOfStatus';+export * from './systemStatusOneOfThree';+export * from './systemStatusOneOfThreeStatus';export * from './team';export * from './teamAutoJoinDomain';export * from './teamDefaultLinkShare';diff --git a/apps/web/src/lib/service-clients/service-auth/generated/schemas/statusUpdate.ts b/apps/web/src/lib/service-clients/service-auth/generated/schemas/statusUpdate.tsnew file mode 100644index 0000000000..30500f39b0--- /dev/null+++ b/apps/web/src/lib/service-clients/service-auth/generated/schemas/statusUpdate.ts@@ -0,0 +1,14 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * authentication_service+ * OpenAPI spec version: 0.1.0+ */++import type { StatusUpdateAllOf } from './statusUpdateAllOf';+import type { SystemStatus } from './systemStatus';++/**+ * One status a staff member set. The newest is the current status.+ */+export type StatusUpdate = SystemStatus & StatusUpdateAllOf;diff --git a/apps/web/src/lib/service-clients/service-auth/generated/schemas/statusUpdateAllOf.ts b/apps/web/src/lib/service-clients/service-auth/generated/schemas/statusUpdateAllOf.tsnew file mode 100644index 0000000000..e0d1b42ee0--- /dev/null+++ b/apps/web/src/lib/service-clients/service-auth/generated/schemas/statusUpdateAllOf.ts@@ -0,0 +1,15 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * authentication_service+ * OpenAPI spec version: 0.1.0+ */++export type StatusUpdateAllOf = {+ /** When it was set. */+ createdAt: string;+ /** UUIDv7, so ids sort by creation. */+ id: string;+ /** The staff member who set it. */+ userId: string;+};diff --git a/apps/web/src/lib/service-clients/service-auth/generated/schemas/systemStatus.ts b/apps/web/src/lib/service-clients/service-auth/generated/schemas/systemStatus.tsnew file mode 100644index 0000000000..f1c5627a07--- /dev/null+++ b/apps/web/src/lib/service-clients/service-auth/generated/schemas/systemStatus.ts@@ -0,0 +1,17 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * authentication_service+ * OpenAPI spec version: 0.1.0+ */+import type { SystemStatusOneOf } from './systemStatusOneOf';+import type { SystemStatusOneOfFive } from './systemStatusOneOfFive';+import type { SystemStatusOneOfThree } from './systemStatusOneOfThree';++/**+ * The platform status. Only the non-operational statuses carry a message.+ */+export type SystemStatus =+ | SystemStatusOneOf+ | SystemStatusOneOfThree+ | SystemStatusOneOfFive;diff --git a/apps/web/src/lib/service-clients/service-auth/generated/schemas/systemStatusHistory.ts b/apps/web/src/lib/service-clients/service-auth/generated/schemas/systemStatusHistory.tsnew file mode 100644index 0000000000..7d84a9b565--- /dev/null+++ b/apps/web/src/lib/service-clients/service-auth/generated/schemas/systemStatusHistory.ts@@ -0,0 +1,15 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * authentication_service+ * OpenAPI spec version: 0.1.0+ */+import type { StatusUpdate } from './statusUpdate';++/**+ * Recent status updates, newest first.+ */+export interface SystemStatusHistory {+ /** The updates. */+ updates: StatusUpdate[];+}diff --git a/apps/web/src/lib/service-clients/service-auth/generated/schemas/systemStatusOneOf.ts b/apps/web/src/lib/service-clients/service-auth/generated/schemas/systemStatusOneOf.tsnew file mode 100644index 0000000000..a078cbd026--- /dev/null+++ b/apps/web/src/lib/service-clients/service-auth/generated/schemas/systemStatusOneOf.ts@@ -0,0 +1,14 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * authentication_service+ * OpenAPI spec version: 0.1.0+ */+import type { SystemStatusOneOfStatus } from './systemStatusOneOfStatus';++/**+ * Everything works; no banner is shown.+ */+export type SystemStatusOneOf = {+ status: SystemStatusOneOfStatus;+};diff --git a/apps/web/src/lib/service-clients/service-auth/generated/schemas/systemStatusOneOfFive.ts b/apps/web/src/lib/service-clients/service-auth/generated/schemas/systemStatusOneOfFive.tsnew file mode 100644index 0000000000..abe2e24528--- /dev/null+++ b/apps/web/src/lib/service-clients/service-auth/generated/schemas/systemStatusOneOfFive.ts@@ -0,0 +1,16 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * authentication_service+ * OpenAPI spec version: 0.1.0+ */+import type { SystemStatusOneOfFiveStatus } from './systemStatusOneOfFiveStatus';++/**+ * Macro is largely unavailable.+ */+export type SystemStatusOneOfFive = {+ /** What users should know. */+ message: string;+ status: SystemStatusOneOfFiveStatus;+};diff --git a/apps/web/src/lib/service-clients/service-auth/generated/schemas/systemStatusOneOfFiveStatus.ts b/apps/web/src/lib/service-clients/service-auth/generated/schemas/systemStatusOneOfFiveStatus.tsnew file mode 100644index 0000000000..6e9a71184b--- /dev/null+++ b/apps/web/src/lib/service-clients/service-auth/generated/schemas/systemStatusOneOfFiveStatus.ts@@ -0,0 +1,14 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * authentication_service+ * OpenAPI spec version: 0.1.0+ */++export type SystemStatusOneOfFiveStatus =+ (typeof SystemStatusOneOfFiveStatus)[keyof typeof SystemStatusOneOfFiveStatus];++// eslint-disable-next-line @typescript-eslint/no-redeclare+export const SystemStatusOneOfFiveStatus = {+ major_outage: 'major_outage',+} as const;diff --git a/apps/web/src/lib/service-clients/service-auth/generated/schemas/systemStatusOneOfStatus.ts b/apps/web/src/lib/service-clients/service-auth/generated/schemas/systemStatusOneOfStatus.tsnew file mode 100644index 0000000000..9c4f033a6a--- /dev/null+++ b/apps/web/src/lib/service-clients/service-auth/generated/schemas/systemStatusOneOfStatus.ts@@ -0,0 +1,14 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * authentication_service+ * OpenAPI spec version: 0.1.0+ */++export type SystemStatusOneOfStatus =+ (typeof SystemStatusOneOfStatus)[keyof typeof SystemStatusOneOfStatus];++// eslint-disable-next-line @typescript-eslint/no-redeclare+export const SystemStatusOneOfStatus = {+ operational: 'operational',+} as const;diff --git a/apps/web/src/lib/service-clients/service-auth/generated/schemas/systemStatusOneOfThree.ts b/apps/web/src/lib/service-clients/service-auth/generated/schemas/systemStatusOneOfThree.tsnew file mode 100644index 0000000000..417e814643--- /dev/null+++ b/apps/web/src/lib/service-clients/service-auth/generated/schemas/systemStatusOneOfThree.ts@@ -0,0 +1,16 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * authentication_service+ * OpenAPI spec version: 0.1.0+ */+import type { SystemStatusOneOfThreeStatus } from './systemStatusOneOfThreeStatus';++/**+ * Some features are slow or failing.+ */+export type SystemStatusOneOfThree = {+ /** What users should know. */+ message: string;+ status: SystemStatusOneOfThreeStatus;+};diff --git a/apps/web/src/lib/service-clients/service-auth/generated/schemas/systemStatusOneOfThreeStatus.ts b/apps/web/src/lib/service-clients/service-auth/generated/schemas/systemStatusOneOfThreeStatus.tsnew file mode 100644index 0000000000..5b26ccef7a--- /dev/null+++ b/apps/web/src/lib/service-clients/service-auth/generated/schemas/systemStatusOneOfThreeStatus.ts@@ -0,0 +1,14 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * authentication_service+ * OpenAPI spec version: 0.1.0+ */++export type SystemStatusOneOfThreeStatus =+ (typeof SystemStatusOneOfThreeStatus)[keyof typeof SystemStatusOneOfThreeStatus];++// eslint-disable-next-line @typescript-eslint/no-redeclare+export const SystemStatusOneOfThreeStatus = {+ degraded: 'degraded',+} as const;diff --git a/apps/web/src/lib/service-clients/service-auth/openapi.json b/apps/web/src/lib/service-clients/service-auth/openapi.jsonindex 0572188ec7..125a6f72f1 100644--- a/apps/web/src/lib/service-clients/service-auth/openapi.json+++ b/apps/web/src/lib/service-clients/service-auth/openapi.json@@ -3620,6 +3620,145 @@}}},+ "/system-status": {+ "get": {+ "tags": ["system_status"],+ "summary": "The status every user sees. Public: the banner shows wherever the app\nruns, signed in or not.",+ "operationId": "get_system_status",+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/CurrentSystemStatus"+ }+ }+ }+ },+ "500": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ErrorResponse"+ }+ }+ }+ }+ }+ },+ "post": {+ "tags": ["system_status"],+ "summary": "Sets the status every user sees and pushes it to every open app. Macro\nstaff only.",+ "description": "Authenticate with a Macro session, or from a script with a personal API\nkey (Settings → API keys) in the `x-macro-user-api-key` header. The body\nis the new status:\n\n- `{\"status\": \"operational\"}` clears the banner. It takes no message.\n- `{\"status\": \"degraded\", \"message\": \"Search is slow to update.\"}`\n- `{\"status\": \"major_outage\", \"message\": \"Macro is unavailable. We're on it.\"}`\n\nMessages are trimmed and must be 1–500 characters. Every call is kept in\nthe history, even when it repeats the current status.",+ "operationId": "set_system_status",+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/SystemStatus"+ }+ }+ },+ "required": true+ },+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/StatusUpdate"+ }+ }+ }+ },+ "401": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ErrorResponse"+ }+ }+ }+ },+ "403": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ErrorResponse"+ }+ }+ }+ },+ "422": {+ "description": "The body is not a valid status"+ },+ "500": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ErrorResponse"+ }+ }+ }+ }+ }+ }+ },+ "/system-status/history": {+ "get": {+ "tags": ["system_status"],+ "summary": "Recent status updates, newest first, with who set each. Macro staff only.",+ "operationId": "list_system_status_history",+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/SystemStatusHistory"+ }+ }+ }+ },+ "401": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ErrorResponse"+ }+ }+ }+ },+ "403": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ErrorResponse"+ }+ }+ }+ },+ "500": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ErrorResponse"+ }+ }+ }+ }+ }+ }+ },"/team": {"get": {"tags": ["teams::inbound::axum_router::get_team"],@@ -6464,6 +6603,25 @@}}},+ "CurrentSystemStatus": {+ "allOf": [+ {+ "$ref": "#/components/schemas/SystemStatus",+ "description": "The status and its message."+ },+ {+ "type": "object",+ "properties": {+ "updatedAt": {+ "type": ["string", "null"],+ "format": "date-time",+ "description": "When it was set; absent when no status was ever set. Clients keep the\nnewest status they have seen, whether fetched or pushed."+ }+ }+ }+ ],+ "description": "The status every user sees, without who set it."+ },"CursorApiKeyStatus": {"type": "object","description": "What settings needs to render the Cursor connection.\n\nDeliberately thin. `registered` drives the whole UI; `updatedAt` lets it say\nwhen the key was last replaced, which is the only thing a user can check\nagainst their own memory when a session starts failing.\n\nDeliberately *not* reporting anything about the deployment itself. That is\noperator information: a user who sees it cannot act on it, and a service\nthat cannot reach KMS does not start.",@@ -8139,6 +8297,35 @@}}},+ "StatusUpdate": {+ "allOf": [+ {+ "$ref": "#/components/schemas/SystemStatus",+ "description": "The status that was set."+ },+ {+ "type": "object",+ "required": ["id", "userId", "createdAt"],+ "properties": {+ "createdAt": {+ "type": "string",+ "format": "date-time",+ "description": "When it was set."+ },+ "id": {+ "type": "string",+ "format": "uuid",+ "description": "UUIDv7, so ids sort by creation."+ },+ "userId": {+ "type": "string",+ "description": "The staff member who set it."+ }+ }+ }+ ],+ "description": "One status a staff member set. The newest is the current status."+ },"StripeSessionResponse": {"type": "object","description": "Response containing the Stripe session URL",@@ -8172,6 +8359,66 @@}}},+ "SystemStatus": {+ "oneOf": [+ {+ "type": "object",+ "description": "Everything works; no banner is shown.",+ "required": ["status"],+ "properties": {+ "status": {+ "type": "string",+ "enum": ["operational"]+ }+ }+ },+ {+ "type": "object",+ "description": "Some features are slow or failing.",+ "required": ["message", "status"],+ "properties": {+ "message": {+ "type": "string",+ "description": "What users should know."+ },+ "status": {+ "type": "string",+ "enum": ["degraded"]+ }+ }+ },+ {+ "type": "object",+ "description": "Macro is largely unavailable.",+ "required": ["message", "status"],+ "properties": {+ "message": {+ "type": "string",+ "description": "What users should know."+ },+ "status": {+ "type": "string",+ "enum": ["major_outage"]+ }+ }+ }+ ],+ "description": "The platform status. Only the non-operational statuses carry a message."+ },+ "SystemStatusHistory": {+ "type": "object",+ "description": "Recent status updates, newest first.",+ "required": ["updates"],+ "properties": {+ "updates": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/StatusUpdate"+ },+ "description": "The updates."+ }+ }+ },"Team": {"type": "object","description": "The Team struct",diff --git a/apps/web/src/lib/service-clients/service-connection/generated/client.ts b/apps/web/src/lib/service-clients/service-connection/generated/client.tsindex 4f2de5a106..a4e817cbf1 100644--- a/apps/web/src/lib/service-clients/service-connection/generated/client.ts+++ b/apps/web/src/lib/service-clients/service-connection/generated/client.ts@@ -60,6 +60,67 @@ export const batchSendMessageHandler = async (} as batchSendMessageHandlerResponse;};+/**+ * @summary Sends a message to every open connection on every instance. Delivery is+best-effort and asynchronous, so there are no receipts.+ */+export type broadcastMessageHandlerResponse202 = {+ data: void;+ status: 202;+};++export type broadcastMessageHandlerResponse401 = {+ data: string;+ status: 401;+};++export type broadcastMessageHandlerResponse500 = {+ data: string;+ status: 500;+};++export type broadcastMessageHandlerResponseSuccess =+ broadcastMessageHandlerResponse202 & {+ headers: Headers;+ };+export type broadcastMessageHandlerResponseError = (+ | broadcastMessageHandlerResponse401+ | broadcastMessageHandlerResponse500+) & {+ headers: Headers;+};++export type broadcastMessageHandlerResponse =+ | broadcastMessageHandlerResponseSuccess+ | broadcastMessageHandlerResponseError;++export const getBroadcastMessageHandlerUrl = () => {+ return `/message/broadcast`;+};++export const broadcastMessageHandler = async (+ sendMessageBody: SendMessageBody,+ options?: RequestInit+): Promise<broadcastMessageHandlerResponse> => {+ const res = await fetch(getBroadcastMessageHandlerUrl(), {+ ...options,+ method: 'POST',+ headers: { 'Content-Type': 'application/json', ...options?.headers },+ body: JSON.stringify(sendMessageBody),+ });++ const body = [204, 205, 304].includes(res.status) ? null : await res.text();++ const data: broadcastMessageHandlerResponse['data'] = body+ ? JSON.parse(body)+ : {};+ return {+ data,+ status: res.status,+ headers: res.headers,+ } as broadcastMessageHandlerResponse;+};+export type sendMessageHandlerResponse201 = {data: SendMessageResponse;status: 201;diff --git a/apps/web/src/lib/service-clients/service-connection/openapi.json b/apps/web/src/lib/service-clients/service-connection/openapi.jsonindex b703288b7a..e3f084a3e2 100644--- a/apps/web/src/lib/service-clients/service-connection/openapi.json+++ b/apps/web/src/lib/service-clients/service-connection/openapi.json@@ -53,6 +53,53 @@]}},+ "/message/broadcast": {+ "post": {+ "tags": ["message"],+ "summary": "Sends a message to every open connection on every instance. Delivery is\nbest-effort and asynchronous, so there are no receipts.",+ "operationId": "broadcast_message_handler",+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/SendMessageBody"+ }+ }+ },+ "required": true+ },+ "responses": {+ "202": {+ "description": "Broadcast accepted"+ },+ "401": {+ "description": "",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "500": {+ "description": "",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ }+ },+ "security": [+ {+ "internal-api-key": []+ }+ ]+ }+ },"/message/send/{entity_type}/{entity_id}": {"post": {"tags": ["message"],diff --git a/apps/web/src/routes/app-router-view.tsx b/apps/web/src/routes/app-router-view.tsxindex 70a7e0515c..7f3e4ed086 100644--- a/apps/web/src/routes/app-router-view.tsx+++ b/apps/web/src/routes/app-router-view.tsx@@ -132,6 +132,7 @@ import {homeSplitRoute,inboxLinkCallbackRoute,internalInviteLinksRoute,+ internalSystemStatusRoute,inviteRoute,legacyContentRoute,loginPopupSuccessRoute,@@ -186,6 +187,10 @@ const ExternalRouteView = lazyNamed(() => import('@app/features/external-view/route-views'),'ExternalRouteView');+const SystemStatusDashboard = lazyNamed(+ () => import('@app/features/system-status/views/SystemStatusDashboard'),+ 'SystemStatusDashboard'+);/** Debug views stay behind the registry's lazy import. */function debugView(componentId: string) {@@ -271,6 +276,10 @@ export function AppRouterView() {definition={internalInviteLinksRoute}component={InviteLinksPortal}/>+ <Route+ definition={internalSystemStatusRoute}+ component={SystemStatusDashboard}+ /><Route definition={teamInviteRoute} component={TeamInviteAcceptance} /><Routedefinition={channelInviteRoute}diff --git a/apps/web/src/routes/routes.ts b/apps/web/src/routes/routes.tsindex b5cfcb7728..214e6f52a5 100644--- a/apps/web/src/routes/routes.ts+++ b/apps/web/src/routes/routes.ts@@ -172,6 +172,13 @@ export const internalInviteLinksRoute = defineRoute({externalSearch: '*',});+/** Macro staff only: set the status banner every user sees. */+export const internalSystemStatusRoute = defineRoute({+ id: 'internal-system-status',+ path: 'internal/status',+ externalSearch: '*',+});+export const teamInviteRoute = defineRoute({id: 'team-invite',path: 'team-invite',diff --git a/crates/agent_code_mode/src/domain/operations.json b/crates/agent_code_mode/src/domain/operations.jsonindex 2e98761181..b635cbf1a8 100644--- a/crates/agent_code_mode/src/domain/operations.json+++ b/crates/agent_code_mode/src/domain/operations.json@@ -108,6 +108,9 @@"auth.sendReferralCode": "Send Referral Code","auth.sessionCreation": "Session Creation","auth.sessionLogin": "Session Login",+ "auth.getSystemStatus": "Get System Status",+ "auth.setSystemStatus": "Set System Status",+ "auth.listSystemStatusHistory": "List System Status History","auth.deleteTeam": "Delete Team","auth.getTeam": "Get Team","auth.patchTeam": "Patch Team",diff --git a/crates/code_execution/src/outbound/deno/sdk.mjs b/crates/code_execution/src/outbound/deno/sdk.mjsindex c4f4c77bca..d5f7361441 100644--- a/crates/code_execution/src/outbound/deno/sdk.mjs+++ b/crates/code_execution/src/outbound/deno/sdk.mjs@@ -9,7 +9,7 @@ async function cO($,O,j){if(!Number.isInteger(O)||O<1)throw RangeError(`concurre`);U=y.pop()??"";for(let a of y){let i=a.split(``),F=[],v;for(let R of i)if(R.startsWith("data:"))F.push(R.replace(/^data:\s*/,""));else if(R.startsWith("event:"))v=R.replace(/^event:\s*/,"");else if(R.startsWith("id:"))J=R.replace(/^id:\s*/,"");else if(R.startsWith("retry:")){let m=Number.parseInt(R.replace(/^retry:\s*/,""),10);if(!Number.isNaN(m))V=m}let M,h=!1;if(F.length){let R=F.join(`-`);try{M=JSON.parse(R),h=!0}catch{M=R}}if(h){if(S)await S(M);if(x)M=await x(M)}if(j?.({data:M,event:v,id:J,retry:V}),F.length)yield M}}}finally{H.removeEventListener("abort",g),T.releaseLock()}break}catch(D){if(O?.(D),Z!==void 0&&B>=Z)break;let _=Math.min(V*2**(B-1),X??30000);await I(_)}}}()}}var vS=($)=>{switch($){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},hS=($)=>{switch($){case"form":return",";case"pipeDelimited":return"|";case"spaceDelimited":return"%20";default:return","}},mS=($)=>{switch($){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},hj=({allowReserved:$,explode:O,name:j,style:x,value:S})=>{if(!O){let X=($?S:S.map((G)=>encodeURIComponent(G))).join(hS(x));switch(x){case"label":return`.${X}`;case"matrix":return`;${j}=${X}`;case"simple":return X;default:return`${j}=${X}`}}let K=vS(x),Z=S.map((X)=>{if(x==="label"||x==="simple")return $?X:encodeURIComponent(X);return CO({allowReserved:$,name:j,value:X})}).join(K);return x==="label"||x==="matrix"?K+Z:Z},CO=({allowReserved:$,name:O,value:j})=>{if(j===void 0||j===null)return"";if(typeof j==="object")throw Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${O}=${$?j:encodeURIComponent(j)}`},mj=({allowReserved:$,explode:O,name:j,style:x,value:S,valueOnly:K})=>{if(S instanceof Date)return K?S.toISOString():`${j}=${S.toISOString()}`;if(x!=="deepObject"&&!O){let G=[];Object.entries(S).forEach(([Q,J])=>{G=[...G,Q,$?J:encodeURIComponent(J)]});let L=G.join(",");switch(x){case"form":return`${j}=${L}`;case"label":return`.${L}`;case"matrix":return`;${j}=${L}`;default:return L}}let Z=mS(x),X=Object.entries(S).map(([G,L])=>CO({allowReserved:$,name:x==="deepObject"?`${j}[${G}]`:G,value:L})).join(Z);return x==="label"||x==="matrix"?Z+X:X};var uS=/\{[^{}]+\}/g,cS=({path:$,url:O})=>{let j=O,x=O.match(uS);if(x)for(let S of x){let K=!1,Z=S.substring(1,S.length-1),X="simple";if(Z.endsWith("*"))K=!0,Z=Z.substring(0,Z.length-1);if(Z.startsWith("."))Z=Z.substring(1),X="label";else if(Z.startsWith(";"))Z=Z.substring(1),X="matrix";let G=$[Z];if(G===void 0||G===null)continue;if(Array.isArray(G)){j=j.replace(S,hj({explode:K,name:Z,style:X,value:G}));continue}if(typeof G==="object"){j=j.replace(S,mj({explode:K,name:Z,style:X,value:G,valueOnly:!0}));continue}if(X==="matrix"){j=j.replace(S,`;${CO({name:Z,value:G})}`);continue}let L=encodeURIComponent(X==="label"?`.${G}`:G);j=j.replace(S,L)}return j},U2=({baseUrl:$,path:O,query:j,querySerializer:x,url:S})=>{let K=S.startsWith("/")?S:`/${S}`,Z=($??"")+K;if(O)Z=cS({path:O,url:Z});let X=j?x(j):"";if(X.startsWith("?"))X=X.substring(1);if(X)Z+=`?${X}`;return Z};function px($){let O=$.body!==void 0;if(O&&$.bodySerializer){if("serializedBody"in $)return $.serializedBody!==void 0&&$.serializedBody!==""?$.serializedBody:null;return $.body!==""?$.body:null}if(O)return $.body;return}var z2=async($,O)=>{let j=typeof O==="function"?await O($):O;if(!j)return;if($.scheme==="bearer")return`Bearer ${j}`;if($.scheme==="basic")return`Basic ${btoa(j)}`;return j};var I2={bodySerializer:($)=>JSON.stringify($,(O,j)=>typeof j==="bigint"?j.toString():j)};var H2=({parameters:$={},...O}={})=>{return(x)=>{let S=[];if(x&&typeof x==="object")for(let K in x){let Z=x[K];if(Z===void 0||Z===null)continue;let X=$[K]||O;if(Array.isArray(Z)){let G=hj({allowReserved:X.allowReserved,explode:!0,name:K,style:"form",value:Z,...X.array});if(G)S.push(G)}else if(typeof Z==="object"){let G=mj({allowReserved:X.allowReserved,explode:!0,name:K,style:"deepObject",value:Z,...X.object});if(G)S.push(G)}else{let G=CO({allowReserved:X.allowReserved,name:K,value:Z});if(G)S.push(G)}}return S.join("&")}},T2=($)=>{if(!$)return"stream";let O=$.split(";")[0]?.trim();if(!O)return;if(O.startsWith("application/json")||O.endsWith("+json"))return"json";if(O==="multipart/form-data")return"formData";if(["application/","audio/","image/","video/"].some((j)=>O.startsWith(j)))return"blob";if(O.startsWith("text/"))return"text";return},dS=($,O)=>{if(!O)return!1;if($.headers.has(O)||$.query?.[O]||$.headers.get("Cookie")?.includes(`${O}=`))return!0;return!1};async function R2($){for(let O of $.security??[]){if(dS($,O.name))continue;let j=await z2(O,$.auth);if(!j)continue;let x=O.name??"Authorization";switch(O.in){case"query":if(!$.query)$.query={};$.query[x]=j;break;case"cookie":$.headers.append("Cookie",`${x}=${j}`);break;case"header":default:$.headers.set(x,j);break}}}var ax=($)=>U2({baseUrl:$.baseUrl,path:$.path,query:$.query,querySerializer:typeof $.querySerializer==="function"?$.querySerializer:H2($.querySerializer),url:$.url}),ix=($,O)=>{let j={...$,...O};if(j.baseUrl?.endsWith("/"))j.baseUrl=j.baseUrl.substring(0,j.baseUrl.length-1);return j.headers=cj($.headers,O.headers),j},lS=($)=>{let O=[];return $.forEach((j,x)=>{O.push([x,j])}),O},cj=(...$)=>{let O=new Headers;for(let j of $){if(!j)continue;let x=j instanceof Headers?lS(j):Object.entries(j);for(let[S,K]of x)if(K===null)O.delete(S);else if(Array.isArray(K))for(let Z of K)O.append(S,Z);else if(K!==void 0)O.set(S,typeof K==="object"?JSON.stringify(K):K)}return O};class uj{fns=[];clear(){this.fns=[]}eject($){let O=this.getInterceptorIndex($);if(this.fns[O])this.fns[O]=null}exists($){let O=this.getInterceptorIndex($);return Boolean(this.fns[O])}getInterceptorIndex($){if(typeof $==="number")return this.fns[$]?$:-1;return this.fns.indexOf($)}update($,O){let j=this.getInterceptorIndex($);if(this.fns[j])return this.fns[j]=O,$;return!1}use($){return this.fns.push($),this.fns.length-1}}var D2=()=>({error:new uj,request:new uj,response:new uj}),rS=H2({allowReserved:!1,array:{explode:!0,style:"form"},object:{explode:!0,style:"deepObject"}}),pS={"Content-Type":"application/json"},jj=($={})=>({...I2,headers:pS,parseAs:"auto",querySerializer:rS,...$});var nx=($={})=>{let O=ix(jj(),$),j=()=>({...O}),x=(Q)=>{return O=ix(O,Q),j()},S=D2(),K=async(Q)=>{let J={...O,...Q,fetch:Q.fetch??O.fetch??globalThis.fetch,headers:cj(O.headers,Q.headers),serializedBody:void 0};if(J.security)await R2(J);if(J.requestValidator)await J.requestValidator(J);if(J.body!==void 0&&J.bodySerializer)J.serializedBody=J.bodySerializer(J.body);if(J.body===void 0||J.serializedBody==="")J.headers.delete("Content-Type");let I=J,z=ax(I);return{opts:I,url:z}},Z=async(Q)=>{let J=Q.throwOnError??O.throwOnError,I=Q.responseStyle??O.responseStyle,z,W;try{let{opts:V,url:B}=await K(Q),H={redirect:"follow",...V,body:px(V)};z=new Request(B,H);for(let N of S.request.fns)if(N)z=await N(z,V);let C=V.fetch;W=await C(z);for(let N of S.response.fns)if(N)W=await N(W,z,V);let D={request:z,response:W};if(W.ok){let N=(V.parseAs==="auto"?T2(W.headers.get("Content-Type")):V.parseAs)??"json";if(W.status===204||W.headers.get("Content-Length")==="0"){let U;switch(N){case"arrayBuffer":case"blob":case"text":U=await W[N]();break;case"formData":U=new FormData;break;case"stream":U=W.body;break;case"json":default:U={};break}return V.responseStyle==="data"?U:{data:U,...D}}let T;switch(N){case"arrayBuffer":case"blob":case"formData":case"text":T=await W[N]();break;case"json":{let U=await W.text();T=U?JSON.parse(U):{};break}case"stream":return V.responseStyle==="data"?W.body:{data:W.body,...D}}if(N==="json"){if(V.responseValidator)await V.responseValidator(T);if(V.responseTransformer)T=await V.responseTransformer(T)}return V.responseStyle==="data"?T:{data:T,...D}}let _=await W.text(),w;try{w=JSON.parse(_)}catch{}throw w??_}catch(V){let B=V;for(let H of S.error.fns)if(H)B=await H(B,W,z,Q);if(B=B||{},J)throw B;return I==="data"?void 0:{error:B,request:z,response:W}}},X=(Q)=>(J)=>Z({...J,method:Q}),G=(Q)=>async(J)=>{let{opts:I,url:z}=await K(J);return N2({...I,body:I.body,method:Q,onRequest:async(W,V)=>{let B=new Request(W,V);for(let H of S.request.fns)if(H)B=await H(B,I);return B},serializedBody:px(I),url:z})};return{buildUrl:(Q)=>ax({...O,...Q}),connect:X("CONNECT"),delete:X("DELETE"),get:X("GET"),getConfig:j,head:X("HEAD"),interceptors:S,options:X("OPTIONS"),patch:X("PATCH"),post:X("POST"),put:X("PUT"),request:Z,setConfig:x,sse:{connect:G("CONNECT"),delete:G("DELETE"),get:G("GET"),head:G("HEAD"),options:G("OPTIONS"),patch:G("PATCH"),post:G("POST"),put:G("PUT"),trace:G("TRACE")},trace:X("TRACE")}};var _2=nx(jj());class M2{client;constructor($){this.client=$?.client??_2}}class A2{defaultKey="default";instances=new Map;get($){let O=this.instances.get($??this.defaultKey);if(!O)throw Error('No SDK client found. Create one with "new Sdk()" to fix this error.');return O}set($,O){this.instances.set(O??this.defaultKey,$)}}class dj extends M2{static __registry=new A2;constructor($){super($);dj.__registry.set(this,$?.key)}deleteAgentApiKey($){return($.client??this.client).delete({url:"/agents/{agent_id}/api-key",...$})}getAgentApiKey($){return($.client??this.client).get({url:"/agents/{agent_id}/api-key",...$})}putAgentApiKey($){return($.client??this.client).put({url:"/agents/{agent_id}/api-key",...$,headers:{"Content-Type":"application/json",...$.headers}})}updateAiBillingAutoReload($){return($.client??this.client).patch({url:"/ai-billing/auto-reload",...$,headers:{"Content-Type":"application/json",...$.headers}})}createAiCreditCheckout($){return($.client??this.client).post({url:"/ai-billing/credits/checkout",...$,headers:{"Content-Type":"application/json",...$.headers}})}updateAiBillingOverage($){return($.client??this.client).patch({url:"/ai-billing/overage",...$,headers:{"Content-Type":"application/json",...$.headers}})}getAiBillingPlans($){return($?.client??this.client).get({url:"/ai-billing/plans",...$})}getAiBillingSummary($){return($?.client??this.client).get({url:"/ai-billing/summary",...$})}disconnectCodex($){return($?.client??this.client).delete({url:"/codex",...$})}getCodexConnection($){return($?.client??this.client).get({url:"/codex",...$})}configureCodex($){return($.client??this.client).put({url:"/codex/config",...$,headers:{"Content-Type":"application/json",...$.headers}})}listCodexEnvironments($){return($?.client??this.client).get({url:"/codex/environments",...$})}startCodexLogin($){return($?.client??this.client).post({url:"/codex/login",...$})}cancelCodexLogin($){return($.client??this.client).delete({url:"/codex/login/{attempt_id}",...$})}pollCodexLogin($){return($.client??this.client).get({url:"/codex/login/{attempt_id}",...$})}deleteCursorApiKey($){return($?.client??this.client).delete({url:"/cursor-api-key",...$})}getCursorApiKey($){return($?.client??this.client).get({url:"/cursor-api-key",...$})}putCursorApiKey($){return($.client??this.client).put({url:"/cursor-api-key",...$,headers:{"Content-Type":"application/json",...$.headers}})}putCursorDefaultModel($){return($.client??this.client).put({url:"/cursor-api-key/default-model",...$,headers:{"Content-Type":"application/json",...$.headers}})}listCursorModels($){return($?.client??this.client).get({url:"/cursor-api-key/models",...$})}verifyFusionauthUserEmail($){return($.client??this.client).get({url:"/email/fusionauth/verify/{verification_id}",...$})}resendFusionauthVerifyUserEmail($){return($.client??this.client).post({url:"/email/fusionauth_resend",...$,headers:{"Content-Type":"application/json",...$.headers}})}generateEmailLink($){return($.client??this.client).post({url:"/email/generate/link",...$,headers:{"Content-Type":"application/json",...$.headers}})}verifyEmailLink($){return($.client??this.client).get({url:"/email/verify/{verification_id}",...$})}setGithubPullRequestDraft($){return($.client??this.client).post({url:"/github_pull_requests/draft",...$,headers:{"Content-Type":"application/json",...$.headers}})}enrichGithubPullRequests($){return($.client??this.client).post({url:"/github_pull_requests/enrich",...$,headers:{"Content-Type":"application/json",...$.headers}})}mergeGithubPullRequest($){return($.client??this.client).post({url:"/github_pull_requests/merge",...$,headers:{"Content-Type":"application/json",...$.headers}})}getGithubPullRequestMergeability($){return($.client??this.client).post({url:"/github_pull_requests/mergeability",...$,headers:{"Content-Type":"application/json",...$.headers}})}setGithubPullRequestState($){return($.client??this.client).post({url:"/github_pull_requests/state",...$,headers:{"Content-Type":"application/json",...$.headers}})}listGtmInviteLinks($){return($?.client??this.client).get({url:"/gtm-invite/links",...$})}createGtmInviteLink($){return($.client??this.client).post({url:"/gtm-invite/links",...$,headers:{"Content-Type":"application/json",...$.headers}})}revokeGtmInviteLink($){return($.client??this.client).delete({url:"/gtm-invite/links/{id}",...$})}getGtmInviteOffer($){return($?.client??this.client).get({url:"/gtm-invite/offer",...$})}resolveGtmInviteLink($){return($.client??this.client).get({url:"/gtm-invite/public/{token}",...$})}redeemGtmInviteLink($){return($.client??this.client).post({url:"/gtm-invite/redeem",...$,headers:{"Content-Type":"application/json",...$.headers}})}healthHandler($){return($?.client??this.client).get({url:"/health",...$})}macroApiToken($){return($.client??this.client).get({url:"/jwt/macro_api_token",...$})}refresh($){return($?.client??this.client).post({url:"/jwt/refresh",...$})}createInProgressLink($){return($?.client??this.client).post({url:"/link",...$})}emailConnectionProviders($){return($?.client??this.client).get({url:"/link/email/providers",...$})}deleteGithubLink($){return($?.client??this.client).delete({url:"/link/github",...$})}initGithubLink($){return($.client??this.client).post({url:"/link/github",...$})}checkGithubLinkStatus($){return($?.client??this.client).get({url:"/link/github/status",...$})}initGmailLink($){return($.client??this.client).post({url:"/link/gmail",...$})}checkGmailLinkStatus($){return($?.client??this.client).get({url:"/link/gmail/status",...$})}initOutlookLink($){return($?.client??this.client).post({url:"/link/outlook",...$})}appleLogin($){return($.client??this.client).post({url:"/login/apple",...$,headers:{"Content-Type":"application/json",...$.headers}})}passwordLogin($){return($.client??this.client).post({url:"/login/password",...$,headers:{"Content-Type":"application/json",...$.headers}})}passwordlessLogin($){return($.client??this.client).post({url:"/login/passwordless",...$,headers:{"Content-Type":"application/json",...$.headers}})}ssoLogin($){return($.client??this.client).get({url:"/login/sso",...$})}logout($){return($?.client??this.client).post({url:"/logout",...$})}createMergeRequest($){return($.client??this.client).post({url:"/merge",...$,headers:{"Content-Type":"application/json",...$.headers}})}verifyMergeRequest($){return($.client??this.client).get({url:"/merge/verify/{code}",...$})}sendMobileWelcomeEmail($){return($.client??this.client).post({url:"/mobile-welcome-email",...$,headers:{"Content-Type":"application/json",...$.headers}})}passwordlessCallback($){return($.client??this.client).get({url:"/oauth/passwordless/{code}",...$})}oauthRedirect($){return($?.client??this.client).get({url:"/oauth/redirect",...$})}oauth2Callback($){return($.client??this.client).get({url:"/oauth2/{provider}/callback",...$})}getPermissions($){return($?.client??this.client).get({url:"/permissions",...$})}getUserPermissions($){return($?.client??this.client).get({url:"/permissions/me",...$})}getReferralCode($){return($?.client??this.client).get({url:"/referral/code",...$})}sendReferralCode($){return($.client??this.client).post({url:"/referral/send",...$,headers:{"Content-Type":"application/json",...$.headers}})}sessionCreation($){return($?.client??this.client).post({url:"/session",...$})}sessionLogin($){return($.client??this.client).get({url:"/session/login/{session_code}",...$})}deleteTeam($){return($?.client??this.client).delete({url:"/team",...$})}getTeam($){return($?.client??this.client).get({url:"/team",...$})}patchTeam($){return($.client??this.client).patch({url:"/team",...$,headers:{"Content-Type":"application/json",...$.headers}})}createTeam($){return($.client??this.client).post({url:"/team",...$,headers:{"Content-Type":"application/json",...$.headers}})}toggleTeamAutoJoinDomain($){return($?.client??this.client).post({url:"/team/auto-join-domain/toggle",...$})}patchTeamCrmSettings($){return($.client??this.client).patch({url:"/team/crm",...$,headers:{"Content-Type":"application/json",...$.headers}})}inviteToTeam($){return($.client??this.client).post({url:"/team/invite",...$,headers:{"Content-Type":"application/json",...$.headers}})}deleteTeamInviteLink($){return($?.client??this.client).delete({url:"/team/invite-link",...$})}getTeamInviteLink($){return($?.client??this.client).get({url:"/team/invite-link",...$})}createTeamInviteLink($){return($?.client??this.client).post({url:"/team/invite-link",...$})}joinTeamByInviteLink($){return($.client??this.client).post({url:"/team/invite-link/join",...$,headers:{"Content-Type":"application/json",...$.headers}})}getTeamByInviteLink($){return($.client??this.client).post({url:"/team/invite-link/team",...$,headers:{"Content-Type":"application/json",...$.headers}})}deleteTeamInviteHandler($){return($.client??this.client).delete({url:"/team/invite/{team_invite_id}",...$})}getTeamInvites($){return($?.client??this.client).get({url:"/team/invites",...$})}rejectInvitation($){return($.client??this.client).delete({url:"/team/join/{team_invite_id}",...$})}joinTeam($){return($.client??this.client).get({url:"/team/join/{team_invite_id}",...$})}patchTeamMemberPlan($){return($.client??this.client).patch({url:"/team/members/{member_user_id}/plan",...$,headers:{"Content-Type":"application/json",...$.headers}})}toggleTeamNonAdminInvites($){return($?.client??this.client).post({url:"/team/non-admin-invites/toggle",...$})}removeUserFromTeam($){return($.client??this.client).delete({url:"/team/remove/{remove_user_id}",...$})}getUserTeams($){return($?.client??this.client).get({url:"/team/user",...$})}getUserInvites($){return($?.client??this.client).get({url:"/team/user/invites",...$})}getUserNames($){return($.client??this.client).post({url:"/user/get_names",...$,headers:{"Content-Type":"application/json",...$.headers}})}getUserNamesWithEmail($){return($.client??this.client).post({url:"/user/get_names_with_email",...$,headers:{"Content-Type":"application/json",...$.headers}})}patchUserGroup($){return($.client??this.client).patch({url:"/user/group",...$,headers:{"Content-Type":"application/json",...$.headers}})}getUserLanguage($){return($?.client??this.client).get({url:"/user/language",...$})}putUserLanguage($){return($.client??this.client).put({url:"/user/language",...$,headers:{"Content-Type":"application/json",...$.headers}})}getLegacyUserPermissions($){return($?.client??this.client).get({url:"/user/legacy_user_permissions",...$})}getUserLinkExists($){return($.client??this.client).get({url:"/user/link_exists",...$})}deleteUser($){return($?.client??this.client).delete({url:"/user/me",...$})}getUserInfo($){return($?.client??this.client).get({url:"/user/me",...$})}getUserName($){return($?.client??this.client).get({url:"/user/name",...$})}putUserName($){return($?.client??this.client).put({url:"/user/name",...$})}patchUserOnboarding($){return($.client??this.client).patch({url:"/user/onboarding",...$,headers:{"Content-Type":"application/json",...$.headers}})}getUserOrganization($){return($?.client??this.client).get({url:"/user/organization",...$})}putProfilePicture($){return($.client??this.client).put({url:"/user/profile_picture",...$})}postProfilePictures($){return($.client??this.client).post({url:"/user/profile_pictures",...$,headers:{"Content-Type":"application/json",...$.headers}})}getUserQuota($){return($?.client??this.client).get({url:"/user/quota",...$})}createCheckoutSessionV2($){return($.client??this.client).post({url:"/user/stripe/checkoutv2",...$,headers:{"Content-Type":"application/json",...$.headers}})}getSubscriptionStatus($){return($?.client??this.client).get({url:"/user/stripe/plan",...$})}changePlan($){return($.client??this.client).post({url:"/user/stripe/plan",...$,headers:{"Content-Type":"application/json",...$.headers}})}createPortalSession($){return($.client??this.client).post({url:"/user/stripe/portal",...$,headers:{"Content-Type":"application/json",...$.headers}})}getTrialEligibility($){return($?.client??this.client).get({url:"/user/stripe/trial_eligibility",...$})}patchUserTutorial($){return($.client??this.client).patch({url:"/user/tutorial",...$,headers:{"Content-Type":"application/json",...$.headers}})}}function P2({onRequest:$,onSseError:O,onSseEvent:j,responseTransformer:x,responseValidator:S,sseDefaultRetryDelay:K,sseMaxRetryAttempts:Z,sseMaxRetryDelay:X,sseSleepFn:G,url:L,...Q}){let J,I=G??((V)=>new Promise((B)=>setTimeout(B,V)));return{stream:async function*(){let V=K??3000,B=0,H=Q.signal??new AbortController().signal;while(!0){if(H.aborted)break;B++;let C=Q.headers instanceof Headers?Q.headers:new Headers(Q.headers);if(J!==void 0)C.set("Last-Event-ID",J);try{let D={redirect:"follow",...Q,body:Q.serializedBody,headers:C,signal:H},_=new Request(L,D);if($)_=await $(L,D);let N=await(Q.fetch??globalThis.fetch)(_);if(!N.ok)throw Error(`SSE failed: ${N.status} ${N.statusText}`);if(!N.body)throw Error("No body in SSE response");let T=N.body.pipeThrough(new TextDecoderStream).getReader(),U="",g=()=>{try{T.cancel()}catch{}};H.addEventListener("abort",g);try{while(!0){let{done:r,value:p}=await T.read();if(r)break;U+=p,U=U.replace(/\r\n?/g,`+`);try{M=JSON.parse(R),h=!0}catch{M=R}}if(h){if(S)await S(M);if(x)M=await x(M)}if(j?.({data:M,event:v,id:J,retry:V}),F.length)yield M}}}finally{H.removeEventListener("abort",g),T.releaseLock()}break}catch(D){if(O?.(D),Z!==void 0&&B>=Z)break;let _=Math.min(V*2**(B-1),X??30000);await I(_)}}}()}}var vS=($)=>{switch($){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},hS=($)=>{switch($){case"form":return",";case"pipeDelimited":return"|";case"spaceDelimited":return"%20";default:return","}},mS=($)=>{switch($){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},hj=({allowReserved:$,explode:O,name:j,style:x,value:S})=>{if(!O){let X=($?S:S.map((G)=>encodeURIComponent(G))).join(hS(x));switch(x){case"label":return`.${X}`;case"matrix":return`;${j}=${X}`;case"simple":return X;default:return`${j}=${X}`}}let K=vS(x),Z=S.map((X)=>{if(x==="label"||x==="simple")return $?X:encodeURIComponent(X);return CO({allowReserved:$,name:j,value:X})}).join(K);return x==="label"||x==="matrix"?K+Z:Z},CO=({allowReserved:$,name:O,value:j})=>{if(j===void 0||j===null)return"";if(typeof j==="object")throw Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${O}=${$?j:encodeURIComponent(j)}`},mj=({allowReserved:$,explode:O,name:j,style:x,value:S,valueOnly:K})=>{if(S instanceof Date)return K?S.toISOString():`${j}=${S.toISOString()}`;if(x!=="deepObject"&&!O){let G=[];Object.entries(S).forEach(([Q,J])=>{G=[...G,Q,$?J:encodeURIComponent(J)]});let L=G.join(",");switch(x){case"form":return`${j}=${L}`;case"label":return`.${L}`;case"matrix":return`;${j}=${L}`;default:return L}}let Z=mS(x),X=Object.entries(S).map(([G,L])=>CO({allowReserved:$,name:x==="deepObject"?`${j}[${G}]`:G,value:L})).join(Z);return x==="label"||x==="matrix"?Z+X:X};var uS=/\{[^{}]+\}/g,cS=({path:$,url:O})=>{let j=O,x=O.match(uS);if(x)for(let S of x){let K=!1,Z=S.substring(1,S.length-1),X="simple";if(Z.endsWith("*"))K=!0,Z=Z.substring(0,Z.length-1);if(Z.startsWith("."))Z=Z.substring(1),X="label";else if(Z.startsWith(";"))Z=Z.substring(1),X="matrix";let G=$[Z];if(G===void 0||G===null)continue;if(Array.isArray(G)){j=j.replace(S,hj({explode:K,name:Z,style:X,value:G}));continue}if(typeof G==="object"){j=j.replace(S,mj({explode:K,name:Z,style:X,value:G,valueOnly:!0}));continue}if(X==="matrix"){j=j.replace(S,`;${CO({name:Z,value:G})}`);continue}let L=encodeURIComponent(X==="label"?`.${G}`:G);j=j.replace(S,L)}return j},U2=({baseUrl:$,path:O,query:j,querySerializer:x,url:S})=>{let K=S.startsWith("/")?S:`/${S}`,Z=($??"")+K;if(O)Z=cS({path:O,url:Z});let X=j?x(j):"";if(X.startsWith("?"))X=X.substring(1);if(X)Z+=`?${X}`;return Z};function px($){let O=$.body!==void 0;if(O&&$.bodySerializer){if("serializedBody"in $)return $.serializedBody!==void 0&&$.serializedBody!==""?$.serializedBody:null;return $.body!==""?$.body:null}if(O)return $.body;return}var z2=async($,O)=>{let j=typeof O==="function"?await O($):O;if(!j)return;if($.scheme==="bearer")return`Bearer ${j}`;if($.scheme==="basic")return`Basic ${btoa(j)}`;return j};var I2={bodySerializer:($)=>JSON.stringify($,(O,j)=>typeof j==="bigint"?j.toString():j)};var H2=({parameters:$={},...O}={})=>{return(x)=>{let S=[];if(x&&typeof x==="object")for(let K in x){let Z=x[K];if(Z===void 0||Z===null)continue;let X=$[K]||O;if(Array.isArray(Z)){let G=hj({allowReserved:X.allowReserved,explode:!0,name:K,style:"form",value:Z,...X.array});if(G)S.push(G)}else if(typeof Z==="object"){let G=mj({allowReserved:X.allowReserved,explode:!0,name:K,style:"deepObject",value:Z,...X.object});if(G)S.push(G)}else{let G=CO({allowReserved:X.allowReserved,name:K,value:Z});if(G)S.push(G)}}return S.join("&")}},T2=($)=>{if(!$)return"stream";let O=$.split(";")[0]?.trim();if(!O)return;if(O.startsWith("application/json")||O.endsWith("+json"))return"json";if(O==="multipart/form-data")return"formData";if(["application/","audio/","image/","video/"].some((j)=>O.startsWith(j)))return"blob";if(O.startsWith("text/"))return"text";return},dS=($,O)=>{if(!O)return!1;if($.headers.has(O)||$.query?.[O]||$.headers.get("Cookie")?.includes(`${O}=`))return!0;return!1};async function R2($){for(let O of $.security??[]){if(dS($,O.name))continue;let j=await z2(O,$.auth);if(!j)continue;let x=O.name??"Authorization";switch(O.in){case"query":if(!$.query)$.query={};$.query[x]=j;break;case"cookie":$.headers.append("Cookie",`${x}=${j}`);break;case"header":default:$.headers.set(x,j);break}}}var ax=($)=>U2({baseUrl:$.baseUrl,path:$.path,query:$.query,querySerializer:typeof $.querySerializer==="function"?$.querySerializer:H2($.querySerializer),url:$.url}),ix=($,O)=>{let j={...$,...O};if(j.baseUrl?.endsWith("/"))j.baseUrl=j.baseUrl.substring(0,j.baseUrl.length-1);return j.headers=cj($.headers,O.headers),j},lS=($)=>{let O=[];return $.forEach((j,x)=>{O.push([x,j])}),O},cj=(...$)=>{let O=new Headers;for(let j of $){if(!j)continue;let x=j instanceof Headers?lS(j):Object.entries(j);for(let[S,K]of x)if(K===null)O.delete(S);else if(Array.isArray(K))for(let Z of K)O.append(S,Z);else if(K!==void 0)O.set(S,typeof K==="object"?JSON.stringify(K):K)}return O};class uj{fns=[];clear(){this.fns=[]}eject($){let O=this.getInterceptorIndex($);if(this.fns[O])this.fns[O]=null}exists($){let O=this.getInterceptorIndex($);return Boolean(this.fns[O])}getInterceptorIndex($){if(typeof $==="number")return this.fns[$]?$:-1;return this.fns.indexOf($)}update($,O){let j=this.getInterceptorIndex($);if(this.fns[j])return this.fns[j]=O,$;return!1}use($){return this.fns.push($),this.fns.length-1}}var D2=()=>({error:new uj,request:new uj,response:new uj}),rS=H2({allowReserved:!1,array:{explode:!0,style:"form"},object:{explode:!0,style:"deepObject"}}),pS={"Content-Type":"application/json"},jj=($={})=>({...I2,headers:pS,parseAs:"auto",querySerializer:rS,...$});var nx=($={})=>{let O=ix(jj(),$),j=()=>({...O}),x=(Q)=>{return O=ix(O,Q),j()},S=D2(),K=async(Q)=>{let J={...O,...Q,fetch:Q.fetch??O.fetch??globalThis.fetch,headers:cj(O.headers,Q.headers),serializedBody:void 0};if(J.security)await R2(J);if(J.requestValidator)await J.requestValidator(J);if(J.body!==void 0&&J.bodySerializer)J.serializedBody=J.bodySerializer(J.body);if(J.body===void 0||J.serializedBody==="")J.headers.delete("Content-Type");let I=J,z=ax(I);return{opts:I,url:z}},Z=async(Q)=>{let J=Q.throwOnError??O.throwOnError,I=Q.responseStyle??O.responseStyle,z,W;try{let{opts:V,url:B}=await K(Q),H={redirect:"follow",...V,body:px(V)};z=new Request(B,H);for(let N of S.request.fns)if(N)z=await N(z,V);let C=V.fetch;W=await C(z);for(let N of S.response.fns)if(N)W=await N(W,z,V);let D={request:z,response:W};if(W.ok){let N=(V.parseAs==="auto"?T2(W.headers.get("Content-Type")):V.parseAs)??"json";if(W.status===204||W.headers.get("Content-Length")==="0"){let U;switch(N){case"arrayBuffer":case"blob":case"text":U=await W[N]();break;case"formData":U=new FormData;break;case"stream":U=W.body;break;case"json":default:U={};break}return V.responseStyle==="data"?U:{data:U,...D}}let T;switch(N){case"arrayBuffer":case"blob":case"formData":case"text":T=await W[N]();break;case"json":{let U=await W.text();T=U?JSON.parse(U):{};break}case"stream":return V.responseStyle==="data"?W.body:{data:W.body,...D}}if(N==="json"){if(V.responseValidator)await V.responseValidator(T);if(V.responseTransformer)T=await V.responseTransformer(T)}return V.responseStyle==="data"?T:{data:T,...D}}let _=await W.text(),w;try{w=JSON.parse(_)}catch{}throw w??_}catch(V){let B=V;for(let H of S.error.fns)if(H)B=await H(B,W,z,Q);if(B=B||{},J)throw B;return I==="data"?void 0:{error:B,request:z,response:W}}},X=(Q)=>(J)=>Z({...J,method:Q}),G=(Q)=>async(J)=>{let{opts:I,url:z}=await K(J);return N2({...I,body:I.body,method:Q,onRequest:async(W,V)=>{let B=new Request(W,V);for(let H of S.request.fns)if(H)B=await H(B,I);return B},serializedBody:px(I),url:z})};return{buildUrl:(Q)=>ax({...O,...Q}),connect:X("CONNECT"),delete:X("DELETE"),get:X("GET"),getConfig:j,head:X("HEAD"),interceptors:S,options:X("OPTIONS"),patch:X("PATCH"),post:X("POST"),put:X("PUT"),request:Z,setConfig:x,sse:{connect:G("CONNECT"),delete:G("DELETE"),get:G("GET"),head:G("HEAD"),options:G("OPTIONS"),patch:G("PATCH"),post:G("POST"),put:G("PUT"),trace:G("TRACE")},trace:X("TRACE")}};var _2=nx(jj());class M2{client;constructor($){this.client=$?.client??_2}}class A2{defaultKey="default";instances=new Map;get($){let O=this.instances.get($??this.defaultKey);if(!O)throw Error('No SDK client found. Create one with "new Sdk()" to fix this error.');return O}set($,O){this.instances.set(O??this.defaultKey,$)}}class dj extends M2{static __registry=new A2;constructor($){super($);dj.__registry.set(this,$?.key)}deleteAgentApiKey($){return($.client??this.client).delete({url:"/agents/{agent_id}/api-key",...$})}getAgentApiKey($){return($.client??this.client).get({url:"/agents/{agent_id}/api-key",...$})}putAgentApiKey($){return($.client??this.client).put({url:"/agents/{agent_id}/api-key",...$,headers:{"Content-Type":"application/json",...$.headers}})}updateAiBillingAutoReload($){return($.client??this.client).patch({url:"/ai-billing/auto-reload",...$,headers:{"Content-Type":"application/json",...$.headers}})}createAiCreditCheckout($){return($.client??this.client).post({url:"/ai-billing/credits/checkout",...$,headers:{"Content-Type":"application/json",...$.headers}})}updateAiBillingOverage($){return($.client??this.client).patch({url:"/ai-billing/overage",...$,headers:{"Content-Type":"application/json",...$.headers}})}getAiBillingPlans($){return($?.client??this.client).get({url:"/ai-billing/plans",...$})}getAiBillingSummary($){return($?.client??this.client).get({url:"/ai-billing/summary",...$})}disconnectCodex($){return($?.client??this.client).delete({url:"/codex",...$})}getCodexConnection($){return($?.client??this.client).get({url:"/codex",...$})}configureCodex($){return($.client??this.client).put({url:"/codex/config",...$,headers:{"Content-Type":"application/json",...$.headers}})}listCodexEnvironments($){return($?.client??this.client).get({url:"/codex/environments",...$})}startCodexLogin($){return($?.client??this.client).post({url:"/codex/login",...$})}cancelCodexLogin($){return($.client??this.client).delete({url:"/codex/login/{attempt_id}",...$})}pollCodexLogin($){return($.client??this.client).get({url:"/codex/login/{attempt_id}",...$})}deleteCursorApiKey($){return($?.client??this.client).delete({url:"/cursor-api-key",...$})}getCursorApiKey($){return($?.client??this.client).get({url:"/cursor-api-key",...$})}putCursorApiKey($){return($.client??this.client).put({url:"/cursor-api-key",...$,headers:{"Content-Type":"application/json",...$.headers}})}putCursorDefaultModel($){return($.client??this.client).put({url:"/cursor-api-key/default-model",...$,headers:{"Content-Type":"application/json",...$.headers}})}listCursorModels($){return($?.client??this.client).get({url:"/cursor-api-key/models",...$})}verifyFusionauthUserEmail($){return($.client??this.client).get({url:"/email/fusionauth/verify/{verification_id}",...$})}resendFusionauthVerifyUserEmail($){return($.client??this.client).post({url:"/email/fusionauth_resend",...$,headers:{"Content-Type":"application/json",...$.headers}})}generateEmailLink($){return($.client??this.client).post({url:"/email/generate/link",...$,headers:{"Content-Type":"application/json",...$.headers}})}verifyEmailLink($){return($.client??this.client).get({url:"/email/verify/{verification_id}",...$})}setGithubPullRequestDraft($){return($.client??this.client).post({url:"/github_pull_requests/draft",...$,headers:{"Content-Type":"application/json",...$.headers}})}enrichGithubPullRequests($){return($.client??this.client).post({url:"/github_pull_requests/enrich",...$,headers:{"Content-Type":"application/json",...$.headers}})}mergeGithubPullRequest($){return($.client??this.client).post({url:"/github_pull_requests/merge",...$,headers:{"Content-Type":"application/json",...$.headers}})}getGithubPullRequestMergeability($){return($.client??this.client).post({url:"/github_pull_requests/mergeability",...$,headers:{"Content-Type":"application/json",...$.headers}})}setGithubPullRequestState($){return($.client??this.client).post({url:"/github_pull_requests/state",...$,headers:{"Content-Type":"application/json",...$.headers}})}listGtmInviteLinks($){return($?.client??this.client).get({url:"/gtm-invite/links",...$})}createGtmInviteLink($){return($.client??this.client).post({url:"/gtm-invite/links",...$,headers:{"Content-Type":"application/json",...$.headers}})}revokeGtmInviteLink($){return($.client??this.client).delete({url:"/gtm-invite/links/{id}",...$})}getGtmInviteOffer($){return($?.client??this.client).get({url:"/gtm-invite/offer",...$})}resolveGtmInviteLink($){return($.client??this.client).get({url:"/gtm-invite/public/{token}",...$})}redeemGtmInviteLink($){return($.client??this.client).post({url:"/gtm-invite/redeem",...$,headers:{"Content-Type":"application/json",...$.headers}})}healthHandler($){return($?.client??this.client).get({url:"/health",...$})}macroApiToken($){return($.client??this.client).get({url:"/jwt/macro_api_token",...$})}refresh($){return($?.client??this.client).post({url:"/jwt/refresh",...$})}createInProgressLink($){return($?.client??this.client).post({url:"/link",...$})}emailConnectionProviders($){return($?.client??this.client).get({url:"/link/email/providers",...$})}deleteGithubLink($){return($?.client??this.client).delete({url:"/link/github",...$})}initGithubLink($){return($.client??this.client).post({url:"/link/github",...$})}checkGithubLinkStatus($){return($?.client??this.client).get({url:"/link/github/status",...$})}initGmailLink($){return($.client??this.client).post({url:"/link/gmail",...$})}checkGmailLinkStatus($){return($?.client??this.client).get({url:"/link/gmail/status",...$})}initOutlookLink($){return($?.client??this.client).post({url:"/link/outlook",...$})}appleLogin($){return($.client??this.client).post({url:"/login/apple",...$,headers:{"Content-Type":"application/json",...$.headers}})}passwordLogin($){return($.client??this.client).post({url:"/login/password",...$,headers:{"Content-Type":"application/json",...$.headers}})}passwordlessLogin($){return($.client??this.client).post({url:"/login/passwordless",...$,headers:{"Content-Type":"application/json",...$.headers}})}ssoLogin($){return($.client??this.client).get({url:"/login/sso",...$})}logout($){return($?.client??this.client).post({url:"/logout",...$})}createMergeRequest($){return($.client??this.client).post({url:"/merge",...$,headers:{"Content-Type":"application/json",...$.headers}})}verifyMergeRequest($){return($.client??this.client).get({url:"/merge/verify/{code}",...$})}sendMobileWelcomeEmail($){return($.client??this.client).post({url:"/mobile-welcome-email",...$,headers:{"Content-Type":"application/json",...$.headers}})}passwordlessCallback($){return($.client??this.client).get({url:"/oauth/passwordless/{code}",...$})}oauthRedirect($){return($?.client??this.client).get({url:"/oauth/redirect",...$})}oauth2Callback($){return($.client??this.client).get({url:"/oauth2/{provider}/callback",...$})}getPermissions($){return($?.client??this.client).get({url:"/permissions",...$})}getUserPermissions($){return($?.client??this.client).get({url:"/permissions/me",...$})}getReferralCode($){return($?.client??this.client).get({url:"/referral/code",...$})}sendReferralCode($){return($.client??this.client).post({url:"/referral/send",...$,headers:{"Content-Type":"application/json",...$.headers}})}sessionCreation($){return($?.client??this.client).post({url:"/session",...$})}sessionLogin($){return($.client??this.client).get({url:"/session/login/{session_code}",...$})}getSystemStatus($){return($?.client??this.client).get({url:"/system-status",...$})}setSystemStatus($){return($.client??this.client).post({url:"/system-status",...$,headers:{"Content-Type":"application/json",...$.headers}})}listSystemStatusHistory($){return($?.client??this.client).get({url:"/system-status/history",...$})}deleteTeam($){return($?.client??this.client).delete({url:"/team",...$})}getTeam($){return($?.client??this.client).get({url:"/team",...$})}patchTeam($){return($.client??this.client).patch({url:"/team",...$,headers:{"Content-Type":"application/json",...$.headers}})}createTeam($){return($.client??this.client).post({url:"/team",...$,headers:{"Content-Type":"application/json",...$.headers}})}toggleTeamAutoJoinDomain($){return($?.client??this.client).post({url:"/team/auto-join-domain/toggle",...$})}patchTeamCrmSettings($){return($.client??this.client).patch({url:"/team/crm",...$,headers:{"Content-Type":"application/json",...$.headers}})}inviteToTeam($){return($.client??this.client).post({url:"/team/invite",...$,headers:{"Content-Type":"application/json",...$.headers}})}deleteTeamInviteLink($){return($?.client??this.client).delete({url:"/team/invite-link",...$})}getTeamInviteLink($){return($?.client??this.client).get({url:"/team/invite-link",...$})}createTeamInviteLink($){return($?.client??this.client).post({url:"/team/invite-link",...$})}joinTeamByInviteLink($){return($.client??this.client).post({url:"/team/invite-link/join",...$,headers:{"Content-Type":"application/json",...$.headers}})}getTeamByInviteLink($){return($.client??this.client).post({url:"/team/invite-link/team",...$,headers:{"Content-Type":"application/json",...$.headers}})}deleteTeamInviteHandler($){return($.client??this.client).delete({url:"/team/invite/{team_invite_id}",...$})}getTeamInvites($){return($?.client??this.client).get({url:"/team/invites",...$})}rejectInvitation($){return($.client??this.client).delete({url:"/team/join/{team_invite_id}",...$})}joinTeam($){return($.client??this.client).get({url:"/team/join/{team_invite_id}",...$})}patchTeamMemberPlan($){return($.client??this.client).patch({url:"/team/members/{member_user_id}/plan",...$,headers:{"Content-Type":"application/json",...$.headers}})}toggleTeamNonAdminInvites($){return($?.client??this.client).post({url:"/team/non-admin-invites/toggle",...$})}removeUserFromTeam($){return($.client??this.client).delete({url:"/team/remove/{remove_user_id}",...$})}getUserTeams($){return($?.client??this.client).get({url:"/team/user",...$})}getUserInvites($){return($?.client??this.client).get({url:"/team/user/invites",...$})}getUserNames($){return($.client??this.client).post({url:"/user/get_names",...$,headers:{"Content-Type":"application/json",...$.headers}})}getUserNamesWithEmail($){return($.client??this.client).post({url:"/user/get_names_with_email",...$,headers:{"Content-Type":"application/json",...$.headers}})}patchUserGroup($){return($.client??this.client).patch({url:"/user/group",...$,headers:{"Content-Type":"application/json",...$.headers}})}getUserLanguage($){return($?.client??this.client).get({url:"/user/language",...$})}putUserLanguage($){return($.client??this.client).put({url:"/user/language",...$,headers:{"Content-Type":"application/json",...$.headers}})}getLegacyUserPermissions($){return($?.client??this.client).get({url:"/user/legacy_user_permissions",...$})}getUserLinkExists($){return($.client??this.client).get({url:"/user/link_exists",...$})}deleteUser($){return($?.client??this.client).delete({url:"/user/me",...$})}getUserInfo($){return($?.client??this.client).get({url:"/user/me",...$})}getUserName($){return($?.client??this.client).get({url:"/user/name",...$})}putUserName($){return($?.client??this.client).put({url:"/user/name",...$})}patchUserOnboarding($){return($.client??this.client).patch({url:"/user/onboarding",...$,headers:{"Content-Type":"application/json",...$.headers}})}getUserOrganization($){return($?.client??this.client).get({url:"/user/organization",...$})}putProfilePicture($){return($.client??this.client).put({url:"/user/profile_picture",...$})}postProfilePictures($){return($.client??this.client).post({url:"/user/profile_pictures",...$,headers:{"Content-Type":"application/json",...$.headers}})}getUserQuota($){return($?.client??this.client).get({url:"/user/quota",...$})}createCheckoutSessionV2($){return($.client??this.client).post({url:"/user/stripe/checkoutv2",...$,headers:{"Content-Type":"application/json",...$.headers}})}getSubscriptionStatus($){return($?.client??this.client).get({url:"/user/stripe/plan",...$})}changePlan($){return($.client??this.client).post({url:"/user/stripe/plan",...$,headers:{"Content-Type":"application/json",...$.headers}})}createPortalSession($){return($.client??this.client).post({url:"/user/stripe/portal",...$,headers:{"Content-Type":"application/json",...$.headers}})}getTrialEligibility($){return($?.client??this.client).get({url:"/user/stripe/trial_eligibility",...$})}patchUserTutorial($){return($.client??this.client).patch({url:"/user/tutorial",...$,headers:{"Content-Type":"application/json",...$.headers}})}}function P2({onRequest:$,onSseError:O,onSseEvent:j,responseTransformer:x,responseValidator:S,sseDefaultRetryDelay:K,sseMaxRetryAttempts:Z,sseMaxRetryDelay:X,sseSleepFn:G,url:L,...Q}){let J,I=G??((V)=>new Promise((B)=>setTimeout(B,V)));return{stream:async function*(){let V=K??3000,B=0,H=Q.signal??new AbortController().signal;while(!0){if(H.aborted)break;B++;let C=Q.headers instanceof Headers?Q.headers:new Headers(Q.headers);if(J!==void 0)C.set("Last-Event-ID",J);try{let D={redirect:"follow",...Q,body:Q.serializedBody,headers:C,signal:H},_=new Request(L,D);if($)_=await $(L,D);let N=await(Q.fetch??globalThis.fetch)(_);if(!N.ok)throw Error(`SSE failed: ${N.status} ${N.statusText}`);if(!N.body)throw Error("No body in SSE response");let T=N.body.pipeThrough(new TextDecoderStream).getReader(),U="",g=()=>{try{T.cancel()}catch{}};H.addEventListener("abort",g);try{while(!0){let{done:r,value:p}=await T.read();if(r)break;U+=p,U=U.replace(/\r\n?/g,``);let y=U.split(``);U=y.pop()??"";for(let a of y){let i=a.split(`diff --git a/crates/connection_gateway_client/AGENTS.md b/crates/connection_gateway_client/AGENTS.mdindex b4659d38b9..4e8801f395 100644--- a/crates/connection_gateway_client/AGENTS.md+++ b/crates/connection_gateway_client/AGENTS.md@@ -11,7 +11,8 @@ connected users.- `src/client.rs`: `ConnectionGatewayClient`, `REQUEST_TIMEOUT` (15s — read itsdoc comment before changing; delivery is best-effort, callers don't wait- indefinitely), and the generic `send_message`/batch methods.+ indefinitely), and the generic `send_message`/batch/`broadcast_message`+ methods.- `src/client/calendar.rs`, `src/client/email.rs`: thin per-feature wrappersover the generic send methods (e.g. `refresh_calendar`, `refresh_email`).- `connection_gateway_models` (sibling crate): the wire typesdiff --git a/crates/connection_gateway_client/src/client.rs b/crates/connection_gateway_client/src/client.rsindex 1bc186e419..f85800f692 100644--- a/crates/connection_gateway_client/src/client.rs+++ b/crates/connection_gateway_client/src/client.rs@@ -131,6 +131,28 @@ impl ConnectionGatewayClient {Ok(receipts.receipts)}+ /// Send a message to every open connection, whoever it belongs to.+ pub async fn broadcast_message(+ &self,+ message_type: String,+ message: serde_json::Value,+ ) -> anyhow::Result<()> {+ let body = SendMessageBody {+ message_type,+ message,+ };+ let request = self+ .client+ .post(format!("{}/message/broadcast", self.connection_gateway_url));+ self.with_trace_headers(request)+ .json(&body)+ .send()+ .await?+ .error_for_status()?;++ Ok(())+ }+/// Get users who are interacting with a given entity.pub async fn track_entity_users(&self, entity: Entity<'_>) -> anyhow::Result<Vec<String>> {let request = self.client.get(format!(diff --git a/crates/macro_db_client/migrations/20261102180024_system_status.sql b/crates/macro_db_client/migrations/20261102180024_system_status.sqlnew file mode 100644index 0000000000..44c6530b3a--- /dev/null+++ b/crates/macro_db_client/migrations/20261102180024_system_status.sql@@ -0,0 +1,17 @@+-- Every status Macro staff have set for the platform, newest last. The newest+-- row is the current status every user sees; the rest are its history.+CREATE TABLE system_status (+ id UUID PRIMARY KEY,+ status TEXT NOT NULL+ CHECK (status IN ('operational', 'degraded', 'major_outage')),+ -- Operational carries no message; the other statuses always explain+ -- themselves.+ message TEXT+ CHECK ((status = 'operational') = (message IS NULL)),+ -- The staff member who set it. Not a foreign key: the history outlives+ -- the accounts that wrote it.+ user_id TEXT NOT NULL,+ created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()+);++CREATE INDEX system_status_created_at_idx ON system_status (created_at DESC);diff --git a/crates/system_status/AGENTS.md b/crates/system_status/AGENTS.mdnew file mode 100644index 0000000000..080bd3d0b8--- /dev/null+++ b/crates/system_status/AGENTS.md@@ -0,0 +1,49 @@+# system_status++## What it is++Platform status banner: Macro staff set the status (operational, degraded,+major outage with a message) and every user sees a banner while it is not+operational. Each update is kept as history; the newest is current.++## How it works++`POST /system-status` (staff) inserts a row in `system_status`, then+broadcasts the new `CurrentSystemStatus` to every open app as a+`system_status` websocket message through the connection gateway's+`/message/broadcast`. Apps load `GET /system-status` (public) on start and+keep whichever of the fetched or pushed status is newer (`updatedAt`).++## Start here++- `src/domain/models.rs`: `SystemStatus` (message only on non-operational+ variants, enforced again by the table's CHECK) and the wire shapes.+- `src/domain/service.rs`: staff check, store, then best-effort broadcast.+- `src/inbound/axum_router/set_status.rs`: the documented endpoint staff call.++## Scope++- Owns: status storage, history, the staff check, and the broadcast payload.+- Not here: delivery to sockets → `services/connection_gateway`; the banner+ and dashboard → `apps/web/src/features/system-status/`.++## Boundaries++- Depends on: `macro_authorization` (axum), `connection_gateway_client`.+- Used by: `services/authentication_service`, which mounts the router at+ `/system-status` and lists it in `src/api/swagger.rs`.++## Checks++- `cargo test -p system_status --all-features` (`SQLX_OFFLINE` unset).+- `nix develop --command just prepare_db` from the repo root after query changes.++## Gotchas++- A failed broadcast does not fail the request: the row is already current,+ and a retry would record a duplicate. Apps refetch on focus.++## Related++- Rules: `.agents/rules/rust/architecture.md` · Skill:+ `cloud-storage-hexagonal-architecture`diff --git a/crates/system_status/CLAUDE.md b/crates/system_status/CLAUDE.mdnew file mode 120000index 0000000000..47dc3e3d86--- /dev/null+++ b/crates/system_status/CLAUDE.md@@ -0,0 +1 @@+AGENTS.md\ No newline at end of filediff --git a/crates/system_status/Cargo.toml b/crates/system_status/Cargo.tomlnew file mode 100644index 0000000000..1ee1b1c1f6--- /dev/null+++ b/crates/system_status/Cargo.toml@@ -0,0 +1,45 @@+[package]+edition = "2024"+name = "system_status"+publish = false+version = "0.1.0"++[features]+default = []+inbound = [+ "dep:axum",+ "dep:macro_authorization",+ "dep:model-error-response",+ "dep:utoipa",+ "ports",+]+outbound = ["ports"]+ports = []+postgres = ["dep:sqlx", "outbound"]+connection_gateway = ["dep:connection_gateway_client", "dep:serde_json", "outbound"]++[dependencies]+axum = { workspace = true, optional = true }+chrono = { workspace = true, features = ["serde"] }+connection_gateway_client = { path = "../connection_gateway_client", optional = true }+macro_authorization = { path = "../macro_authorization", optional = true, default-features = false, features = ["axum"] }+macro_user_id = { path = "../macro_user_id" }+macro_uuid = { path = "../macro_uuid" }+model-error-response = { path = "../model-error-response", optional = true }+rootcause = { workspace = true }+serde = { workspace = true }+serde_json = { workspace = true, optional = true }+sqlx = { workspace = true, optional = true }+thiserror = { workspace = true }+tracing = { workspace = true }+utoipa = { workspace = true, optional = true }+uuid = { workspace = true, features = ["serde", "v7"] }+workspace-hack = { version = "0.1", path = "../workspace-hack" }++[dev-dependencies]+macro_db_migrator = { path = "../macro_db_migrator" }+serde_json = { workspace = true }+tokio = { workspace = true, features = ["macros", "rt-multi-thread"] }+http-body-util = { workspace = true }+model_user = { path = "../model_user" }+tower = { workspace = true }diff --git a/crates/system_status/justfile b/crates/system_status/justfilenew file mode 100644index 0000000000..21b4243533--- /dev/null+++ b/crates/system_status/justfile@@ -0,0 +1,9 @@+import '../../tooling/just/database.just'++mod sqlx '../../tooling/just/sqlx.just'++prepare_db:+ just sqlx::prepare_db {{ DATABASE_URL }}++check:+ cargo check --all-featuresdiff --git a/crates/system_status/src/domain.rs b/crates/system_status/src/domain.rsnew file mode 100644index 0000000000..1e09448ed0--- /dev/null+++ b/crates/system_status/src/domain.rs@@ -0,0 +1,12 @@+//! Domain layer: models, ports (trait interfaces), and service implementation.++pub mod models;++#[cfg(feature = "ports")]+pub mod ports;++#[cfg(feature = "ports")]+pub mod service;++#[cfg(all(test, feature = "ports"))]+pub(crate) mod fakes;diff --git a/crates/system_status/src/domain/fakes.rs b/crates/system_status/src/domain/fakes.rsnew file mode 100644index 0000000000..9e5ec410e3--- /dev/null+++ b/crates/system_status/src/domain/fakes.rs@@ -0,0 +1,60 @@+//! In-memory port implementations for tests.++use std::sync::Mutex;++use crate::domain::{+ models::{CurrentSystemStatus, StatusUpdate},+ ports::{StatusBroadcaster, SystemStatusRepo},+};++#[derive(Debug, thiserror::Error)]+#[error("fake failure")]+pub(crate) struct FakeError;++#[derive(Default)]+pub(crate) struct FakeRepo {+ pub(crate) updates: Mutex<Vec<StatusUpdate>>,+}++impl SystemStatusRepo for FakeRepo {+ type Err = FakeError;++ async fn insert_update(&self, update: &StatusUpdate) -> Result<(), FakeError> {+ self.updates.lock().unwrap().push(update.clone());+ Ok(())+ }++ async fn latest_update(&self) -> Result<Option<StatusUpdate>, FakeError> {+ Ok(self.updates.lock().unwrap().last().cloned())+ }++ async fn list_updates(&self, limit: u16) -> Result<Vec<StatusUpdate>, FakeError> {+ Ok(self+ .updates+ .lock()+ .unwrap()+ .iter()+ .rev()+ .take(usize::from(limit))+ .cloned()+ .collect())+ }+}++#[derive(Default)]+pub(crate) struct FakeBroadcaster {+ pub(crate) fail: bool,+ pub(crate) sent: Mutex<Vec<CurrentSystemStatus>>,+}++impl StatusBroadcaster for FakeBroadcaster {+ type Err = FakeError;++ async fn broadcast(&self, status: &CurrentSystemStatus) -> Result<(), FakeError> {+ if self.fail {+ return Err(FakeError);+ }+ self.sent.lock().unwrap().push(status.clone());+ Ok(())+ }+}diff --git a/crates/system_status/src/domain/models.rs b/crates/system_status/src/domain/models.rsnew file mode 100644index 0000000000..4151bdb143--- /dev/null+++ b/crates/system_status/src/domain/models.rs@@ -0,0 +1,147 @@+//! Domain models for the platform status.++use chrono::{DateTime, Utc};+use macro_user_id::user_id::MacroUserIdStr;+use serde::{Deserialize, Serialize};+use uuid::Uuid;++/// Longest accepted status message, in characters.+pub const MAX_MESSAGE_LENGTH: usize = 500;++/// Errors returned by the system status service.+#[derive(Debug, thiserror::Error)]+pub enum SystemStatusError {+ /// The caller is not Macro staff.+ #[error("only Macro staff can manage the system status")]+ Forbidden,+ /// An internal error occurred.+ #[error("internal error")]+ Internal(rootcause::Report),+}++impl From<rootcause::Report> for SystemStatusError {+ fn from(report: rootcause::Report) -> Self {+ Self::Internal(report)+ }+}++/// Why a status message was rejected.+#[derive(Debug, PartialEq, Eq, thiserror::Error)]+pub enum InvalidStatusMessage {+ /// The message is empty once trimmed.+ #[error("message must not be empty")]+ Empty,+ /// The message is longer than [`MAX_MESSAGE_LENGTH`].+ #[error("message must be at most {MAX_MESSAGE_LENGTH} characters")]+ TooLong,+}++/// The text shown in the banner: trimmed, non-empty, and at most+/// [`MAX_MESSAGE_LENGTH`] characters.+#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]+#[serde(try_from = "String", into = "String")]+pub struct StatusMessage(String);++impl StatusMessage {+ /// The message as a string slice.+ pub fn as_str(&self) -> &str {+ &self.0+ }+}++impl TryFrom<String> for StatusMessage {+ type Error = InvalidStatusMessage;++ fn try_from(value: String) -> Result<Self, Self::Error> {+ let trimmed = value.trim();+ if trimmed.is_empty() {+ return Err(InvalidStatusMessage::Empty);+ }+ if trimmed.chars().count() > MAX_MESSAGE_LENGTH {+ return Err(InvalidStatusMessage::TooLong);+ }+ Ok(Self(trimmed.to_owned()))+ }+}++impl From<StatusMessage> for String {+ fn from(value: StatusMessage) -> Self {+ value.0+ }+}++/// The platform status. Only the non-operational statuses carry a message.+#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]+#[cfg_attr(feature = "inbound", derive(utoipa::ToSchema))]+#[serde(tag = "status", rename_all = "snake_case")]+pub enum SystemStatus {+ /// Everything works; no banner is shown.+ Operational,+ /// Some features are slow or failing.+ Degraded {+ /// What users should know.+ #[cfg_attr(feature = "inbound", schema(value_type = String))]+ message: StatusMessage,+ },+ /// Macro is largely unavailable.+ MajorOutage {+ /// What users should know.+ #[cfg_attr(feature = "inbound", schema(value_type = String))]+ message: StatusMessage,+ },+}++impl SystemStatus {+ /// The banner message, absent when operational.+ pub fn message(&self) -> Option<&StatusMessage> {+ match self {+ Self::Operational => None,+ Self::Degraded { message } | Self::MajorOutage { message } => Some(message),+ }+ }+}++/// One status a staff member set. The newest is the current status.+#[derive(Clone, Debug, PartialEq, Eq, Serialize)]+#[cfg_attr(feature = "inbound", derive(utoipa::ToSchema))]+#[serde(rename_all = "camelCase")]+pub struct StatusUpdate {+ /// UUIDv7, so ids sort by creation.+ pub id: Uuid,+ /// The status that was set.+ #[serde(flatten)]+ pub status: SystemStatus,+ /// The staff member who set it.+ #[cfg_attr(feature = "inbound", schema(value_type = String))]+ pub user_id: MacroUserIdStr<'static>,+ /// When it was set.+ pub created_at: DateTime<Utc>,+}++/// The status every user sees, without who set it.+#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]+#[cfg_attr(feature = "inbound", derive(utoipa::ToSchema))]+#[serde(rename_all = "camelCase")]+pub struct CurrentSystemStatus {+ /// The status and its message.+ #[serde(flatten)]+ pub status: SystemStatus,+ /// When it was set; absent when no status was ever set. Clients keep the+ /// newest status they have seen, whether fetched or pushed.+ pub updated_at: Option<DateTime<Utc>>,+}++impl From<Option<StatusUpdate>> for CurrentSystemStatus {+ fn from(update: Option<StatusUpdate>) -> Self {+ match update {+ Some(update) => Self {+ status: update.status,+ updated_at: Some(update.created_at),+ },+ None => Self {+ status: SystemStatus::Operational,+ updated_at: None,+ },+ }+ }+}diff --git a/crates/system_status/src/domain/ports.rs b/crates/system_status/src/domain/ports.rsnew file mode 100644index 0000000000..9aed717905--- /dev/null+++ b/crates/system_status/src/domain/ports.rs@@ -0,0 +1,63 @@+//! Port definitions for the system status domain.++use std::future::Future;++use macro_user_id::user_id::MacroUserIdStr;++use crate::domain::models::{CurrentSystemStatus, StatusUpdate, SystemStatus, SystemStatusError};++/// Storage for status updates.+pub trait SystemStatusRepo: Send + Sync + 'static {+ /// The error type returned by repository operations.+ type Err: std::error::Error + Send + Sync + 'static;++ /// Stores a new update, which becomes the current status.+ fn insert_update(+ &self,+ update: &StatusUpdate,+ ) -> impl Future<Output = Result<(), Self::Err>> + Send;++ /// The newest update, if any was ever stored.+ fn latest_update(&self)+ -> impl Future<Output = Result<Option<StatusUpdate>, Self::Err>> + Send;++ /// Up to `limit` updates, newest first.+ fn list_updates(+ &self,+ limit: u16,+ ) -> impl Future<Output = Result<Vec<StatusUpdate>, Self::Err>> + Send;+}++/// Pushes the current status to every open app.+pub trait StatusBroadcaster: Send + Sync + 'static {+ /// The error type returned when the broadcast could not be sent.+ type Err: std::error::Error + Send + Sync + 'static;++ /// Sends `status` to every connected client.+ fn broadcast(+ &self,+ status: &CurrentSystemStatus,+ ) -> impl Future<Output = Result<(), Self::Err>> + Send;+}++/// The system status service.+pub trait SystemStatusService: Send + Sync + 'static {+ /// The status every user sees.+ fn current_status(+ &self,+ ) -> impl Future<Output = Result<CurrentSystemStatus, SystemStatusError>> + Send;++ /// Recent updates, newest first. Macro staff only.+ fn history(+ &self,+ caller: &MacroUserIdStr<'_>,+ ) -> impl Future<Output = Result<Vec<StatusUpdate>, SystemStatusError>> + Send;++ /// Sets the current status and pushes it to every open app. Macro staff+ /// only.+ fn set_status(+ &self,+ caller: &MacroUserIdStr<'_>,+ status: SystemStatus,+ ) -> impl Future<Output = Result<StatusUpdate, SystemStatusError>> + Send;+}diff --git a/crates/system_status/src/domain/service.rs b/crates/system_status/src/domain/service.rsnew file mode 100644index 0000000000..6834ea50f2--- /dev/null+++ b/crates/system_status/src/domain/service.rs@@ -0,0 +1,106 @@+//! System status service implementation.++#[cfg(test)]+mod test;++use chrono::Utc;+use macro_user_id::{cowlike::CowLike, user_id::MacroUserIdStr};++use crate::domain::{+ models::{CurrentSystemStatus, StatusUpdate, SystemStatus, SystemStatusError},+ ports::{StatusBroadcaster, SystemStatusRepo, SystemStatusService},+};++/// Most updates the history lists.+const HISTORY_LIMIT: u16 = 100;++/// The concrete system status service.+pub struct SystemStatusServiceImpl<R, B> {+ repo: R,+ broadcaster: B,+}++impl<R, B> SystemStatusServiceImpl<R, B> {+ /// Create a service over the given storage and broadcaster.+ pub fn new(repo: R, broadcaster: B) -> Self {+ Self { repo, broadcaster }+ }+}++impl<R: SystemStatusRepo, B: StatusBroadcaster> SystemStatusService+ for SystemStatusServiceImpl<R, B>+{+ #[tracing::instrument(skip_all, err)]+ async fn current_status(&self) -> Result<CurrentSystemStatus, SystemStatusError> {+ let latest = self+ .repo+ .latest_update()+ .await+ .map_err(|e| rootcause::Report::new(e).into_dynamic())?;+ Ok(latest.into())+ }++ #[tracing::instrument(skip_all, err)]+ async fn history(+ &self,+ caller: &MacroUserIdStr<'_>,+ ) -> Result<Vec<StatusUpdate>, SystemStatusError> {+ require_staff(caller)?;+ Ok(self+ .repo+ .list_updates(HISTORY_LIMIT)+ .await+ .map_err(|e| rootcause::Report::new(e).into_dynamic())?)+ }++ #[tracing::instrument(+ name = "system_status.set",+ skip_all,+ fields(+ status_update.id = tracing::field::Empty,+ broadcast.ok = tracing::field::Empty,+ ),+ err+ )]+ async fn set_status(+ &self,+ caller: &MacroUserIdStr<'_>,+ status: SystemStatus,+ ) -> Result<StatusUpdate, SystemStatusError> {+ require_staff(caller)?;++ let update = StatusUpdate {+ id: macro_uuid::generate_uuid_v7(),+ status,+ user_id: caller.clone().into_owned(),+ created_at: Utc::now(),+ };+ tracing::Span::current().record("status_update.id", tracing::field::display(update.id));+ self.repo+ .insert_update(&update)+ .await+ .map_err(|e| rootcause::Report::new(e).into_dynamic())?;++ // The update is stored, so it is the current status whether or not the+ // push lands: apps that miss it pick it up on their next fetch. Failing+ // here would only invite a retry that records the same status twice.+ let broadcast = self+ .broadcaster+ .broadcast(&Some(update.clone()).into())+ .await;+ tracing::Span::current().record("broadcast.ok", broadcast.is_ok());+ if let Err(error) = broadcast {+ tracing::warn!(error = ?error, "failed to broadcast system status");+ }++ Ok(update)+ }+}++fn require_staff(user: &MacroUserIdStr<'_>) -> Result<(), SystemStatusError> {+ if user.is_macro_staff() {+ Ok(())+ } else {+ Err(SystemStatusError::Forbidden)+ }+}diff --git a/crates/system_status/src/domain/service/test.rs b/crates/system_status/src/domain/service/test.rsnew file mode 100644index 0000000000..93ae5b1e3a--- /dev/null+++ b/crates/system_status/src/domain/service/test.rs@@ -0,0 +1,159 @@+use macro_user_id::user_id::MacroUserIdStr;++use super::SystemStatusServiceImpl;+use crate::domain::{+ fakes::{FakeBroadcaster, FakeRepo},+ models::{CurrentSystemStatus, StatusMessage, SystemStatus, SystemStatusError},+ ports::SystemStatusService,+};++fn staff() -> MacroUserIdStr<'static> {+ MacroUserIdStr::parse_from_str("macro|[email protected]").unwrap()+}++fn degraded(message: &str) -> SystemStatus {+ SystemStatus::Degraded {+ message: StatusMessage::try_from(message.to_owned()).unwrap(),+ }+}++#[tokio::test]+async fn current_status_is_operational_before_any_update() {+ let service = SystemStatusServiceImpl::new(FakeRepo::default(), FakeBroadcaster::default());++ let current = service.current_status().await.unwrap();++ assert_eq!(+ current,+ CurrentSystemStatus {+ status: SystemStatus::Operational,+ updated_at: None,+ }+ );+}++#[tokio::test]+async fn set_status_stores_it_as_current_and_broadcasts_it() {+ let service = SystemStatusServiceImpl::new(FakeRepo::default(), FakeBroadcaster::default());++ let update = service+ .set_status(&staff(), degraded("Search is slow"))+ .await+ .unwrap();++ let expected = CurrentSystemStatus {+ status: degraded("Search is slow"),+ updated_at: Some(update.created_at),+ };+ assert_eq!(service.current_status().await.unwrap(), expected);+ assert_eq!(*service.broadcaster.sent.lock().unwrap(), vec![expected]);+}++#[tokio::test]+async fn newest_update_wins_and_history_keeps_every_update() {+ let service = SystemStatusServiceImpl::new(FakeRepo::default(), FakeBroadcaster::default());++ service+ .set_status(&staff(), degraded("Search is slow"))+ .await+ .unwrap();+ service+ .set_status(&staff(), SystemStatus::Operational)+ .await+ .unwrap();++ assert_eq!(+ service.current_status().await.unwrap().status,+ SystemStatus::Operational+ );+ let history: Vec<SystemStatus> = service+ .history(&staff())+ .await+ .unwrap()+ .into_iter()+ .map(|update| update.status)+ .collect();+ assert_eq!(+ history,+ vec![SystemStatus::Operational, degraded("Search is slow")]+ );+}++#[tokio::test]+async fn set_status_succeeds_when_the_broadcast_fails() {+ let service = SystemStatusServiceImpl::new(+ FakeRepo::default(),+ FakeBroadcaster {+ fail: true,+ ..FakeBroadcaster::default()+ },+ );++ service+ .set_status(&staff(), degraded("Search is slow"))+ .await+ .unwrap();++ assert_eq!(+ service.current_status().await.unwrap().status,+ degraded("Search is slow")+ );+}++#[tokio::test]+async fn non_staff_cannot_set_status_or_read_history() {+ let service = SystemStatusServiceImpl::new(FakeRepo::default(), FakeBroadcaster::default());+ let outsider = MacroUserIdStr::parse_from_str("macro|[email protected]").unwrap();++ let set = service+ .set_status(&outsider, degraded("Search is slow"))+ .await;+ let history = service.history(&outsider).await;++ assert!(matches!(set, Err(SystemStatusError::Forbidden)));+ assert!(matches!(history, Err(SystemStatusError::Forbidden)));+ assert!(service.repo.updates.lock().unwrap().is_empty());+ assert!(service.broadcaster.sent.lock().unwrap().is_empty());+}++#[test]+fn messages_are_trimmed_and_bounded() {+ assert_eq!(+ StatusMessage::try_from(" Search is slow \n".to_owned())+ .unwrap()+ .as_str(),+ "Search is slow"+ );+ assert!(StatusMessage::try_from(" ".to_owned()).is_err());+ assert!(StatusMessage::try_from("a".repeat(501)).is_err());+ assert!(StatusMessage::try_from("a".repeat(500)).is_ok());+}++#[test]+fn wire_shape_is_flat_and_omits_message_when_operational() {+ let degraded = serde_json::to_value(CurrentSystemStatus {+ status: degraded("Search is slow"),+ updated_at: None,+ })+ .unwrap();+ let operational = serde_json::to_value(CurrentSystemStatus {+ status: SystemStatus::Operational,+ updated_at: None,+ })+ .unwrap();++ assert_eq!(+ degraded,+ serde_json::json!({ "status": "degraded", "message": "Search is slow", "updatedAt": null })+ );+ assert_eq!(+ operational,+ serde_json::json!({ "status": "operational", "updatedAt": null })+ );+ assert!(+ serde_json::from_value::<SystemStatus>(+ serde_json::json!({ "status": "major_outage", "message": " " })+ )+ .is_err()+ );+}diff --git a/crates/system_status/src/inbound.rs b/crates/system_status/src/inbound.rsnew file mode 100644index 0000000000..813ee24cba--- /dev/null+++ b/crates/system_status/src/inbound.rs@@ -0,0 +1,3 @@+//! Inbound adapters for the system status crate.++pub mod axum_router;diff --git a/crates/system_status/src/inbound/axum_router.rs b/crates/system_status/src/inbound/axum_router.rsnew file mode 100644index 0000000000..1bd2a2bdd7--- /dev/null+++ b/crates/system_status/src/inbound/axum_router.rs@@ -0,0 +1,96 @@+//! Axum router for the system status endpoints.+//!+//! Nested under `/system-status` by the authentication service:+//! - `GET /` — anyone: the current status+//! - `POST /` — Macro staff: set the status+//! - `GET /history` — Macro staff: recent updates, newest first++/// The current status.+pub mod get_current;+/// Recent updates.+pub mod list_history;+/// Set the status.+pub mod set_status;+#[cfg(test)]+mod test;++use std::sync::Arc;++use axum::{+ Json, Router, extract::FromRef, http::StatusCode, response::IntoResponse, routing::get,+};+use macro_authorization::{MacroAuthorizationService, MacroAuthorizationState};+use model_error_response::ErrorResponse;+use serde::Serialize;+use utoipa::ToSchema;++use crate::domain::{+ models::{StatusUpdate, SystemStatusError},+ ports::SystemStatusService,+};++impl IntoResponse for SystemStatusError {+ fn into_response(self) -> axum::response::Response {+ let status_code = match &self {+ SystemStatusError::Forbidden => StatusCode::FORBIDDEN,+ SystemStatusError::Internal(_) => StatusCode::INTERNAL_SERVER_ERROR,+ };+ if status_code.is_server_error() {+ tracing::error!(error = ?self, "internal server error");+ }++ (+ status_code,+ Json(ErrorResponse {+ message: self.to_string().into(),+ }),+ )+ .into_response()+ }+}++/// Recent status updates, newest first.+#[derive(Debug, Serialize, ToSchema)]+pub struct SystemStatusHistory {+ /// The updates.+ pub updates: Vec<StatusUpdate>,+}++/// Router state containing the system status service.+pub struct SystemStatusRouterState<T, Auth> {+ /// The system status service implementation.+ pub service: Arc<T>,+ /// State for request authorization.+ pub authorization_state: MacroAuthorizationState<Auth>,+}++impl<T, Auth> Clone for SystemStatusRouterState<T, Auth> {+ fn clone(&self) -> Self {+ Self {+ service: self.service.clone(),+ authorization_state: self.authorization_state.clone(),+ }+ }+}++impl<T, Auth> FromRef<SystemStatusRouterState<T, Auth>> for MacroAuthorizationState<Auth> {+ fn from_ref(state: &SystemStatusRouterState<T, Auth>) -> Self {+ state.authorization_state.clone()+ }+}++/// Build the system status router.+pub fn system_status_router<T, Auth, S>(state: SystemStatusRouterState<T, Auth>) -> Router<S>+where+ T: SystemStatusService,+ Auth: MacroAuthorizationService,+ S: Send + Sync + 'static,+{+ Router::new()+ .route(+ "/",+ get(get_current::handler::<T, Auth>).post(set_status::handler::<T, Auth>),+ )+ .route("/history", get(list_history::handler::<T, Auth>))+ .with_state(state)+}diff --git a/crates/system_status/src/inbound/axum_router/get_current.rs b/crates/system_status/src/inbound/axum_router/get_current.rsnew file mode 100644index 0000000000..7906aa0e18--- /dev/null+++ b/crates/system_status/src/inbound/axum_router/get_current.rs@@ -0,0 +1,27 @@+//! Handler for `GET /system-status`.++use axum::{Json, extract::State};+use macro_authorization::MacroAuthorizationService;++use super::SystemStatusRouterState;+use crate::domain::models::{CurrentSystemStatus, SystemStatusError};+use crate::domain::ports::SystemStatusService;++/// The status every user sees. Public: the banner shows wherever the app+/// runs, signed in or not.+#[utoipa::path(+ tag = "system_status",+ get,+ path = "/system-status",+ operation_id = "get_system_status",+ responses(+ (status = 200, body = CurrentSystemStatus),+ (status = 500, body = model_error_response::ErrorResponse),+ )+)]+#[tracing::instrument(skip_all, err)]+pub async fn handler<T: SystemStatusService, Auth: MacroAuthorizationService>(+ State(state): State<SystemStatusRouterState<T, Auth>>,+) -> Result<Json<CurrentSystemStatus>, SystemStatusError> {+ Ok(Json(state.service.current_status().await?))+}diff --git a/crates/system_status/src/inbound/axum_router/list_history.rs b/crates/system_status/src/inbound/axum_router/list_history.rsnew file mode 100644index 0000000000..96622791ad--- /dev/null+++ b/crates/system_status/src/inbound/axum_router/list_history.rs@@ -0,0 +1,31 @@+//! Handler for `GET /system-status/history`.++use axum::{Json, extract::State};+use macro_authorization::{MacroAuthorizationExtractor, MacroAuthorizationService, UserOrInternal};++use super::{SystemStatusHistory, SystemStatusRouterState};+use crate::domain::models::SystemStatusError;+use crate::domain::ports::SystemStatusService;++/// Recent status updates, newest first, with who set each. Macro staff only.+#[utoipa::path(+ tag = "system_status",+ get,+ path = "/system-status/history",+ operation_id = "list_system_status_history",+ responses(+ (status = 200, body = SystemStatusHistory),+ (status = 401, body = model_error_response::ErrorResponse),+ (status = 403, body = model_error_response::ErrorResponse),+ (status = 500, body = model_error_response::ErrorResponse),+ )+)]+#[tracing::instrument(skip_all, err)]+pub async fn handler<T: SystemStatusService, Auth: MacroAuthorizationService>(+ State(state): State<SystemStatusRouterState<T, Auth>>,+ authorization: MacroAuthorizationExtractor<Auth, UserOrInternal>,+) -> Result<Json<SystemStatusHistory>, SystemStatusError> {+ let caller = &authorization.authorization.user.macro_user_id;+ let updates = state.service.history(caller).await?;+ Ok(Json(SystemStatusHistory { updates }))+}diff --git a/crates/system_status/src/inbound/axum_router/set_status.rs b/crates/system_status/src/inbound/axum_router/set_status.rsnew file mode 100644index 0000000000..8989a772ed--- /dev/null+++ b/crates/system_status/src/inbound/axum_router/set_status.rs@@ -0,0 +1,45 @@+//! Handler for `POST /system-status`.++use axum::{Json, extract::State};+use macro_authorization::{MacroAuthorizationExtractor, MacroAuthorizationService, UserOrInternal};++use super::SystemStatusRouterState;+use crate::domain::models::{StatusUpdate, SystemStatus, SystemStatusError};+use crate::domain::ports::SystemStatusService;++/// Sets the status every user sees and pushes it to every open app. Macro+/// staff only.+///+/// Authenticate with a Macro session, or from a script with a personal API+/// key (Settings → API keys) in the `x-macro-user-api-key` header. The body+/// is the new status:+///+/// - `{"status": "operational"}` clears the banner. It takes no message.+/// - `{"status": "degraded", "message": "Search is slow to update."}`+/// - `{"status": "major_outage", "message": "Macro is unavailable. We're on it."}`+///+/// Messages are trimmed and must be 1–500 characters. Every call is kept in+/// the history, even when it repeats the current status.+#[utoipa::path(+ tag = "system_status",+ post,+ path = "/system-status",+ operation_id = "set_system_status",+ request_body = SystemStatus,+ responses(+ (status = 200, body = StatusUpdate),+ (status = 401, body = model_error_response::ErrorResponse),+ (status = 403, body = model_error_response::ErrorResponse),+ (status = 422, description = "The body is not a valid status"),+ (status = 500, body = model_error_response::ErrorResponse),+ )+)]+#[tracing::instrument(skip_all, err)]+pub async fn handler<T: SystemStatusService, Auth: MacroAuthorizationService>(+ State(state): State<SystemStatusRouterState<T, Auth>>,+ authorization: MacroAuthorizationExtractor<Auth, UserOrInternal>,+ Json(status): Json<SystemStatus>,+) -> Result<Json<StatusUpdate>, SystemStatusError> {+ let caller = &authorization.authorization.user.macro_user_id;+ Ok(Json(state.service.set_status(caller, status).await?))+}diff --git a/crates/system_status/src/inbound/axum_router/test.rs b/crates/system_status/src/inbound/axum_router/test.rsnew file mode 100644index 0000000000..15f336f291--- /dev/null+++ b/crates/system_status/src/inbound/axum_router/test.rs@@ -0,0 +1,167 @@+use std::sync::Arc;++use axum::{+ body::Body,+ http::{Request, StatusCode, header},+};+use http_body_util::BodyExt;+use macro_authorization::{+ InternalIdentityClaims, MacroAuthorizationError, MacroAuthorizationService,+ MacroAuthorizationState,+};+use model_user::UserContext;+use rootcause::Report;+use serde_json::{Value, json};+use tower::ServiceExt;++use crate::domain::{+ fakes::{FakeBroadcaster, FakeRepo},+ service::SystemStatusServiceImpl,+};+use crate::inbound::axum_router::{SystemStatusRouterState, system_status_router};++const STAFF_JWT: &str = "staff";+const OUTSIDER_JWT: &str = "outsider";+const STAFF_USER_ID: &str = "macro|[email protected]";+const OUTSIDER_USER_ID: &str = "macro|[email protected]";++#[derive(Clone)]+struct FakeAuthorizationService;++impl MacroAuthorizationService for FakeAuthorizationService {+ async fn authorize(&self, jwt: &str) -> Result<UserContext, Report<MacroAuthorizationError>> {+ let user_id = match jwt {+ STAFF_JWT => STAFF_USER_ID,+ OUTSIDER_JWT => OUTSIDER_USER_ID,+ _ => return Err(Report::new(MacroAuthorizationError::InvalidCredentials)),+ };+ Ok(UserContext {+ user_id: user_id.to_string(),+ fusion_user_id: "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb".to_string(),+ permissions: None,+ organization_id: None,+ })+ }++ async fn authorize_identity(+ &self,+ jwt: &str,+ ) -> Result<macro_authorization::ValidatedCredential, Report<MacroAuthorizationError>> {+ self.authorize(jwt)+ .await+ .map(macro_authorization::ValidatedCredential::session)+ }++ async fn authorize_internal(+ &self,+ _provided_key: &str,+ _claims: InternalIdentityClaims,+ ) -> Result<Option<UserContext>, Report<MacroAuthorizationError>> {+ Err(Report::new(MacroAuthorizationError::InvalidCredentials))+ }+}++fn router() -> axum::Router {+ system_status_router(SystemStatusRouterState {+ service: Arc::new(SystemStatusServiceImpl::new(+ FakeRepo::default(),+ FakeBroadcaster::default(),+ )),+ authorization_state: MacroAuthorizationState::new(Arc::new(FakeAuthorizationService)),+ })+}++fn post(jwt: Option<&str>, body: Value) -> Request<Body> {+ let mut request = Request::post("/").header(header::CONTENT_TYPE, "application/json");+ if let Some(jwt) = jwt {+ request = request.header(header::AUTHORIZATION, format!("Bearer {jwt}"));+ }+ request.body(Body::from(body.to_string())).unwrap()+}++fn get(uri: &str, jwt: Option<&str>) -> Request<Body> {+ let mut request = Request::get(uri);+ if let Some(jwt) = jwt {+ request = request.header(header::AUTHORIZATION, format!("Bearer {jwt}"));+ }+ request.body(Body::empty()).unwrap()+}++async fn read_json(response: axum::response::Response) -> Value {+ let body = response.into_body().collect().await.unwrap().to_bytes();+ serde_json::from_slice(&body).unwrap()+}++#[tokio::test]+async fn anyone_reads_the_status_staff_set() {+ let app = router();++ let set = app+ .clone()+ .oneshot(post(+ Some(STAFF_JWT),+ json!({ "status": "major_outage", "message": "Macro is down" }),+ ))+ .await+ .unwrap();+ assert_eq!(set.status(), StatusCode::OK);+ let update = read_json(set).await;+ assert_eq!(update["status"], "major_outage");+ assert_eq!(update["message"], "Macro is down");+ assert_eq!(update["userId"], STAFF_USER_ID);++ let current = app.oneshot(get("/", None)).await.unwrap();+ assert_eq!(current.status(), StatusCode::OK);+ let current = read_json(current).await;+ assert_eq!(+ current,+ json!({+ "status": "major_outage",+ "message": "Macro is down",+ "updatedAt": update["createdAt"],+ })+ );+}++#[tokio::test]+async fn only_staff_set_status_or_read_history() {+ let app = router();+ let body = json!({ "status": "degraded", "message": "Slow" });++ let anonymous = app.clone().oneshot(post(None, body.clone())).await.unwrap();+ let outsider = app+ .clone()+ .oneshot(post(Some(OUTSIDER_JWT), body))+ .await+ .unwrap();+ let outsider_history = app+ .clone()+ .oneshot(get("/history", Some(OUTSIDER_JWT)))+ .await+ .unwrap();+ let staff_history = app.oneshot(get("/history", Some(STAFF_JWT))).await.unwrap();++ assert_eq!(anonymous.status(), StatusCode::UNAUTHORIZED);+ assert_eq!(outsider.status(), StatusCode::FORBIDDEN);+ assert_eq!(outsider_history.status(), StatusCode::FORBIDDEN);+ assert_eq!(staff_history.status(), StatusCode::OK);+ assert_eq!(read_json(staff_history).await, json!({ "updates": [] }));+}++#[tokio::test]+async fn invalid_bodies_are_rejected() {+ let app = router();++ for body in [+ json!({ "status": "degraded" }),+ json!({ "status": "degraded", "message": " " }),+ json!({ "status": "unknown", "message": "?" }),+ ] {+ let response = app+ .clone()+ .oneshot(post(Some(STAFF_JWT), body))+ .await+ .unwrap();+ assert_eq!(response.status(), StatusCode::UNPROCESSABLE_ENTITY);+ }+}diff --git a/crates/system_status/src/lib.rs b/crates/system_status/src/lib.rsnew file mode 100644index 0000000000..154e257fc5--- /dev/null+++ b/crates/system_status/src/lib.rs@@ -0,0 +1,23 @@+//! Platform status: the banner every Macro user sees while the platform is+//! degraded or down.+//!+//! Macro staff set the status (operational, degraded, or major outage, with a+//! message for the latter two). Every update is kept as history; the newest is+//! the current status, and setting it is broadcast to every open app over the+//! connection gateway.+//!+//! # Architecture+//!+//! - **domain**: models, ports, and the service implementation+//! - **outbound**: PostgreSQL storage and the connection gateway broadcaster+//! - **inbound**: Axum handlers++#![deny(missing_docs)]++pub mod domain;++#[cfg(feature = "inbound")]+pub mod inbound;++#[cfg(feature = "outbound")]+pub mod outbound;diff --git a/crates/system_status/src/outbound.rs b/crates/system_status/src/outbound.rsnew file mode 100644index 0000000000..747abc9537--- /dev/null+++ b/crates/system_status/src/outbound.rs@@ -0,0 +1,7 @@+//! Outbound adapters for the system status crate.++#[cfg(feature = "connection_gateway")]+pub mod connection_gateway_broadcaster;++#[cfg(feature = "postgres")]+pub mod pg_system_status_repo;diff --git a/crates/system_status/src/outbound/connection_gateway_broadcaster.rs b/crates/system_status/src/outbound/connection_gateway_broadcaster.rsnew file mode 100644index 0000000000..3a8be9d20f--- /dev/null+++ b/crates/system_status/src/outbound/connection_gateway_broadcaster.rs@@ -0,0 +1,51 @@+//! Pushes the current status to every open app through the connection+//! gateway.++use std::sync::Arc;++use connection_gateway_client::ConnectionGatewayClient;++use crate::domain::{models::CurrentSystemStatus, ports::StatusBroadcaster};++/// The websocket message type clients listen for. Its data is a+/// [`CurrentSystemStatus`].+pub const SYSTEM_STATUS_MESSAGE_TYPE: &str = "system_status";++/// Broadcasts status changes over the connection gateway.+#[derive(Clone, Debug)]+pub struct ConnectionGatewayStatusBroadcaster {+ client: Arc<ConnectionGatewayClient>,+}++impl ConnectionGatewayStatusBroadcaster {+ /// Create a broadcaster over the given gateway client.+ pub fn new(client: Arc<ConnectionGatewayClient>) -> Self {+ Self { client }+ }+}++/// Errors produced while broadcasting a status.+#[derive(Debug, thiserror::Error)]+pub enum ConnectionGatewayStatusBroadcasterErr {+ /// The status could not be serialized.+ #[error(transparent)]+ Serialize(#[from] serde_json::Error),+ /// The gateway did not accept the broadcast.+ #[error("connection gateway broadcast failed: {0}")]+ Gateway(String),+}++impl StatusBroadcaster for ConnectionGatewayStatusBroadcaster {+ type Err = ConnectionGatewayStatusBroadcasterErr;++ #[tracing::instrument(err, skip_all)]+ async fn broadcast(&self, status: &CurrentSystemStatus) -> Result<(), Self::Err> {+ self.client+ .broadcast_message(+ SYSTEM_STATUS_MESSAGE_TYPE.to_owned(),+ serde_json::to_value(status)?,+ )+ .await+ .map_err(|error| ConnectionGatewayStatusBroadcasterErr::Gateway(format!("{error:#}")))+ }+}diff --git a/crates/system_status/src/outbound/pg_system_status_repo.rs b/crates/system_status/src/outbound/pg_system_status_repo.rsnew file mode 100644index 0000000000..1ffed31904--- /dev/null+++ b/crates/system_status/src/outbound/pg_system_status_repo.rs@@ -0,0 +1,135 @@+//! PostgreSQL implementation of the [`SystemStatusRepo`] port.++#[cfg(test)]+mod test;++use chrono::{DateTime, Utc};+use macro_user_id::user_id::MacroUserIdStr;+use sqlx::PgPool;+use uuid::Uuid;++use crate::domain::models::{StatusMessage, StatusUpdate, SystemStatus};+use crate::domain::ports::SystemStatusRepo;++const OPERATIONAL: &str = "operational";+const DEGRADED: &str = "degraded";+const MAJOR_OUTAGE: &str = "major_outage";++/// Postgres-backed system status repository.+#[derive(Debug, Clone)]+pub struct PgSystemStatusRepo {+ pool: PgPool,+}++impl PgSystemStatusRepo {+ /// Create a repository backed by the provided pool.+ pub fn new(pool: PgPool) -> Self {+ Self { pool }+ }+}++/// Errors produced by the Postgres system status repository.+#[derive(Debug, thiserror::Error)]+pub enum PgSystemStatusRepoErr {+ /// Underlying database error.+ #[error(transparent)]+ Db(#[from] sqlx::Error),+ /// A stored row does not form a valid status update.+ #[error("invalid system status row {0}")]+ InvalidRow(Uuid),+}++struct StatusUpdateRow {+ id: Uuid,+ status: String,+ message: Option<String>,+ user_id: String,+ created_at: DateTime<Utc>,+}++impl TryFrom<StatusUpdateRow> for StatusUpdate {+ type Error = PgSystemStatusRepoErr;++ fn try_from(row: StatusUpdateRow) -> Result<Self, Self::Error> {+ let invalid = || PgSystemStatusRepoErr::InvalidRow(row.id);+ let message = row.message.map(StatusMessage::try_from).transpose();+ let status = match (row.status.as_str(), message) {+ (OPERATIONAL, Ok(None)) => SystemStatus::Operational,+ (DEGRADED, Ok(Some(message))) => SystemStatus::Degraded { message },+ (MAJOR_OUTAGE, Ok(Some(message))) => SystemStatus::MajorOutage { message },+ _ => return Err(invalid()),+ };+ Ok(Self {+ id: row.id,+ status,+ user_id: MacroUserIdStr::try_from(row.user_id).map_err(|_| invalid())?,+ created_at: row.created_at,+ })+ }+}++fn status_column(status: &SystemStatus) -> &'static str {+ match status {+ SystemStatus::Operational => OPERATIONAL,+ SystemStatus::Degraded { .. } => DEGRADED,+ SystemStatus::MajorOutage { .. } => MAJOR_OUTAGE,+ }+}++impl SystemStatusRepo for PgSystemStatusRepo {+ type Err = PgSystemStatusRepoErr;++ #[tracing::instrument(err, skip_all, fields(status_update.id = %update.id))]+ async fn insert_update(&self, update: &StatusUpdate) -> Result<(), Self::Err> {+ sqlx::query!(+ r#"+ INSERT INTO system_status (id, status, message, user_id, created_at)+ VALUES ($1, $2, $3, $4, $5)+ "#,+ update.id,+ status_column(&update.status),+ update.status.message().map(StatusMessage::as_str),+ update.user_id.as_ref(),+ update.created_at,+ )+ .execute(&self.pool)+ .await?;+ Ok(())+ }++ #[tracing::instrument(err, skip_all)]+ async fn latest_update(&self) -> Result<Option<StatusUpdate>, Self::Err> {+ sqlx::query_as!(+ StatusUpdateRow,+ r#"+ SELECT id, status, message, user_id, created_at+ FROM system_status+ ORDER BY created_at DESC, id DESC+ LIMIT 1+ "#,+ )+ .fetch_optional(&self.pool)+ .await?+ .map(StatusUpdate::try_from)+ .transpose()+ }++ #[tracing::instrument(err, skip(self))]+ async fn list_updates(&self, limit: u16) -> Result<Vec<StatusUpdate>, Self::Err> {+ sqlx::query_as!(+ StatusUpdateRow,+ r#"+ SELECT id, status, message, user_id, created_at+ FROM system_status+ ORDER BY created_at DESC, id DESC+ LIMIT $1+ "#,+ i64::from(limit),+ )+ .fetch_all(&self.pool)+ .await?+ .into_iter()+ .map(StatusUpdate::try_from)+ .collect()+ }+}diff --git a/crates/system_status/src/outbound/pg_system_status_repo/test.rs b/crates/system_status/src/outbound/pg_system_status_repo/test.rsnew file mode 100644index 0000000000..f32d19fec1--- /dev/null+++ b/crates/system_status/src/outbound/pg_system_status_repo/test.rs@@ -0,0 +1,85 @@+use chrono::{Duration, Utc};+use macro_db_migrator::MACRO_DB_MIGRATIONS;+use macro_user_id::user_id::MacroUserIdStr;+use sqlx::PgPool;+use uuid::Uuid;++use super::PgSystemStatusRepo;+use crate::domain::models::{StatusMessage, StatusUpdate, SystemStatus};+use crate::domain::ports::SystemStatusRepo;++fn update(status: SystemStatus, minutes_ago: i64) -> StatusUpdate {+ StatusUpdate {+ id: Uuid::now_v7(),+ status,+ user_id: MacroUserIdStr::parse_from_str("macro|[email protected]").unwrap(),+ created_at: Utc::now() - Duration::minutes(minutes_ago),+ }+}++fn message(text: &str) -> StatusMessage {+ StatusMessage::try_from(text.to_owned()).unwrap()+}++#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]+async fn latest_is_none_without_updates(pool: PgPool) {+ let repo = PgSystemStatusRepo::new(pool);++ assert_eq!(repo.latest_update().await.unwrap(), None);+ assert!(repo.list_updates(10).await.unwrap().is_empty());+}++#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]+async fn updates_round_trip_newest_first(pool: PgPool) {+ let repo = PgSystemStatusRepo::new(pool);+ let outage = update(+ SystemStatus::MajorOutage {+ message: message("Macro is down"),+ },+ 30,+ );+ let degraded = update(+ SystemStatus::Degraded {+ message: message("Recovering"),+ },+ 20,+ );+ let operational = update(SystemStatus::Operational, 10);+ for update in [&outage, °raded, &operational] {+ repo.insert_update(update).await.unwrap();+ }++ let latest = repo.latest_update().await.unwrap().unwrap();+ let listed = repo.list_updates(2).await.unwrap();++ assert_eq!(latest.id, operational.id);+ assert_eq!(latest.status, SystemStatus::Operational);+ let listed: Vec<(Uuid, SystemStatus)> = listed+ .into_iter()+ .map(|update| (update.id, update.status))+ .collect();+ assert_eq!(+ listed,+ vec![+ (operational.id, SystemStatus::Operational),+ (degraded.id, degraded.status.clone()),+ ]+ );+}++#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]+async fn schema_rejects_operational_with_message_and_outage_without(pool: PgPool) {+ let insert = |status: &'static str, message: Option<&'static str>| {+ sqlx::query!(+ "INSERT INTO system_status (id, status, message, user_id) VALUES ($1, $2, $3, 'macro|[email protected]')",+ Uuid::now_v7(),+ status,+ message,+ )+ .execute(&pool)+ };++ assert!(insert("operational", Some("all good")).await.is_err());+ assert!(insert("major_outage", None).await.is_err());+ assert!(insert("unknown", Some("?")).await.is_err());+}diff --git a/docs/agent-guide/navigation.md b/docs/agent-guide/navigation.mdindex 4c6bb32543..4adac6d3d1 100644--- a/docs/agent-guide/navigation.md+++ b/docs/agent-guide/navigation.md@@ -181,6 +181,7 @@ successfully rather than hashing the empty JavaScript placeholder.| `/app/welcome` | Login page (when unauthenticated) || `/app/invite?token=<token>` | GTM invite welcome page ("Welcome, <first name>", Continue → signup). Links come from the staff portal, last 48h, and grant the first month of Premium free once the account is created || `/app/internal/invite-links` | Macro staff only (`@macro.com`): create GTM invite links and track opens, signups, and subscriptions |+| `/app/internal/status` | Macro staff only (`@macro.com`): set the system status (Operational, Degraded, Major outage + message), see its history and the `POST /auth/system-status` API. A non-operational status shows a banner across the top of the app for every user; open apps update over the connection gateway || `/app/home` | Desktop: Home (notifications + recent activity); mobile: Notifications soup || `/app/home/<block-type>/<uuid>` | Home with an item opened inline; `<block-type>` may be an alias such as `task`; a targeted channel message uses `sN.channels.messageId` (and optionally `sN.channels.threadId`) and a document comment `sN.drive.commentId`; a calendar row renders the Calendar view inline at `/app/home/calendar/<month-or-week-or-day>` with the event, occurrence, and locator range in `sN.calendar.*` || `/app/mail` | Email client |diff --git a/packages/sdk-docs/reference/generated/auth/types.gen/README.md b/packages/sdk-docs/reference/generated/auth/types.gen/README.mdindex 8a389de768..fb191f0860 100644--- a/packages/sdk-docs/reference/generated/auth/types.gen/README.md+++ b/packages/sdk-docs/reference/generated/auth/types.gen/README.md@@ -97,6 +97,7 @@- [CreateTeamResponses](type-aliases/CreateTeamResponses.md)- [CreditCheckoutRequestBody](type-aliases/CreditCheckoutRequestBody.md)- [CreditCheckoutResponse](type-aliases/CreditCheckoutResponse.md)+- [CurrentSystemStatus](type-aliases/CurrentSystemStatus.md)- [CursorApiKeyStatus](type-aliases/CursorApiKeyStatus.md)- [CursorModelOption](type-aliases/CursorModelOption.md)- [CursorModelsResponse](type-aliases/CursorModelsResponse.md)@@ -214,6 +215,11 @@- [GetSubscriptionStatusErrors](type-aliases/GetSubscriptionStatusErrors.md)- [GetSubscriptionStatusResponse](type-aliases/GetSubscriptionStatusResponse.md)- [GetSubscriptionStatusResponses](type-aliases/GetSubscriptionStatusResponses.md)+- [GetSystemStatusData](type-aliases/GetSystemStatusData.md)+- [GetSystemStatusError](type-aliases/GetSystemStatusError.md)+- [GetSystemStatusErrors](type-aliases/GetSystemStatusErrors.md)+- [GetSystemStatusResponse](type-aliases/GetSystemStatusResponse.md)+- [GetSystemStatusResponses](type-aliases/GetSystemStatusResponses.md)- [GetTeamByInviteLinkData](type-aliases/GetTeamByInviteLinkData.md)- [GetTeamByInviteLinkError](type-aliases/GetTeamByInviteLinkError.md)- [GetTeamByInviteLinkErrors](type-aliases/GetTeamByInviteLinkErrors.md)@@ -369,6 +375,11 @@- [ListGtmInviteLinksErrors](type-aliases/ListGtmInviteLinksErrors.md)- [ListGtmInviteLinksResponse](type-aliases/ListGtmInviteLinksResponse.md)- [ListGtmInviteLinksResponses](type-aliases/ListGtmInviteLinksResponses.md)+- [ListSystemStatusHistoryData](type-aliases/ListSystemStatusHistoryData.md)+- [ListSystemStatusHistoryError](type-aliases/ListSystemStatusHistoryError.md)+- [ListSystemStatusHistoryErrors](type-aliases/ListSystemStatusHistoryErrors.md)+- [ListSystemStatusHistoryResponse](type-aliases/ListSystemStatusHistoryResponse.md)+- [ListSystemStatusHistoryResponses](type-aliases/ListSystemStatusHistoryResponses.md)- [LogoutData](type-aliases/LogoutData.md)- [LogoutResponse](type-aliases/LogoutResponse.md)- [LogoutResponses](type-aliases/LogoutResponses.md)@@ -573,6 +584,11 @@- [SetGithubPullRequestStateResponse](type-aliases/SetGithubPullRequestStateResponse.md)- [SetGithubPullRequestStateResponse2](type-aliases/SetGithubPullRequestStateResponse2.md)- [SetGithubPullRequestStateResponses](type-aliases/SetGithubPullRequestStateResponses.md)+- [SetSystemStatusData](type-aliases/SetSystemStatusData.md)+- [SetSystemStatusError](type-aliases/SetSystemStatusError.md)+- [SetSystemStatusErrors](type-aliases/SetSystemStatusErrors.md)+- [SetSystemStatusResponse](type-aliases/SetSystemStatusResponse.md)+- [SetSystemStatusResponses](type-aliases/SetSystemStatusResponses.md)- [SsoLoginData](type-aliases/SsoLoginData.md)- [SsoLoginError](type-aliases/SsoLoginError.md)- [SsoLoginErrors](type-aliases/SsoLoginErrors.md)@@ -581,8 +597,11 @@- [StartCodexLoginData](type-aliases/StartCodexLoginData.md)- [StartCodexLoginResponse](type-aliases/StartCodexLoginResponse.md)- [StartCodexLoginResponses](type-aliases/StartCodexLoginResponses.md)+- [StatusUpdate](type-aliases/StatusUpdate.md)- [StripeSessionResponse](type-aliases/StripeSessionResponse.md)- [SubscriptionStatus](type-aliases/SubscriptionStatus.md)+- [SystemStatus](type-aliases/SystemStatus.md)+- [SystemStatusHistory](type-aliases/SystemStatusHistory.md)- [Team](type-aliases/Team.md)- [TeamInviteDetails](type-aliases/TeamInviteDetails.md)- [TeamInviteLinkResponse](type-aliases/TeamInviteLinkResponse.md)diff --git a/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/CurrentSystemStatus.md b/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/CurrentSystemStatus.mdnew file mode 100644index 0000000000..74c9c81e64--- /dev/null+++ b/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/CurrentSystemStatus.md@@ -0,0 +1,11 @@+# Type Alias: CurrentSystemStatus++> **CurrentSystemStatus** = [`SystemStatus`](SystemStatus.md) & \{ `updatedAt?`: `string` \| `null`; \}++The status every user sees, without who set it.++## Type Declaration++| Name | Type | Description |+| ------ | ------ | ------ |+| `updatedAt?` | `string` \| `null` | When it was set; absent when no status was ever set. Clients keep the newest status they have seen, whether fetched or pushed. |diff --git a/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/GetSystemStatusData.md b/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/GetSystemStatusData.mdnew file mode 100644index 0000000000..f626eba47f--- /dev/null+++ b/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/GetSystemStatusData.md@@ -0,0 +1,12 @@+# Type Alias: GetSystemStatusData++> **GetSystemStatusData** = \{ `body?`: `never`; `path?`: `never`; `query?`: `never`; `url`: `"/system-status"`; \}++## Properties++| Property | Type |+| ------ | ------ |+| <a id="property-body"></a> `body?` | `never` |+| <a id="property-path"></a> `path?` | `never` |+| <a id="property-query"></a> `query?` | `never` |+| <a id="property-url"></a> `url` | `"/system-status"` |diff --git a/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/GetSystemStatusError.md b/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/GetSystemStatusError.mdnew file mode 100644index 0000000000..854f5dc2c2--- /dev/null+++ b/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/GetSystemStatusError.md@@ -0,0 +1,3 @@+# Type Alias: GetSystemStatusError++> **GetSystemStatusError** = [`GetSystemStatusErrors`](GetSystemStatusErrors.md)\[keyof [`GetSystemStatusErrors`](GetSystemStatusErrors.md)\]diff --git a/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/GetSystemStatusErrors.md b/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/GetSystemStatusErrors.mdnew file mode 100644index 0000000000..bdbb1108c1--- /dev/null+++ b/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/GetSystemStatusErrors.md@@ -0,0 +1,9 @@+# Type Alias: GetSystemStatusErrors++> **GetSystemStatusErrors** = \{ `500`: [`ErrorResponse`](ErrorResponse.md); \}++## Properties++| Property | Type |+| ------ | ------ |+| <a id="property-500"></a> `500` | [`ErrorResponse`](ErrorResponse.md) |diff --git a/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/GetSystemStatusResponse.md b/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/GetSystemStatusResponse.mdnew file mode 100644index 0000000000..4ea5b693ee--- /dev/null+++ b/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/GetSystemStatusResponse.md@@ -0,0 +1,3 @@+# Type Alias: GetSystemStatusResponse++> **GetSystemStatusResponse** = [`GetSystemStatusResponses`](GetSystemStatusResponses.md)\[keyof [`GetSystemStatusResponses`](GetSystemStatusResponses.md)\]diff --git a/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/GetSystemStatusResponses.md b/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/GetSystemStatusResponses.mdnew file mode 100644index 0000000000..c0ad0e62d3--- /dev/null+++ b/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/GetSystemStatusResponses.md@@ -0,0 +1,9 @@+# Type Alias: GetSystemStatusResponses++> **GetSystemStatusResponses** = \{ `200`: [`CurrentSystemStatus`](CurrentSystemStatus.md); \}++## Properties++| Property | Type |+| ------ | ------ |+| <a id="property-200"></a> `200` | [`CurrentSystemStatus`](CurrentSystemStatus.md) |diff --git a/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/ListSystemStatusHistoryData.md b/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/ListSystemStatusHistoryData.mdnew file mode 100644index 0000000000..260e75a823--- /dev/null+++ b/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/ListSystemStatusHistoryData.md@@ -0,0 +1,12 @@+# Type Alias: ListSystemStatusHistoryData++> **ListSystemStatusHistoryData** = \{ `body?`: `never`; `path?`: `never`; `query?`: `never`; `url`: `"/system-status/history"`; \}++## Properties++| Property | Type |+| ------ | ------ |+| <a id="property-body"></a> `body?` | `never` |+| <a id="property-path"></a> `path?` | `never` |+| <a id="property-query"></a> `query?` | `never` |+| <a id="property-url"></a> `url` | `"/system-status/history"` |diff --git a/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/ListSystemStatusHistoryError.md b/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/ListSystemStatusHistoryError.mdnew file mode 100644index 0000000000..3e50218e8d--- /dev/null+++ b/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/ListSystemStatusHistoryError.md@@ -0,0 +1,3 @@+# Type Alias: ListSystemStatusHistoryError++> **ListSystemStatusHistoryError** = [`ListSystemStatusHistoryErrors`](ListSystemStatusHistoryErrors.md)\[keyof [`ListSystemStatusHistoryErrors`](ListSystemStatusHistoryErrors.md)\]diff --git a/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/ListSystemStatusHistoryErrors.md b/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/ListSystemStatusHistoryErrors.mdnew file mode 100644index 0000000000..742446e6ce--- /dev/null+++ b/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/ListSystemStatusHistoryErrors.md@@ -0,0 +1,11 @@+# Type Alias: ListSystemStatusHistoryErrors++> **ListSystemStatusHistoryErrors** = \{ `401`: [`ErrorResponse`](ErrorResponse.md); `403`: [`ErrorResponse`](ErrorResponse.md); `500`: [`ErrorResponse`](ErrorResponse.md); \}++## Properties++| Property | Type |+| ------ | ------ |+| <a id="property-401"></a> `401` | [`ErrorResponse`](ErrorResponse.md) |+| <a id="property-403"></a> `403` | [`ErrorResponse`](ErrorResponse.md) |+| <a id="property-500"></a> `500` | [`ErrorResponse`](ErrorResponse.md) |diff --git a/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/ListSystemStatusHistoryResponse.md b/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/ListSystemStatusHistoryResponse.mdnew file mode 100644index 0000000000..0b25105d43--- /dev/null+++ b/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/ListSystemStatusHistoryResponse.md@@ -0,0 +1,3 @@+# Type Alias: ListSystemStatusHistoryResponse++> **ListSystemStatusHistoryResponse** = [`ListSystemStatusHistoryResponses`](ListSystemStatusHistoryResponses.md)\[keyof [`ListSystemStatusHistoryResponses`](ListSystemStatusHistoryResponses.md)\]diff --git a/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/ListSystemStatusHistoryResponses.md b/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/ListSystemStatusHistoryResponses.mdnew file mode 100644index 0000000000..5c74462460--- /dev/null+++ b/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/ListSystemStatusHistoryResponses.md@@ -0,0 +1,9 @@+# Type Alias: ListSystemStatusHistoryResponses++> **ListSystemStatusHistoryResponses** = \{ `200`: [`SystemStatusHistory`](SystemStatusHistory.md); \}++## Properties++| Property | Type |+| ------ | ------ |+| <a id="property-200"></a> `200` | [`SystemStatusHistory`](SystemStatusHistory.md) |diff --git a/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/SetSystemStatusData.md b/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/SetSystemStatusData.mdnew file mode 100644index 0000000000..9c06faa815--- /dev/null+++ b/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/SetSystemStatusData.md@@ -0,0 +1,12 @@+# Type Alias: SetSystemStatusData++> **SetSystemStatusData** = \{ `body`: [`SystemStatus`](SystemStatus.md); `path?`: `never`; `query?`: `never`; `url`: `"/system-status"`; \}++## Properties++| Property | Type |+| ------ | ------ |+| <a id="property-body"></a> `body` | [`SystemStatus`](SystemStatus.md) |+| <a id="property-path"></a> `path?` | `never` |+| <a id="property-query"></a> `query?` | `never` |+| <a id="property-url"></a> `url` | `"/system-status"` |diff --git a/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/SetSystemStatusError.md b/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/SetSystemStatusError.mdnew file mode 100644index 0000000000..04ad6e021c--- /dev/null+++ b/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/SetSystemStatusError.md@@ -0,0 +1,3 @@+# Type Alias: SetSystemStatusError++> **SetSystemStatusError** = [`SetSystemStatusErrors`](SetSystemStatusErrors.md)\[keyof [`SetSystemStatusErrors`](SetSystemStatusErrors.md)\]diff --git a/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/SetSystemStatusErrors.md b/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/SetSystemStatusErrors.mdnew file mode 100644index 0000000000..e11ec0e8ec--- /dev/null+++ b/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/SetSystemStatusErrors.md@@ -0,0 +1,12 @@+# Type Alias: SetSystemStatusErrors++> **SetSystemStatusErrors** = \{ `401`: [`ErrorResponse`](ErrorResponse.md); `403`: [`ErrorResponse`](ErrorResponse.md); `422`: `unknown`; `500`: [`ErrorResponse`](ErrorResponse.md); \}++## Properties++| Property | Type | Description |+| ------ | ------ | ------ |+| <a id="property-401"></a> `401` | [`ErrorResponse`](ErrorResponse.md) | - |+| <a id="property-403"></a> `403` | [`ErrorResponse`](ErrorResponse.md) | - |+| <a id="property-422"></a> `422` | `unknown` | The body is not a valid status |+| <a id="property-500"></a> `500` | [`ErrorResponse`](ErrorResponse.md) | - |diff --git a/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/SetSystemStatusResponse.md b/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/SetSystemStatusResponse.mdnew file mode 100644index 0000000000..d9cb482f56--- /dev/null+++ b/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/SetSystemStatusResponse.md@@ -0,0 +1,3 @@+# Type Alias: SetSystemStatusResponse++> **SetSystemStatusResponse** = [`SetSystemStatusResponses`](SetSystemStatusResponses.md)\[keyof [`SetSystemStatusResponses`](SetSystemStatusResponses.md)\]diff --git a/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/SetSystemStatusResponses.md b/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/SetSystemStatusResponses.mdnew file mode 100644index 0000000000..cf26880325--- /dev/null+++ b/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/SetSystemStatusResponses.md@@ -0,0 +1,9 @@+# Type Alias: SetSystemStatusResponses++> **SetSystemStatusResponses** = \{ `200`: [`StatusUpdate`](StatusUpdate.md); \}++## Properties++| Property | Type |+| ------ | ------ |+| <a id="property-200"></a> `200` | [`StatusUpdate`](StatusUpdate.md) |diff --git a/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/StatusUpdate.md b/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/StatusUpdate.mdnew file mode 100644index 0000000000..33c7e9849b--- /dev/null+++ b/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/StatusUpdate.md@@ -0,0 +1,13 @@+# Type Alias: StatusUpdate++> **StatusUpdate** = [`SystemStatus`](SystemStatus.md) & \{ `createdAt`: `string`; `id`: `string`; `userId`: `string`; \}++One status a staff member set. The newest is the current status.++## Type Declaration++| Name | Type | Description |+| ------ | ------ | ------ |+| `createdAt` | `string` | When it was set. |+| `id` | `string` | UUIDv7, so ids sort by creation. |+| `userId` | `string` | The staff member who set it. |diff --git a/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/SystemStatus.md b/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/SystemStatus.mdnew file mode 100644index 0000000000..21e81c66c9--- /dev/null+++ b/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/SystemStatus.md@@ -0,0 +1,33 @@+# Type Alias: SystemStatus++> **SystemStatus** = \{ `status`: `"operational"`; \} \| \{ `message`: `string`; `status`: `"degraded"`; \} \| \{ `message`: `string`; `status`: `"major_outage"`; \}++The platform status. Only the non-operational statuses carry a message.++## Union Members++### Type Literal++\{ `status`: `"operational"`; \}++***++### Type Literal++\{ `message`: `string`; `status`: `"degraded"`; \}++| Name | Type | Description |+| ------ | ------ | ------ |+| `message` | `string` | What users should know. |+| `status` | `"degraded"` | - |++***++### Type Literal++\{ `message`: `string`; `status`: `"major_outage"`; \}++| Name | Type | Description |+| ------ | ------ | ------ |+| `message` | `string` | What users should know. |+| `status` | `"major_outage"` | - |diff --git a/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/SystemStatusHistory.md b/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/SystemStatusHistory.mdnew file mode 100644index 0000000000..1028e49c1f--- /dev/null+++ b/packages/sdk-docs/reference/generated/auth/types.gen/type-aliases/SystemStatusHistory.md@@ -0,0 +1,11 @@+# Type Alias: SystemStatusHistory++> **SystemStatusHistory** = \{ `updates`: [`StatusUpdate`](StatusUpdate.md)[]; \}++Recent status updates, newest first.++## Properties++| Property | Type | Description |+| ------ | ------ | ------ |+| <a id="property-updates"></a> `updates` | [`StatusUpdate`](StatusUpdate.md)[] | The updates. |diff --git a/packages/sdk-docs/reference/generated/connection/types.gen/README.md b/packages/sdk-docs/reference/generated/connection/types.gen/README.mdindex 1a466400b7..fe6158bcac 100644--- a/packages/sdk-docs/reference/generated/connection/types.gen/README.md+++ b/packages/sdk-docs/reference/generated/connection/types.gen/README.md@@ -8,6 +8,10 @@- [BatchSendMessageHandlerErrors](type-aliases/BatchSendMessageHandlerErrors.md)- [BatchSendMessageHandlerResponse](type-aliases/BatchSendMessageHandlerResponse.md)- [BatchSendMessageHandlerResponses](type-aliases/BatchSendMessageHandlerResponses.md)+- [BroadcastMessageHandlerData](type-aliases/BroadcastMessageHandlerData.md)+- [BroadcastMessageHandlerError](type-aliases/BroadcastMessageHandlerError.md)+- [BroadcastMessageHandlerErrors](type-aliases/BroadcastMessageHandlerErrors.md)+- [BroadcastMessageHandlerResponses](type-aliases/BroadcastMessageHandlerResponses.md)- [ClientOptions](type-aliases/ClientOptions.md)- [Entity](type-aliases/Entity.md)- [EntityType](type-aliases/EntityType.md)diff --git a/packages/sdk-docs/reference/generated/connection/types.gen/type-aliases/BroadcastMessageHandlerData.md b/packages/sdk-docs/reference/generated/connection/types.gen/type-aliases/BroadcastMessageHandlerData.mdnew file mode 100644index 0000000000..7e7bdb0508--- /dev/null+++ b/packages/sdk-docs/reference/generated/connection/types.gen/type-aliases/BroadcastMessageHandlerData.md@@ -0,0 +1,12 @@+# Type Alias: BroadcastMessageHandlerData++> **BroadcastMessageHandlerData** = \{ `body`: [`SendMessageBody`](SendMessageBody.md); `path?`: `never`; `query?`: `never`; `url`: `"/message/broadcast"`; \}++## Properties++| Property | Type |+| ------ | ------ |+| <a id="property-body"></a> `body` | [`SendMessageBody`](SendMessageBody.md) |+| <a id="property-path"></a> `path?` | `never` |+| <a id="property-query"></a> `query?` | `never` |+| <a id="property-url"></a> `url` | `"/message/broadcast"` |diff --git a/packages/sdk-docs/reference/generated/connection/types.gen/type-aliases/BroadcastMessageHandlerError.md b/packages/sdk-docs/reference/generated/connection/types.gen/type-aliases/BroadcastMessageHandlerError.mdnew file mode 100644index 0000000000..3035e20239--- /dev/null+++ b/packages/sdk-docs/reference/generated/connection/types.gen/type-aliases/BroadcastMessageHandlerError.md@@ -0,0 +1,3 @@+# Type Alias: BroadcastMessageHandlerError++> **BroadcastMessageHandlerError** = [`BroadcastMessageHandlerErrors`](BroadcastMessageHandlerErrors.md)\[keyof [`BroadcastMessageHandlerErrors`](BroadcastMessageHandlerErrors.md)\]diff --git a/packages/sdk-docs/reference/generated/connection/types.gen/type-aliases/BroadcastMessageHandlerErrors.md b/packages/sdk-docs/reference/generated/connection/types.gen/type-aliases/BroadcastMessageHandlerErrors.mdnew file mode 100644index 0000000000..b7835bcdaf--- /dev/null+++ b/packages/sdk-docs/reference/generated/connection/types.gen/type-aliases/BroadcastMessageHandlerErrors.md@@ -0,0 +1,10 @@+# Type Alias: BroadcastMessageHandlerErrors++> **BroadcastMessageHandlerErrors** = \{ `401`: `string`; `500`: `string`; \}++## Properties++| Property | Type |+| ------ | ------ |+| <a id="property-401"></a> `401` | `string` |+| <a id="property-500"></a> `500` | `string` |diff --git a/packages/sdk-docs/reference/generated/connection/types.gen/type-aliases/BroadcastMessageHandlerResponses.md b/packages/sdk-docs/reference/generated/connection/types.gen/type-aliases/BroadcastMessageHandlerResponses.mdnew file mode 100644index 0000000000..26d12c7c64--- /dev/null+++ b/packages/sdk-docs/reference/generated/connection/types.gen/type-aliases/BroadcastMessageHandlerResponses.md@@ -0,0 +1,9 @@+# Type Alias: BroadcastMessageHandlerResponses++> **BroadcastMessageHandlerResponses** = \{ `202`: `unknown`; \}++## Properties++| Property | Type | Description |+| ------ | ------ | ------ |+| <a id="property-202"></a> `202` | `unknown` | Broadcast accepted |diff --git a/packages/sdk/generated/auth/index.ts b/packages/sdk/generated/auth/index.tsindex c901d279de..64e8569e49 100644--- a/packages/sdk/generated/auth/index.ts+++ b/packages/sdk/generated/auth/index.ts@@ -1,4 +1,4 @@// This file is auto-generated by @hey-api/openapi-tsexport { type Options, Sdk } from './sdk.gen';-export type { AbGroup, AgentApiKey, AgentApiKeyProvider, AiBillingErrorBody, AppleLoginData, AppleLoginError, AppleLoginErrors, AppleLoginRequest, AppleLoginResponse, AppleLoginResponses, AutoReloadDefaults, AutoReloadMonthlyBudget, AutoReloadSnapshot, CancelCodexLoginData, CancelCodexLoginResponse, CancelCodexLoginResponses, ChangePlanData, ChangePlanError, ChangePlanErrors, ChangePlanRequest, ChangePlanResponse, ChangePlanResponse2, ChangePlanResponses, CheckGithubLinkStatusData, CheckGithubLinkStatusError, CheckGithubLinkStatusErrors, CheckGithubLinkStatusResponse, CheckGithubLinkStatusResponses, CheckGmailLinkStatusData, CheckGmailLinkStatusError, CheckGmailLinkStatusErrors, CheckGmailLinkStatusResponse, CheckGmailLinkStatusResponses, CheckoutSessionMetadata, CheckoutSessionV2Response, ClientOptions, CodexConfigRequest, CodexConnectionStatus, CodexEnvironment, CodexEnvironmentRepository, CodexLoginPoll, CodexLoginStart, CodexLoginState, ConfigureCodexData, ConfigureCodexResponse, ConfigureCodexResponses, CreateAccountMergeRequest, CreateAiCreditCheckoutData, CreateAiCreditCheckoutError, CreateAiCreditCheckoutErrors, CreateAiCreditCheckoutResponse, CreateAiCreditCheckoutResponses, CreateCheckoutSessionV2Data, CreateCheckoutSessionV2Error, CreateCheckoutSessionV2Errors, CreateCheckoutSessionV2Request, CreateCheckoutSessionV2Response, CreateCheckoutSessionV2Responses, CreatedTeamInviteLinkResponse, CreateGtmInviteLinkData, CreateGtmInviteLinkError, CreateGtmInviteLinkErrors, CreateGtmInviteLinkRequest, CreateGtmInviteLinkResponse, CreateGtmInviteLinkResponses, CreateInProgressLinkData, CreateInProgressLinkError, CreateInProgressLinkErrors, CreateInProgressLinkResponse, CreateInProgressLinkResponse2, CreateInProgressLinkResponses, CreateMergeRequestData, CreateMergeRequestError, CreateMergeRequestErrors, CreateMergeRequestResponse, CreateMergeRequestResponses, CreatePortalSessionData, CreatePortalSessionError, CreatePortalSessionErrors, CreatePortalSessionRequest, CreatePortalSessionResponse, CreatePortalSessionResponses, CreateTeamData, CreateTeamError, CreateTeamErrors, CreateTeamInviteLinkData, CreateTeamInviteLinkError, CreateTeamInviteLinkErrors, CreateTeamInviteLinkResponse, CreateTeamInviteLinkResponses, CreateTeamRequest, CreateTeamResponse, CreateTeamResponses, CreditCheckoutRequestBody, CreditCheckoutResponse, CursorApiKeyStatus, CursorModelOption, CursorModelsResponse, DeleteAgentApiKeyData, DeleteAgentApiKeyError, DeleteAgentApiKeyErrors, DeleteAgentApiKeyResponse, DeleteAgentApiKeyResponses, DeleteCursorApiKeyData, DeleteCursorApiKeyError, DeleteCursorApiKeyErrors, DeleteCursorApiKeyResponse, DeleteCursorApiKeyResponses, DeleteGithubLinkData, DeleteGithubLinkError, DeleteGithubLinkErrors, DeleteGithubLinkResponse, DeleteGithubLinkResponses, DeleteTeamData, DeleteTeamError, DeleteTeamErrors, DeleteTeamInviteHandlerData, DeleteTeamInviteHandlerError, DeleteTeamInviteHandlerErrors, DeleteTeamInviteHandlerResponses, DeleteTeamInviteLinkData, DeleteTeamInviteLinkError, DeleteTeamInviteLinkErrors, DeleteTeamInviteLinkResponse, DeleteTeamInviteLinkResponses, DeleteTeamResponses, DeleteUserData, DeleteUserError, DeleteUserErrors, DeleteUserResponse, DeleteUserResponses, DenyReason, DisconnectCodexData, DisconnectCodexResponse, DisconnectCodexResponses, EmailConnectionProviders, EmailConnectionProvidersData, EmailConnectionProvidersError, EmailConnectionProvidersErrors, EmailConnectionProvidersResponse, EmailConnectionProvidersResponses, EmptyResponse, EnrichedGithubPullRequest, EnrichGithubPullRequestsData, EnrichGithubPullRequestsError, EnrichGithubPullRequestsErrors, EnrichGithubPullRequestsProxyRequest, EnrichGithubPullRequestsResponse, EnrichGithubPullRequestsResponse2, EnrichGithubPullRequestsResponses, ErrorResponse, GenerateEmailLinkData, GenerateEmailLinkError, GenerateEmailLinkErrors, GenerateEmailLinkRequest, GenerateEmailLinkResponse, GenerateEmailLinkResponses, GenericSuccessResponse, GetAgentApiKeyData, GetAgentApiKeyError, GetAgentApiKeyErrors, GetAgentApiKeyResponse, GetAgentApiKeyResponses, GetAiBillingPlansData, GetAiBillingPlansResponse, GetAiBillingPlansResponses, GetAiBillingSummaryData, GetAiBillingSummaryError, GetAiBillingSummaryErrors, GetAiBillingSummaryResponse, GetAiBillingSummaryResponses, GetCodexConnectionData, GetCodexConnectionResponse, GetCodexConnectionResponses, GetCursorApiKeyData, GetCursorApiKeyError, GetCursorApiKeyErrors, GetCursorApiKeyResponse, GetCursorApiKeyResponses, GetGithubPullRequestMergeabilityData, GetGithubPullRequestMergeabilityError, GetGithubPullRequestMergeabilityErrors, GetGithubPullRequestMergeabilityResponse, GetGithubPullRequestMergeabilityResponses, GetGtmInviteOfferData, GetGtmInviteOfferError, GetGtmInviteOfferErrors, GetGtmInviteOfferResponse, GetGtmInviteOfferResponses, GetLegacyUserPermissionsData, GetLegacyUserPermissionsError, GetLegacyUserPermissionsErrors, GetLegacyUserPermissionsResponse, GetLegacyUserPermissionsResponse2, GetLegacyUserPermissionsResponses, GetNamesWithEmailRequestBody, GetPermissionsData, GetPermissionsError, GetPermissionsErrors, GetPermissionsResponse, GetPermissionsResponses, GetProfilePicturesRequestBody, GetReferralCodeData, GetReferralCodeError, GetReferralCodeErrors, GetReferralCodeResponse, GetReferralCodeResponses, GetSubscriptionStatusData, GetSubscriptionStatusError, GetSubscriptionStatusErrors, GetSubscriptionStatusResponse, GetSubscriptionStatusResponses, GetTeamByInviteLinkData, GetTeamByInviteLinkError, GetTeamByInviteLinkErrors, GetTeamByInviteLinkResponse, GetTeamByInviteLinkResponses, GetTeamData, GetTeamError, GetTeamErrors, GetTeamInviteLinkData, GetTeamInviteLinkError, GetTeamInviteLinkErrors, GetTeamInviteLinkResponse, GetTeamInviteLinkResponses, GetTeamInvitesData, GetTeamInvitesError, GetTeamInvitesErrors, GetTeamInvitesResponse, GetTeamInvitesResponses, GetTeamResponse, GetTeamResponses, GetTrialEligibilityData, GetTrialEligibilityError, GetTrialEligibilityErrors, GetTrialEligibilityResponse, GetTrialEligibilityResponses, GetUserInfo, GetUserInfoData, GetUserInfoError, GetUserInfoErrors, GetUserInfoResponse, GetUserInfoResponses, GetUserInvitesData, GetUserInvitesError, GetUserInvitesErrors, GetUserInvitesResponse, GetUserInvitesResponses, GetUserLanguageData, GetUserLanguageError, GetUserLanguageErrors, GetUserLanguageResponse, GetUserLanguageResponses, GetUserLinkExistsData, GetUserLinkExistsError, GetUserLinkExistsErrors, GetUserLinkExistsResponse, GetUserLinkExistsResponses, GetUserNameData, GetUserNameError, GetUserNameErrors, GetUserNameResponse, GetUserNameResponses, GetUserNamesData, GetUserNamesError, GetUserNamesErrors, GetUserNamesResponse, GetUserNamesResponses, GetUserNamesWithEmailData, GetUserNamesWithEmailError, GetUserNamesWithEmailErrors, GetUserNamesWithEmailResponse, GetUserNamesWithEmailResponses, GetUserOrganizationData, GetUserOrganizationError, GetUserOrganizationErrors, GetUserOrganizationResponse, GetUserOrganizationResponses, GetUserPermissionsData, GetUserPermissionsError, GetUserPermissionsErrors, GetUserPermissionsResponse, GetUserPermissionsResponses, GetUserQuotaData, GetUserQuotaError, GetUserQuotaErrors, GetUserQuotaResponse, GetUserQuotaResponses, GetUserTeamsData, GetUserTeamsError, GetUserTeamsErrors, GetUserTeamsResponse, GetUserTeamsResponses, GithubLinkStatusResponse, GithubMergeMethod, GithubPullRequestCheckRun, GithubPullRequestComment, GithubPullRequestLabel, GithubPullRequestMergeability, GithubPullRequestMergeabilityEntry, GithubPullRequestMergeabilityRequest, GithubPullRequestMergeabilityResponse, GithubPullRequestNumber, GithubPullRequestRef, GithubPullRequestReview, GithubPullRequestReviewState, GithubPullRequestState, GithubPullRequestStatus, GithubPullRequestUser, GmailLinkStatusResponse, GtmInviteLink, GtmInviteLinkList, GtmInviteLinkStatus, GtmInviteOffer, GtmInviteOfferStatus, HealthHandlerData, HealthHandlerResponse, HealthHandlerResponses, InitGithubLinkData, InitGithubLinkError, InitGithubLinkErrors, InitGithubLinkResponse, InitGithubLinkResponse2, InitGithubLinkResponses, InitGmailLinkData, InitGmailLinkError, InitGmailLinkErrors, InitGmailLinkResponse, InitGmailLinkResponse2, InitGmailLinkResponses, InitOutlookLinkData, InitOutlookLinkError, InitOutlookLinkErrors, InitOutlookLinkResponse, InitOutlookLinkResponse2, InitOutlookLinkResponses, InviteEntry, InviteToTeamData, InviteToTeamError, InviteToTeamErrors, InviteToTeamRequest, InviteToTeamResponses, JoinTeamByInviteLinkData, JoinTeamByInviteLinkError, JoinTeamByInviteLinkErrors, JoinTeamByInviteLinkResponse, JoinTeamByInviteLinkResponse2, JoinTeamByInviteLinkResponses, JoinTeamData, JoinTeamError, JoinTeamErrors, JoinTeamResponses, Language, LinkShare, ListCodexEnvironmentsData, ListCodexEnvironmentsResponse, ListCodexEnvironmentsResponses, ListCursorModelsData, ListCursorModelsError, ListCursorModelsErrors, ListCursorModelsResponse, ListCursorModelsResponses, ListGtmInviteLinksData, ListGtmInviteLinksError, ListGtmInviteLinksErrors, ListGtmInviteLinksResponse, ListGtmInviteLinksResponses, LogoutData, LogoutResponse, LogoutResponses, MacroApiTokenData, MacroApiTokenError, MacroApiTokenErrors, MacroApiTokenResponse, MacroApiTokenResponse2, MacroApiTokenResponses, MergeGithubPullRequestData, MergeGithubPullRequestError, MergeGithubPullRequestErrors, MergeGithubPullRequestRequest, MergeGithubPullRequestResponse, MergeGithubPullRequestResponse2, MergeGithubPullRequestResponses, Oauth2CallbackData, Oauth2CallbackError, Oauth2CallbackErrors, Oauth2CallbackResponses, OauthRedirectData, OauthRedirectError, OauthRedirectErrors, OauthRedirectResponses, PasswordlessCallbackData, PasswordlessCallbackError, PasswordlessCallbackErrors, PasswordlessCallbackResponse, PasswordlessCallbackResponses, PasswordlessLoginData, PasswordlessLoginError, PasswordlessLoginErrors, PasswordlessLoginResponse, PasswordlessLoginResponses, PasswordlessRequest, PasswordlessStartedResponse, PasswordLoginData, PasswordLoginError, PasswordLoginErrors, PasswordLoginResponse, PasswordLoginResponses, PasswordRequest, PatchTeamCrmSettingsData, PatchTeamCrmSettingsError, PatchTeamCrmSettingsErrors, PatchTeamCrmSettingsRequest, PatchTeamCrmSettingsResponse, PatchTeamCrmSettingsResponse2, PatchTeamCrmSettingsResponses, PatchTeamData, PatchTeamError, PatchTeamErrors, PatchTeamMemberPlanData, PatchTeamMemberPlanError, PatchTeamMemberPlanErrors, PatchTeamMemberPlanRequest, PatchTeamMemberPlanResponse, PatchTeamMemberPlanResponses, PatchTeamRequest, PatchTeamResponses, PatchTeamUserRole, PatchUserGroupData, PatchUserGroupError, PatchUserGroupErrors, PatchUserGroupRequest, PatchUserGroupResponse, PatchUserGroupResponses, PatchUserOnboardingData, PatchUserOnboardingError, PatchUserOnboardingErrors, PatchUserOnboardingRequest, PatchUserOnboardingResponse, PatchUserOnboardingResponses, PatchUserTutorialData, PatchUserTutorialError, PatchUserTutorialErrors, PatchUserTutorialRequest, PatchUserTutorialResponse, PatchUserTutorialResponses, Permission, PlanCatalogEntry, PlanCatalogResponse, PlanTier, PollCodexLoginData, PollCodexLoginResponse, PollCodexLoginResponses, PostGetNamesRequestBody, PostProfilePicturesData, PostProfilePicturesError, PostProfilePicturesErrors, PostProfilePicturesResponse, PostProfilePicturesResponses, ProfilePictureQueryParams, ProfilePictures, PublicGtmInviteLink, PutAgentApiKeyData, PutAgentApiKeyError, PutAgentApiKeyErrors, PutAgentApiKeyRequest, PutAgentApiKeyResponse, PutAgentApiKeyResponses, PutCursorApiKeyData, PutCursorApiKeyError, PutCursorApiKeyErrors, PutCursorApiKeyRequest, PutCursorApiKeyResponse, PutCursorApiKeyResponses, PutCursorDefaultModelData, PutCursorDefaultModelError, PutCursorDefaultModelErrors, PutCursorDefaultModelRequest, PutCursorDefaultModelResponse, PutCursorDefaultModelResponses, PutProfilePictureData, PutProfilePictureError, PutProfilePictureErrors, PutProfilePictureResponse, PutProfilePictureResponses, PutUserLanguageData, PutUserLanguageError, PutUserLanguageErrors, PutUserLanguageResponse, PutUserLanguageResponses, PutUserNameData, PutUserNameError, PutUserNameErrors, PutUserNameQueryParams, PutUserNameResponse, PutUserNameResponses, RedeemGtmInviteLinkData, RedeemGtmInviteLinkError, RedeemGtmInviteLinkErrors, RedeemGtmInviteLinkRequest, RedeemGtmInviteLinkResponse, RedeemGtmInviteLinkResponses, RefreshData, RefreshError, RefreshErrors, RefreshResponse, RefreshResponses, RejectInvitationData, RejectInvitationError, RejectInvitationErrors, RejectInvitationResponses, RemoveUserFromTeamData, RemoveUserFromTeamError, RemoveUserFromTeamErrors, RemoveUserFromTeamResponses, ResendFusionauthVerifyUserEmailData, ResendFusionauthVerifyUserEmailError, ResendFusionauthVerifyUserEmailErrors, ResendFusionauthVerifyUserEmailRequest, ResendFusionauthVerifyUserEmailResponse, ResendFusionauthVerifyUserEmailResponses, ResolveGtmInviteLinkData, ResolveGtmInviteLinkError, ResolveGtmInviteLinkErrors, ResolveGtmInviteLinkResponse, ResolveGtmInviteLinkResponses, RevokeGtmInviteLinkData, RevokeGtmInviteLinkError, RevokeGtmInviteLinkErrors, RevokeGtmInviteLinkResponse, RevokeGtmInviteLinkResponses, SavedAgentApiKey, ScheduledSeatPlan, SeatPlan, SendInviteBody, SendMobileWelcomeEmailData, SendMobileWelcomeEmailError, SendMobileWelcomeEmailErrors, SendMobileWelcomeEmailRequest, SendMobileWelcomeEmailResponse, SendMobileWelcomeEmailResponse2, SendMobileWelcomeEmailResponses, SendReferralCodeData, SendReferralCodeError, SendReferralCodeErrors, SendReferralCodeResponse, SendReferralCodeResponses, SessionCreationData, SessionCreationError, SessionCreationErrors, SessionCreationResponse, SessionCreationResponses, SessionLoginData, SessionLoginError, SessionLoginErrors, SessionLoginResponse, SessionLoginResponses, SetGithubPullRequestDraftData, SetGithubPullRequestDraftError, SetGithubPullRequestDraftErrors, SetGithubPullRequestDraftRequest, SetGithubPullRequestDraftResponse, SetGithubPullRequestDraftResponse2, SetGithubPullRequestDraftResponses, SetGithubPullRequestStateData, SetGithubPullRequestStateError, SetGithubPullRequestStateErrors, SetGithubPullRequestStateRequest, SetGithubPullRequestStateResponse, SetGithubPullRequestStateResponse2, SetGithubPullRequestStateResponses, SsoLoginData, SsoLoginError, SsoLoginErrors, SsoLoginResponses, SsoRequiredResponse, StartCodexLoginData, StartCodexLoginResponse, StartCodexLoginResponses, StripeSessionResponse, SubscriptionStatus, Team, TeamInviteDetails, TeamInviteLinkResponse, TeamInviteLinkTeam, TeamInviteLinkToken, TeamInviteLinkTokenRequest, TeamInvitesResponse, TeamMember, TeamPlan, TeamRole, TeamWithMembers, ToggleAutoJoinDomainResponse, ToggleNonAdminInvitesResponse, ToggleTeamAutoJoinDomainData, ToggleTeamAutoJoinDomainError, ToggleTeamAutoJoinDomainErrors, ToggleTeamAutoJoinDomainResponse, ToggleTeamAutoJoinDomainResponses, ToggleTeamNonAdminInvitesData, ToggleTeamNonAdminInvitesError, ToggleTeamNonAdminInvitesErrors, ToggleTeamNonAdminInvitesResponse, ToggleTeamNonAdminInvitesResponses, TrialEligibility, UpdateAiBillingAutoReloadData, UpdateAiBillingAutoReloadError, UpdateAiBillingAutoReloadErrors, UpdateAiBillingAutoReloadResponse, UpdateAiBillingAutoReloadResponses, UpdateAiBillingOverageData, UpdateAiBillingOverageError, UpdateAiBillingOverageErrors, UpdateAiBillingOverageResponse, UpdateAiBillingOverageResponses, UpdateAutoReloadRequest, UpdateOverageRequest, UpstreamErrorCode, UpstreamErrorResponse, UsageSnapshot, UserLanguage, UserLinkResponse, UserName, UserNames, UserOrganizationResponse, UserProfilePicture, UserQuota, UserTokensResponse, VerifyEmailLinkData, VerifyEmailLinkError, VerifyEmailLinkErrors, VerifyEmailLinkResponse, VerifyEmailLinkResponses, VerifyFusionauthUserEmailData, VerifyFusionauthUserEmailError, VerifyFusionauthUserEmailErrors, VerifyFusionauthUserEmailResponse, VerifyFusionauthUserEmailResponses, VerifyMergeRequestData, VerifyMergeRequestError, VerifyMergeRequestErrors, VerifyMergeRequestResponse, VerifyMergeRequestResponses } from './types.gen';+export type { AbGroup, AgentApiKey, AgentApiKeyProvider, AiBillingErrorBody, AppleLoginData, AppleLoginError, AppleLoginErrors, AppleLoginRequest, AppleLoginResponse, AppleLoginResponses, AutoReloadDefaults, AutoReloadMonthlyBudget, AutoReloadSnapshot, CancelCodexLoginData, CancelCodexLoginResponse, CancelCodexLoginResponses, ChangePlanData, ChangePlanError, ChangePlanErrors, ChangePlanRequest, ChangePlanResponse, ChangePlanResponse2, ChangePlanResponses, CheckGithubLinkStatusData, CheckGithubLinkStatusError, CheckGithubLinkStatusErrors, CheckGithubLinkStatusResponse, CheckGithubLinkStatusResponses, CheckGmailLinkStatusData, CheckGmailLinkStatusError, CheckGmailLinkStatusErrors, CheckGmailLinkStatusResponse, CheckGmailLinkStatusResponses, CheckoutSessionMetadata, CheckoutSessionV2Response, ClientOptions, CodexConfigRequest, CodexConnectionStatus, CodexEnvironment, CodexEnvironmentRepository, CodexLoginPoll, CodexLoginStart, CodexLoginState, ConfigureCodexData, ConfigureCodexResponse, ConfigureCodexResponses, CreateAccountMergeRequest, CreateAiCreditCheckoutData, CreateAiCreditCheckoutError, CreateAiCreditCheckoutErrors, CreateAiCreditCheckoutResponse, CreateAiCreditCheckoutResponses, CreateCheckoutSessionV2Data, CreateCheckoutSessionV2Error, CreateCheckoutSessionV2Errors, CreateCheckoutSessionV2Request, CreateCheckoutSessionV2Response, CreateCheckoutSessionV2Responses, CreatedTeamInviteLinkResponse, CreateGtmInviteLinkData, CreateGtmInviteLinkError, CreateGtmInviteLinkErrors, CreateGtmInviteLinkRequest, CreateGtmInviteLinkResponse, CreateGtmInviteLinkResponses, CreateInProgressLinkData, CreateInProgressLinkError, CreateInProgressLinkErrors, CreateInProgressLinkResponse, CreateInProgressLinkResponse2, CreateInProgressLinkResponses, CreateMergeRequestData, CreateMergeRequestError, CreateMergeRequestErrors, CreateMergeRequestResponse, CreateMergeRequestResponses, CreatePortalSessionData, CreatePortalSessionError, CreatePortalSessionErrors, CreatePortalSessionRequest, CreatePortalSessionResponse, CreatePortalSessionResponses, CreateTeamData, CreateTeamError, CreateTeamErrors, CreateTeamInviteLinkData, CreateTeamInviteLinkError, CreateTeamInviteLinkErrors, CreateTeamInviteLinkResponse, CreateTeamInviteLinkResponses, CreateTeamRequest, CreateTeamResponse, CreateTeamResponses, CreditCheckoutRequestBody, CreditCheckoutResponse, CurrentSystemStatus, CursorApiKeyStatus, CursorModelOption, CursorModelsResponse, DeleteAgentApiKeyData, DeleteAgentApiKeyError, DeleteAgentApiKeyErrors, DeleteAgentApiKeyResponse, DeleteAgentApiKeyResponses, DeleteCursorApiKeyData, DeleteCursorApiKeyError, DeleteCursorApiKeyErrors, DeleteCursorApiKeyResponse, DeleteCursorApiKeyResponses, DeleteGithubLinkData, DeleteGithubLinkError, DeleteGithubLinkErrors, DeleteGithubLinkResponse, DeleteGithubLinkResponses, DeleteTeamData, DeleteTeamError, DeleteTeamErrors, DeleteTeamInviteHandlerData, DeleteTeamInviteHandlerError, DeleteTeamInviteHandlerErrors, DeleteTeamInviteHandlerResponses, DeleteTeamInviteLinkData, DeleteTeamInviteLinkError, DeleteTeamInviteLinkErrors, DeleteTeamInviteLinkResponse, DeleteTeamInviteLinkResponses, DeleteTeamResponses, DeleteUserData, DeleteUserError, DeleteUserErrors, DeleteUserResponse, DeleteUserResponses, DenyReason, DisconnectCodexData, DisconnectCodexResponse, DisconnectCodexResponses, EmailConnectionProviders, EmailConnectionProvidersData, EmailConnectionProvidersError, EmailConnectionProvidersErrors, EmailConnectionProvidersResponse, EmailConnectionProvidersResponses, EmptyResponse, EnrichedGithubPullRequest, EnrichGithubPullRequestsData, EnrichGithubPullRequestsError, EnrichGithubPullRequestsErrors, EnrichGithubPullRequestsProxyRequest, EnrichGithubPullRequestsResponse, EnrichGithubPullRequestsResponse2, EnrichGithubPullRequestsResponses, ErrorResponse, GenerateEmailLinkData, GenerateEmailLinkError, GenerateEmailLinkErrors, GenerateEmailLinkRequest, GenerateEmailLinkResponse, GenerateEmailLinkResponses, GenericSuccessResponse, GetAgentApiKeyData, GetAgentApiKeyError, GetAgentApiKeyErrors, GetAgentApiKeyResponse, GetAgentApiKeyResponses, GetAiBillingPlansData, GetAiBillingPlansResponse, GetAiBillingPlansResponses, GetAiBillingSummaryData, GetAiBillingSummaryError, GetAiBillingSummaryErrors, GetAiBillingSummaryResponse, GetAiBillingSummaryResponses, GetCodexConnectionData, GetCodexConnectionResponse, GetCodexConnectionResponses, GetCursorApiKeyData, GetCursorApiKeyError, GetCursorApiKeyErrors, GetCursorApiKeyResponse, GetCursorApiKeyResponses, GetGithubPullRequestMergeabilityData, GetGithubPullRequestMergeabilityError, GetGithubPullRequestMergeabilityErrors, GetGithubPullRequestMergeabilityResponse, GetGithubPullRequestMergeabilityResponses, GetGtmInviteOfferData, GetGtmInviteOfferError, GetGtmInviteOfferErrors, GetGtmInviteOfferResponse, GetGtmInviteOfferResponses, GetLegacyUserPermissionsData, GetLegacyUserPermissionsError, GetLegacyUserPermissionsErrors, GetLegacyUserPermissionsResponse, GetLegacyUserPermissionsResponse2, GetLegacyUserPermissionsResponses, GetNamesWithEmailRequestBody, GetPermissionsData, GetPermissionsError, GetPermissionsErrors, GetPermissionsResponse, GetPermissionsResponses, GetProfilePicturesRequestBody, GetReferralCodeData, GetReferralCodeError, GetReferralCodeErrors, GetReferralCodeResponse, GetReferralCodeResponses, GetSubscriptionStatusData, GetSubscriptionStatusError, GetSubscriptionStatusErrors, GetSubscriptionStatusResponse, GetSubscriptionStatusResponses, GetSystemStatusData, GetSystemStatusError, GetSystemStatusErrors, GetSystemStatusResponse, GetSystemStatusResponses, GetTeamByInviteLinkData, GetTeamByInviteLinkError, GetTeamByInviteLinkErrors, GetTeamByInviteLinkResponse, GetTeamByInviteLinkResponses, GetTeamData, GetTeamError, GetTeamErrors, GetTeamInviteLinkData, GetTeamInviteLinkError, GetTeamInviteLinkErrors, GetTeamInviteLinkResponse, GetTeamInviteLinkResponses, GetTeamInvitesData, GetTeamInvitesError, GetTeamInvitesErrors, GetTeamInvitesResponse, GetTeamInvitesResponses, GetTeamResponse, GetTeamResponses, GetTrialEligibilityData, GetTrialEligibilityError, GetTrialEligibilityErrors, GetTrialEligibilityResponse, GetTrialEligibilityResponses, GetUserInfo, GetUserInfoData, GetUserInfoError, GetUserInfoErrors, GetUserInfoResponse, GetUserInfoResponses, GetUserInvitesData, GetUserInvitesError, GetUserInvitesErrors, GetUserInvitesResponse, GetUserInvitesResponses, GetUserLanguageData, GetUserLanguageError, GetUserLanguageErrors, GetUserLanguageResponse, GetUserLanguageResponses, GetUserLinkExistsData, GetUserLinkExistsError, GetUserLinkExistsErrors, GetUserLinkExistsResponse, GetUserLinkExistsResponses, GetUserNameData, GetUserNameError, GetUserNameErrors, GetUserNameResponse, GetUserNameResponses, GetUserNamesData, GetUserNamesError, GetUserNamesErrors, GetUserNamesResponse, GetUserNamesResponses, GetUserNamesWithEmailData, GetUserNamesWithEmailError, GetUserNamesWithEmailErrors, GetUserNamesWithEmailResponse, GetUserNamesWithEmailResponses, GetUserOrganizationData, GetUserOrganizationError, GetUserOrganizationErrors, GetUserOrganizationResponse, GetUserOrganizationResponses, GetUserPermissionsData, GetUserPermissionsError, GetUserPermissionsErrors, GetUserPermissionsResponse, GetUserPermissionsResponses, GetUserQuotaData, GetUserQuotaError, GetUserQuotaErrors, GetUserQuotaResponse, GetUserQuotaResponses, GetUserTeamsData, GetUserTeamsError, GetUserTeamsErrors, GetUserTeamsResponse, GetUserTeamsResponses, GithubLinkStatusResponse, GithubMergeMethod, GithubPullRequestCheckRun, GithubPullRequestComment, GithubPullRequestLabel, GithubPullRequestMergeability, GithubPullRequestMergeabilityEntry, GithubPullRequestMergeabilityRequest, GithubPullRequestMergeabilityResponse, GithubPullRequestNumber, GithubPullRequestRef, GithubPullRequestReview, GithubPullRequestReviewState, GithubPullRequestState, GithubPullRequestStatus, GithubPullRequestUser, GmailLinkStatusResponse, GtmInviteLink, GtmInviteLinkList, GtmInviteLinkStatus, GtmInviteOffer, GtmInviteOfferStatus, HealthHandlerData, HealthHandlerResponse, HealthHandlerResponses, InitGithubLinkData, InitGithubLinkError, InitGithubLinkErrors, InitGithubLinkResponse, InitGithubLinkResponse2, InitGithubLinkResponses, InitGmailLinkData, InitGmailLinkError, InitGmailLinkErrors, InitGmailLinkResponse, InitGmailLinkResponse2, InitGmailLinkResponses, InitOutlookLinkData, InitOutlookLinkError, InitOutlookLinkErrors, InitOutlookLinkResponse, InitOutlookLinkResponse2, InitOutlookLinkResponses, InviteEntry, InviteToTeamData, InviteToTeamError, InviteToTeamErrors, InviteToTeamRequest, InviteToTeamResponses, JoinTeamByInviteLinkData, JoinTeamByInviteLinkError, JoinTeamByInviteLinkErrors, JoinTeamByInviteLinkResponse, JoinTeamByInviteLinkResponse2, JoinTeamByInviteLinkResponses, JoinTeamData, JoinTeamError, JoinTeamErrors, JoinTeamResponses, Language, LinkShare, ListCodexEnvironmentsData, ListCodexEnvironmentsResponse, ListCodexEnvironmentsResponses, ListCursorModelsData, ListCursorModelsError, ListCursorModelsErrors, ListCursorModelsResponse, ListCursorModelsResponses, ListGtmInviteLinksData, ListGtmInviteLinksError, ListGtmInviteLinksErrors, ListGtmInviteLinksResponse, ListGtmInviteLinksResponses, ListSystemStatusHistoryData, ListSystemStatusHistoryError, ListSystemStatusHistoryErrors, ListSystemStatusHistoryResponse, ListSystemStatusHistoryResponses, LogoutData, LogoutResponse, LogoutResponses, MacroApiTokenData, MacroApiTokenError, MacroApiTokenErrors, MacroApiTokenResponse, MacroApiTokenResponse2, MacroApiTokenResponses, MergeGithubPullRequestData, MergeGithubPullRequestError, MergeGithubPullRequestErrors, MergeGithubPullRequestRequest, MergeGithubPullRequestResponse, MergeGithubPullRequestResponse2, MergeGithubPullRequestResponses, Oauth2CallbackData, Oauth2CallbackError, Oauth2CallbackErrors, Oauth2CallbackResponses, OauthRedirectData, OauthRedirectError, OauthRedirectErrors, OauthRedirectResponses, PasswordlessCallbackData, PasswordlessCallbackError, PasswordlessCallbackErrors, PasswordlessCallbackResponse, PasswordlessCallbackResponses, PasswordlessLoginData, PasswordlessLoginError, PasswordlessLoginErrors, PasswordlessLoginResponse, PasswordlessLoginResponses, PasswordlessRequest, PasswordlessStartedResponse, PasswordLoginData, PasswordLoginError, PasswordLoginErrors, PasswordLoginResponse, PasswordLoginResponses, PasswordRequest, PatchTeamCrmSettingsData, PatchTeamCrmSettingsError, PatchTeamCrmSettingsErrors, PatchTeamCrmSettingsRequest, PatchTeamCrmSettingsResponse, PatchTeamCrmSettingsResponse2, PatchTeamCrmSettingsResponses, PatchTeamData, PatchTeamError, PatchTeamErrors, PatchTeamMemberPlanData, PatchTeamMemberPlanError, PatchTeamMemberPlanErrors, PatchTeamMemberPlanRequest, PatchTeamMemberPlanResponse, PatchTeamMemberPlanResponses, PatchTeamRequest, PatchTeamResponses, PatchTeamUserRole, PatchUserGroupData, PatchUserGroupError, PatchUserGroupErrors, PatchUserGroupRequest, PatchUserGroupResponse, PatchUserGroupResponses, PatchUserOnboardingData, PatchUserOnboardingError, PatchUserOnboardingErrors, PatchUserOnboardingRequest, PatchUserOnboardingResponse, PatchUserOnboardingResponses, PatchUserTutorialData, PatchUserTutorialError, PatchUserTutorialErrors, PatchUserTutorialRequest, PatchUserTutorialResponse, PatchUserTutorialResponses, Permission, PlanCatalogEntry, PlanCatalogResponse, PlanTier, PollCodexLoginData, PollCodexLoginResponse, PollCodexLoginResponses, PostGetNamesRequestBody, PostProfilePicturesData, PostProfilePicturesError, PostProfilePicturesErrors, PostProfilePicturesResponse, PostProfilePicturesResponses, ProfilePictureQueryParams, ProfilePictures, PublicGtmInviteLink, PutAgentApiKeyData, PutAgentApiKeyError, PutAgentApiKeyErrors, PutAgentApiKeyRequest, PutAgentApiKeyResponse, PutAgentApiKeyResponses, PutCursorApiKeyData, PutCursorApiKeyError, PutCursorApiKeyErrors, PutCursorApiKeyRequest, PutCursorApiKeyResponse, PutCursorApiKeyResponses, PutCursorDefaultModelData, PutCursorDefaultModelError, PutCursorDefaultModelErrors, PutCursorDefaultModelRequest, PutCursorDefaultModelResponse, PutCursorDefaultModelResponses, PutProfilePictureData, PutProfilePictureError, PutProfilePictureErrors, PutProfilePictureResponse, PutProfilePictureResponses, PutUserLanguageData, PutUserLanguageError, PutUserLanguageErrors, PutUserLanguageResponse, PutUserLanguageResponses, PutUserNameData, PutUserNameError, PutUserNameErrors, PutUserNameQueryParams, PutUserNameResponse, PutUserNameResponses, RedeemGtmInviteLinkData, RedeemGtmInviteLinkError, RedeemGtmInviteLinkErrors, RedeemGtmInviteLinkRequest, RedeemGtmInviteLinkResponse, RedeemGtmInviteLinkResponses, RefreshData, RefreshError, RefreshErrors, RefreshResponse, RefreshResponses, RejectInvitationData, RejectInvitationError, RejectInvitationErrors, RejectInvitationResponses, RemoveUserFromTeamData, RemoveUserFromTeamError, RemoveUserFromTeamErrors, RemoveUserFromTeamResponses, ResendFusionauthVerifyUserEmailData, ResendFusionauthVerifyUserEmailError, ResendFusionauthVerifyUserEmailErrors, ResendFusionauthVerifyUserEmailRequest, ResendFusionauthVerifyUserEmailResponse, ResendFusionauthVerifyUserEmailResponses, ResolveGtmInviteLinkData, ResolveGtmInviteLinkError, ResolveGtmInviteLinkErrors, ResolveGtmInviteLinkResponse, ResolveGtmInviteLinkResponses, RevokeGtmInviteLinkData, RevokeGtmInviteLinkError, RevokeGtmInviteLinkErrors, RevokeGtmInviteLinkResponse, RevokeGtmInviteLinkResponses, SavedAgentApiKey, ScheduledSeatPlan, SeatPlan, SendInviteBody, SendMobileWelcomeEmailData, SendMobileWelcomeEmailError, SendMobileWelcomeEmailErrors, SendMobileWelcomeEmailRequest, SendMobileWelcomeEmailResponse, SendMobileWelcomeEmailResponse2, SendMobileWelcomeEmailResponses, SendReferralCodeData, SendReferralCodeError, SendReferralCodeErrors, SendReferralCodeResponse, SendReferralCodeResponses, SessionCreationData, SessionCreationError, SessionCreationErrors, SessionCreationResponse, SessionCreationResponses, SessionLoginData, SessionLoginError, SessionLoginErrors, SessionLoginResponse, SessionLoginResponses, SetGithubPullRequestDraftData, SetGithubPullRequestDraftError, SetGithubPullRequestDraftErrors, SetGithubPullRequestDraftRequest, SetGithubPullRequestDraftResponse, SetGithubPullRequestDraftResponse2, SetGithubPullRequestDraftResponses, SetGithubPullRequestStateData, SetGithubPullRequestStateError, SetGithubPullRequestStateErrors, SetGithubPullRequestStateRequest, SetGithubPullRequestStateResponse, SetGithubPullRequestStateResponse2, SetGithubPullRequestStateResponses, SetSystemStatusData, SetSystemStatusError, SetSystemStatusErrors, SetSystemStatusResponse, SetSystemStatusResponses, SsoLoginData, SsoLoginError, SsoLoginErrors, SsoLoginResponses, SsoRequiredResponse, StartCodexLoginData, StartCodexLoginResponse, StartCodexLoginResponses, StatusUpdate, StripeSessionResponse, SubscriptionStatus, SystemStatus, SystemStatusHistory, Team, TeamInviteDetails, TeamInviteLinkResponse, TeamInviteLinkTeam, TeamInviteLinkToken, TeamInviteLinkTokenRequest, TeamInvitesResponse, TeamMember, TeamPlan, TeamRole, TeamWithMembers, ToggleAutoJoinDomainResponse, ToggleNonAdminInvitesResponse, ToggleTeamAutoJoinDomainData, ToggleTeamAutoJoinDomainError, ToggleTeamAutoJoinDomainErrors, ToggleTeamAutoJoinDomainResponse, ToggleTeamAutoJoinDomainResponses, ToggleTeamNonAdminInvitesData, ToggleTeamNonAdminInvitesError, ToggleTeamNonAdminInvitesErrors, ToggleTeamNonAdminInvitesResponse, ToggleTeamNonAdminInvitesResponses, TrialEligibility, UpdateAiBillingAutoReloadData, UpdateAiBillingAutoReloadError, UpdateAiBillingAutoReloadErrors, UpdateAiBillingAutoReloadResponse, UpdateAiBillingAutoReloadResponses, UpdateAiBillingOverageData, UpdateAiBillingOverageError, UpdateAiBillingOverageErrors, UpdateAiBillingOverageResponse, UpdateAiBillingOverageResponses, UpdateAutoReloadRequest, UpdateOverageRequest, UpstreamErrorCode, UpstreamErrorResponse, UsageSnapshot, UserLanguage, UserLinkResponse, UserName, UserNames, UserOrganizationResponse, UserProfilePicture, UserQuota, UserTokensResponse, VerifyEmailLinkData, VerifyEmailLinkError, VerifyEmailLinkErrors, VerifyEmailLinkResponse, VerifyEmailLinkResponses, VerifyFusionauthUserEmailData, VerifyFusionauthUserEmailError, VerifyFusionauthUserEmailErrors, VerifyFusionauthUserEmailResponse, VerifyFusionauthUserEmailResponses, VerifyMergeRequestData, VerifyMergeRequestError, VerifyMergeRequestErrors, VerifyMergeRequestResponse, VerifyMergeRequestResponses } from './types.gen';diff --git a/packages/sdk/generated/auth/sdk.gen.ts b/packages/sdk/generated/auth/sdk.gen.tsindex cfee864f66..97a53a8adc 100644--- a/packages/sdk/generated/auth/sdk.gen.ts+++ b/packages/sdk/generated/auth/sdk.gen.ts@@ -2,7 +2,7 @@import type { Client, ClientMeta, Options as Options2, RequestResult, TDataShape } from './client';import { client } from './client.gen';-import type { AppleLoginData, AppleLoginErrors, AppleLoginResponses, CancelCodexLoginData, CancelCodexLoginResponses, ChangePlanData, ChangePlanErrors, ChangePlanResponses, CheckGithubLinkStatusData, CheckGithubLinkStatusErrors, CheckGithubLinkStatusResponses, CheckGmailLinkStatusData, CheckGmailLinkStatusErrors, CheckGmailLinkStatusResponses, ConfigureCodexData, ConfigureCodexResponses, CreateAiCreditCheckoutData, CreateAiCreditCheckoutErrors, CreateAiCreditCheckoutResponses, CreateCheckoutSessionV2Data, CreateCheckoutSessionV2Errors, CreateCheckoutSessionV2Responses, CreateGtmInviteLinkData, CreateGtmInviteLinkErrors, CreateGtmInviteLinkResponses, CreateInProgressLinkData, CreateInProgressLinkErrors, CreateInProgressLinkResponses, CreateMergeRequestData, CreateMergeRequestErrors, CreateMergeRequestResponses, CreatePortalSessionData, CreatePortalSessionErrors, CreatePortalSessionResponses, CreateTeamData, CreateTeamErrors, CreateTeamInviteLinkData, CreateTeamInviteLinkErrors, CreateTeamInviteLinkResponses, CreateTeamResponses, DeleteAgentApiKeyData, DeleteAgentApiKeyErrors, DeleteAgentApiKeyResponses, DeleteCursorApiKeyData, DeleteCursorApiKeyErrors, DeleteCursorApiKeyResponses, DeleteGithubLinkData, DeleteGithubLinkErrors, DeleteGithubLinkResponses, DeleteTeamData, DeleteTeamErrors, DeleteTeamInviteHandlerData, DeleteTeamInviteHandlerErrors, DeleteTeamInviteHandlerResponses, DeleteTeamInviteLinkData, DeleteTeamInviteLinkErrors, DeleteTeamInviteLinkResponses, DeleteTeamResponses, DeleteUserData, DeleteUserErrors, DeleteUserResponses, DisconnectCodexData, DisconnectCodexResponses, EmailConnectionProvidersData, EmailConnectionProvidersErrors, EmailConnectionProvidersResponses, EnrichGithubPullRequestsData, EnrichGithubPullRequestsErrors, EnrichGithubPullRequestsResponses, GenerateEmailLinkData, GenerateEmailLinkErrors, GenerateEmailLinkResponses, GetAgentApiKeyData, GetAgentApiKeyErrors, GetAgentApiKeyResponses, GetAiBillingPlansData, GetAiBillingPlansResponses, GetAiBillingSummaryData, GetAiBillingSummaryErrors, GetAiBillingSummaryResponses, GetCodexConnectionData, GetCodexConnectionResponses, GetCursorApiKeyData, GetCursorApiKeyErrors, GetCursorApiKeyResponses, GetGithubPullRequestMergeabilityData, GetGithubPullRequestMergeabilityErrors, GetGithubPullRequestMergeabilityResponses, GetGtmInviteOfferData, GetGtmInviteOfferErrors, GetGtmInviteOfferResponses, GetLegacyUserPermissionsData, GetLegacyUserPermissionsErrors, GetLegacyUserPermissionsResponses, GetPermissionsData, GetPermissionsErrors, GetPermissionsResponses, GetReferralCodeData, GetReferralCodeErrors, GetReferralCodeResponses, GetSubscriptionStatusData, GetSubscriptionStatusErrors, GetSubscriptionStatusResponses, GetTeamByInviteLinkData, GetTeamByInviteLinkErrors, GetTeamByInviteLinkResponses, GetTeamData, GetTeamErrors, GetTeamInviteLinkData, GetTeamInviteLinkErrors, GetTeamInviteLinkResponses, GetTeamInvitesData, GetTeamInvitesErrors, GetTeamInvitesResponses, GetTeamResponses, GetTrialEligibilityData, GetTrialEligibilityErrors, GetTrialEligibilityResponses, GetUserInfoData, GetUserInfoErrors, GetUserInfoResponses, GetUserInvitesData, GetUserInvitesErrors, GetUserInvitesResponses, GetUserLanguageData, GetUserLanguageErrors, GetUserLanguageResponses, GetUserLinkExistsData, GetUserLinkExistsErrors, GetUserLinkExistsResponses, GetUserNameData, GetUserNameErrors, GetUserNameResponses, GetUserNamesData, GetUserNamesErrors, GetUserNamesResponses, GetUserNamesWithEmailData, GetUserNamesWithEmailErrors, GetUserNamesWithEmailResponses, GetUserOrganizationData, GetUserOrganizationErrors, GetUserOrganizationResponses, GetUserPermissionsData, GetUserPermissionsErrors, GetUserPermissionsResponses, GetUserQuotaData, GetUserQuotaErrors, GetUserQuotaResponses, GetUserTeamsData, GetUserTeamsErrors, GetUserTeamsResponses, HealthHandlerData, HealthHandlerResponses, InitGithubLinkData, InitGithubLinkErrors, InitGithubLinkResponses, InitGmailLinkData, InitGmailLinkErrors, InitGmailLinkResponses, InitOutlookLinkData, InitOutlookLinkErrors, InitOutlookLinkResponses, InviteToTeamData, InviteToTeamErrors, InviteToTeamResponses, JoinTeamByInviteLinkData, JoinTeamByInviteLinkErrors, JoinTeamByInviteLinkResponses, JoinTeamData, JoinTeamErrors, JoinTeamResponses, ListCodexEnvironmentsData, ListCodexEnvironmentsResponses, ListCursorModelsData, ListCursorModelsErrors, ListCursorModelsResponses, ListGtmInviteLinksData, ListGtmInviteLinksErrors, ListGtmInviteLinksResponses, LogoutData, LogoutResponses, MacroApiTokenData, MacroApiTokenErrors, MacroApiTokenResponses, MergeGithubPullRequestData, MergeGithubPullRequestErrors, MergeGithubPullRequestResponses, Oauth2CallbackData, Oauth2CallbackErrors, Oauth2CallbackResponses, OauthRedirectData, OauthRedirectErrors, OauthRedirectResponses, PasswordlessCallbackData, PasswordlessCallbackErrors, PasswordlessCallbackResponses, PasswordlessLoginData, PasswordlessLoginErrors, PasswordlessLoginResponses, PasswordLoginData, PasswordLoginErrors, PasswordLoginResponses, PatchTeamCrmSettingsData, PatchTeamCrmSettingsErrors, PatchTeamCrmSettingsResponses, PatchTeamData, PatchTeamErrors, PatchTeamMemberPlanData, PatchTeamMemberPlanErrors, PatchTeamMemberPlanResponses, PatchTeamResponses, PatchUserGroupData, PatchUserGroupErrors, PatchUserGroupResponses, PatchUserOnboardingData, PatchUserOnboardingErrors, PatchUserOnboardingResponses, PatchUserTutorialData, PatchUserTutorialErrors, PatchUserTutorialResponses, PollCodexLoginData, PollCodexLoginResponses, PostProfilePicturesData, PostProfilePicturesErrors, PostProfilePicturesResponses, PutAgentApiKeyData, PutAgentApiKeyErrors, PutAgentApiKeyResponses, PutCursorApiKeyData, PutCursorApiKeyErrors, PutCursorApiKeyResponses, PutCursorDefaultModelData, PutCursorDefaultModelErrors, PutCursorDefaultModelResponses, PutProfilePictureData, PutProfilePictureErrors, PutProfilePictureResponses, PutUserLanguageData, PutUserLanguageErrors, PutUserLanguageResponses, PutUserNameData, PutUserNameErrors, PutUserNameResponses, RedeemGtmInviteLinkData, RedeemGtmInviteLinkErrors, RedeemGtmInviteLinkResponses, RefreshData, RefreshErrors, RefreshResponses, RejectInvitationData, RejectInvitationErrors, RejectInvitationResponses, RemoveUserFromTeamData, RemoveUserFromTeamErrors, RemoveUserFromTeamResponses, ResendFusionauthVerifyUserEmailData, ResendFusionauthVerifyUserEmailErrors, ResendFusionauthVerifyUserEmailResponses, ResolveGtmInviteLinkData, ResolveGtmInviteLinkErrors, ResolveGtmInviteLinkResponses, RevokeGtmInviteLinkData, RevokeGtmInviteLinkErrors, RevokeGtmInviteLinkResponses, SendMobileWelcomeEmailData, SendMobileWelcomeEmailErrors, SendMobileWelcomeEmailResponses, SendReferralCodeData, SendReferralCodeErrors, SendReferralCodeResponses, SessionCreationData, SessionCreationErrors, SessionCreationResponses, SessionLoginData, SessionLoginErrors, SessionLoginResponses, SetGithubPullRequestDraftData, SetGithubPullRequestDraftErrors, SetGithubPullRequestDraftResponses, SetGithubPullRequestStateData, SetGithubPullRequestStateErrors, SetGithubPullRequestStateResponses, SsoLoginData, SsoLoginErrors, SsoLoginResponses, StartCodexLoginData, StartCodexLoginResponses, ToggleTeamAutoJoinDomainData, ToggleTeamAutoJoinDomainErrors, ToggleTeamAutoJoinDomainResponses, ToggleTeamNonAdminInvitesData, ToggleTeamNonAdminInvitesErrors, ToggleTeamNonAdminInvitesResponses, UpdateAiBillingAutoReloadData, UpdateAiBillingAutoReloadErrors, UpdateAiBillingAutoReloadResponses, UpdateAiBillingOverageData, UpdateAiBillingOverageErrors, UpdateAiBillingOverageResponses, VerifyEmailLinkData, VerifyEmailLinkErrors, VerifyEmailLinkResponses, VerifyFusionauthUserEmailData, VerifyFusionauthUserEmailErrors, VerifyFusionauthUserEmailResponses, VerifyMergeRequestData, VerifyMergeRequestErrors, VerifyMergeRequestResponses } from './types.gen';+import type { AppleLoginData, AppleLoginErrors, AppleLoginResponses, CancelCodexLoginData, CancelCodexLoginResponses, ChangePlanData, ChangePlanErrors, ChangePlanResponses, CheckGithubLinkStatusData, CheckGithubLinkStatusErrors, CheckGithubLinkStatusResponses, CheckGmailLinkStatusData, CheckGmailLinkStatusErrors, CheckGmailLinkStatusResponses, ConfigureCodexData, ConfigureCodexResponses, CreateAiCreditCheckoutData, CreateAiCreditCheckoutErrors, CreateAiCreditCheckoutResponses, CreateCheckoutSessionV2Data, CreateCheckoutSessionV2Errors, CreateCheckoutSessionV2Responses, CreateGtmInviteLinkData, CreateGtmInviteLinkErrors, CreateGtmInviteLinkResponses, CreateInProgressLinkData, CreateInProgressLinkErrors, CreateInProgressLinkResponses, CreateMergeRequestData, CreateMergeRequestErrors, CreateMergeRequestResponses, CreatePortalSessionData, CreatePortalSessionErrors, CreatePortalSessionResponses, CreateTeamData, CreateTeamErrors, CreateTeamInviteLinkData, CreateTeamInviteLinkErrors, CreateTeamInviteLinkResponses, CreateTeamResponses, DeleteAgentApiKeyData, DeleteAgentApiKeyErrors, DeleteAgentApiKeyResponses, DeleteCursorApiKeyData, DeleteCursorApiKeyErrors, DeleteCursorApiKeyResponses, DeleteGithubLinkData, DeleteGithubLinkErrors, DeleteGithubLinkResponses, DeleteTeamData, DeleteTeamErrors, DeleteTeamInviteHandlerData, DeleteTeamInviteHandlerErrors, DeleteTeamInviteHandlerResponses, DeleteTeamInviteLinkData, DeleteTeamInviteLinkErrors, DeleteTeamInviteLinkResponses, DeleteTeamResponses, DeleteUserData, DeleteUserErrors, DeleteUserResponses, DisconnectCodexData, DisconnectCodexResponses, EmailConnectionProvidersData, EmailConnectionProvidersErrors, EmailConnectionProvidersResponses, EnrichGithubPullRequestsData, EnrichGithubPullRequestsErrors, EnrichGithubPullRequestsResponses, GenerateEmailLinkData, GenerateEmailLinkErrors, GenerateEmailLinkResponses, GetAgentApiKeyData, GetAgentApiKeyErrors, GetAgentApiKeyResponses, GetAiBillingPlansData, GetAiBillingPlansResponses, GetAiBillingSummaryData, GetAiBillingSummaryErrors, GetAiBillingSummaryResponses, GetCodexConnectionData, GetCodexConnectionResponses, GetCursorApiKeyData, GetCursorApiKeyErrors, GetCursorApiKeyResponses, GetGithubPullRequestMergeabilityData, GetGithubPullRequestMergeabilityErrors, GetGithubPullRequestMergeabilityResponses, GetGtmInviteOfferData, GetGtmInviteOfferErrors, GetGtmInviteOfferResponses, GetLegacyUserPermissionsData, GetLegacyUserPermissionsErrors, GetLegacyUserPermissionsResponses, GetPermissionsData, GetPermissionsErrors, GetPermissionsResponses, GetReferralCodeData, GetReferralCodeErrors, GetReferralCodeResponses, GetSubscriptionStatusData, GetSubscriptionStatusErrors, GetSubscriptionStatusResponses, GetSystemStatusData, GetSystemStatusErrors, GetSystemStatusResponses, GetTeamByInviteLinkData, GetTeamByInviteLinkErrors, GetTeamByInviteLinkResponses, GetTeamData, GetTeamErrors, GetTeamInviteLinkData, GetTeamInviteLinkErrors, GetTeamInviteLinkResponses, GetTeamInvitesData, GetTeamInvitesErrors, GetTeamInvitesResponses, GetTeamResponses, GetTrialEligibilityData, GetTrialEligibilityErrors, GetTrialEligibilityResponses, GetUserInfoData, GetUserInfoErrors, GetUserInfoResponses, GetUserInvitesData, GetUserInvitesErrors, GetUserInvitesResponses, GetUserLanguageData, GetUserLanguageErrors, GetUserLanguageResponses, GetUserLinkExistsData, GetUserLinkExistsErrors, GetUserLinkExistsResponses, GetUserNameData, GetUserNameErrors, GetUserNameResponses, GetUserNamesData, GetUserNamesErrors, GetUserNamesResponses, GetUserNamesWithEmailData, GetUserNamesWithEmailErrors, GetUserNamesWithEmailResponses, GetUserOrganizationData, GetUserOrganizationErrors, GetUserOrganizationResponses, GetUserPermissionsData, GetUserPermissionsErrors, GetUserPermissionsResponses, GetUserQuotaData, GetUserQuotaErrors, GetUserQuotaResponses, GetUserTeamsData, GetUserTeamsErrors, GetUserTeamsResponses, HealthHandlerData, HealthHandlerResponses, InitGithubLinkData, InitGithubLinkErrors, InitGithubLinkResponses, InitGmailLinkData, InitGmailLinkErrors, InitGmailLinkResponses, InitOutlookLinkData, InitOutlookLinkErrors, InitOutlookLinkResponses, InviteToTeamData, InviteToTeamErrors, InviteToTeamResponses, JoinTeamByInviteLinkData, JoinTeamByInviteLinkErrors, JoinTeamByInviteLinkResponses, JoinTeamData, JoinTeamErrors, JoinTeamResponses, ListCodexEnvironmentsData, ListCodexEnvironmentsResponses, ListCursorModelsData, ListCursorModelsErrors, ListCursorModelsResponses, ListGtmInviteLinksData, ListGtmInviteLinksErrors, ListGtmInviteLinksResponses, ListSystemStatusHistoryData, ListSystemStatusHistoryErrors, ListSystemStatusHistoryResponses, LogoutData, LogoutResponses, MacroApiTokenData, MacroApiTokenErrors, MacroApiTokenResponses, MergeGithubPullRequestData, MergeGithubPullRequestErrors, MergeGithubPullRequestResponses, Oauth2CallbackData, Oauth2CallbackErrors, Oauth2CallbackResponses, OauthRedirectData, OauthRedirectErrors, OauthRedirectResponses, PasswordlessCallbackData, PasswordlessCallbackErrors, PasswordlessCallbackResponses, PasswordlessLoginData, PasswordlessLoginErrors, PasswordlessLoginResponses, PasswordLoginData, PasswordLoginErrors, PasswordLoginResponses, PatchTeamCrmSettingsData, PatchTeamCrmSettingsErrors, PatchTeamCrmSettingsResponses, PatchTeamData, PatchTeamErrors, PatchTeamMemberPlanData, PatchTeamMemberPlanErrors, PatchTeamMemberPlanResponses, PatchTeamResponses, PatchUserGroupData, PatchUserGroupErrors, PatchUserGroupResponses, PatchUserOnboardingData, PatchUserOnboardingErrors, PatchUserOnboardingResponses, PatchUserTutorialData, PatchUserTutorialErrors, PatchUserTutorialResponses, PollCodexLoginData, PollCodexLoginResponses, PostProfilePicturesData, PostProfilePicturesErrors, PostProfilePicturesResponses, PutAgentApiKeyData, PutAgentApiKeyErrors, PutAgentApiKeyResponses, PutCursorApiKeyData, PutCursorApiKeyErrors, PutCursorApiKeyResponses, PutCursorDefaultModelData, PutCursorDefaultModelErrors, PutCursorDefaultModelResponses, PutProfilePictureData, PutProfilePictureErrors, PutProfilePictureResponses, PutUserLanguageData, PutUserLanguageErrors, PutUserLanguageResponses, PutUserNameData, PutUserNameErrors, PutUserNameResponses, RedeemGtmInviteLinkData, RedeemGtmInviteLinkErrors, RedeemGtmInviteLinkResponses, RefreshData, RefreshErrors, RefreshResponses, RejectInvitationData, RejectInvitationErrors, RejectInvitationResponses, RemoveUserFromTeamData, RemoveUserFromTeamErrors, RemoveUserFromTeamResponses, ResendFusionauthVerifyUserEmailData, ResendFusionauthVerifyUserEmailErrors, ResendFusionauthVerifyUserEmailResponses, ResolveGtmInviteLinkData, ResolveGtmInviteLinkErrors, ResolveGtmInviteLinkResponses, RevokeGtmInviteLinkData, RevokeGtmInviteLinkErrors, RevokeGtmInviteLinkResponses, SendMobileWelcomeEmailData, SendMobileWelcomeEmailErrors, SendMobileWelcomeEmailResponses, SendReferralCodeData, SendReferralCodeErrors, SendReferralCodeResponses, SessionCreationData, SessionCreationErrors, SessionCreationResponses, SessionLoginData, SessionLoginErrors, SessionLoginResponses, SetGithubPullRequestDraftData, SetGithubPullRequestDraftErrors, SetGithubPullRequestDraftResponses, SetGithubPullRequestStateData, SetGithubPullRequestStateErrors, SetGithubPullRequestStateResponses, SetSystemStatusData, SetSystemStatusErrors, SetSystemStatusResponses, SsoLoginData, SsoLoginErrors, SsoLoginResponses, StartCodexLoginData, StartCodexLoginResponses, ToggleTeamAutoJoinDomainData, ToggleTeamAutoJoinDomainErrors, ToggleTeamAutoJoinDomainResponses, ToggleTeamNonAdminInvitesData, ToggleTeamNonAdminInvitesErrors, ToggleTeamNonAdminInvitesResponses, UpdateAiBillingAutoReloadData, UpdateAiBillingAutoReloadErrors, UpdateAiBillingAutoReloadResponses, UpdateAiBillingOverageData, UpdateAiBillingOverageErrors, UpdateAiBillingOverageResponses, VerifyEmailLinkData, VerifyEmailLinkErrors, VerifyEmailLinkResponses, VerifyFusionauthUserEmailData, VerifyFusionauthUserEmailErrors, VerifyFusionauthUserEmailResponses, VerifyMergeRequestData, VerifyMergeRequestErrors, VerifyMergeRequestResponses } from './types.gen';export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options2<TData, ThrowOnError, TResponse> & {/**@@ -692,6 +692,47 @@ export class Sdk extends HeyApiClient {return (options.client ?? this.client).get<SessionLoginResponses, SessionLoginErrors, ThrowOnError>({ url: '/session/login/{session_code}', ...options });}+ /**+ * The status every user sees. Public: the banner shows wherever the app+ * runs, signed in or not.+ */+ public getSystemStatus<ThrowOnError extends boolean = false>(options?: Options<GetSystemStatusData, ThrowOnError>): RequestResult<GetSystemStatusResponses, GetSystemStatusErrors, ThrowOnError> {+ return (options?.client ?? this.client).get<GetSystemStatusResponses, GetSystemStatusErrors, ThrowOnError>({ url: '/system-status', ...options });+ }++ /**+ * Sets the status every user sees and pushes it to every open app. Macro+ * staff only.+ *+ * Authenticate with a Macro session, or from a script with a personal API+ * key (Settings → API keys) in the `x-macro-user-api-key` header. The body+ * is the new status:+ *+ * - `{"status": "operational"}` clears the banner. It takes no message.+ * - `{"status": "degraded", "message": "Search is slow to update."}`+ * - `{"status": "major_outage", "message": "Macro is unavailable. We're on it."}`+ *+ * Messages are trimmed and must be 1–500 characters. Every call is kept in+ * the history, even when it repeats the current status.+ */+ public setSystemStatus<ThrowOnError extends boolean = false>(options: Options<SetSystemStatusData, ThrowOnError>): RequestResult<SetSystemStatusResponses, SetSystemStatusErrors, ThrowOnError> {+ return (options.client ?? this.client).post<SetSystemStatusResponses, SetSystemStatusErrors, ThrowOnError>({+ url: '/system-status',+ ...options,+ headers: {+ 'Content-Type': 'application/json',+ ...options.headers+ }+ });+ }++ /**+ * Recent status updates, newest first, with who set each. Macro staff only.+ */+ public listSystemStatusHistory<ThrowOnError extends boolean = false>(options?: Options<ListSystemStatusHistoryData, ThrowOnError>): RequestResult<ListSystemStatusHistoryResponses, ListSystemStatusHistoryErrors, ThrowOnError> {+ return (options?.client ?? this.client).get<ListSystemStatusHistoryResponses, ListSystemStatusHistoryErrors, ThrowOnError>({ url: '/system-status/history', ...options });+ }+/*** Deletes a team.* This will update all team members roles and cancel your subscription for the team.diff --git a/packages/sdk/generated/auth/types.gen.ts b/packages/sdk/generated/auth/types.gen.tsindex d7a44db91d..982d042e20 100644--- a/packages/sdk/generated/auth/types.gen.ts+++ b/packages/sdk/generated/auth/types.gen.ts@@ -378,6 +378,17 @@ export type CreditCheckoutResponse = {url: string;};+/**+ * The status every user sees, without who set it.+ */+export type CurrentSystemStatus = SystemStatus & {+ /**+ * When it was set; absent when no status was ever set. Clients keep the+ * newest status they have seen, whether fetched or pushed.+ */+ updatedAt?: string | null;+};+/*** What settings needs to render the Cursor connection.*@@ -1651,6 +1662,24 @@ export type SsoRequiredResponse = {idp_id: string;};+/**+ * One status a staff member set. The newest is the current status.+ */+export type StatusUpdate = SystemStatus & {+ /**+ * When it was set.+ */+ createdAt: string;+ /**+ * UUIDv7, so ids sort by creation.+ */+ id: string;+ /**+ * The staff member who set it.+ */+ userId: string;+};+/*** Response containing the Stripe session URL*/@@ -1672,6 +1701,35 @@ export type SubscriptionStatus = {scheduledChange?: null | ScheduledSeatPlan;};+/**+ * The platform status. Only the non-operational statuses carry a message.+ */+export type SystemStatus = {+ status: 'operational';+} | {+ /**+ * What users should know.+ */+ message: string;+ status: 'degraded';+} | {+ /**+ * What users should know.+ */+ message: string;+ status: 'major_outage';+};++/**+ * Recent status updates, newest first.+ */+export type SystemStatusHistory = {+ /**+ * The updates.+ */+ updates: Array<StatusUpdate>;+};+/*** The Team struct*/@@ -3606,6 +3664,71 @@ export type SessionLoginResponses = {export type SessionLoginResponse = SessionLoginResponses[keyof SessionLoginResponses];+export type GetSystemStatusData = {+ body?: never;+ path?: never;+ query?: never;+ url: '/system-status';+};++export type GetSystemStatusErrors = {+ 500: ErrorResponse;+};++export type GetSystemStatusError = GetSystemStatusErrors[keyof GetSystemStatusErrors];++export type GetSystemStatusResponses = {+ 200: CurrentSystemStatus;+};++export type GetSystemStatusResponse = GetSystemStatusResponses[keyof GetSystemStatusResponses];++export type SetSystemStatusData = {+ body: SystemStatus;+ path?: never;+ query?: never;+ url: '/system-status';+};++export type SetSystemStatusErrors = {+ 401: ErrorResponse;+ 403: ErrorResponse;+ /**+ * The body is not a valid status+ */+ 422: unknown;+ 500: ErrorResponse;+};++export type SetSystemStatusError = SetSystemStatusErrors[keyof SetSystemStatusErrors];++export type SetSystemStatusResponses = {+ 200: StatusUpdate;+};++export type SetSystemStatusResponse = SetSystemStatusResponses[keyof SetSystemStatusResponses];++export type ListSystemStatusHistoryData = {+ body?: never;+ path?: never;+ query?: never;+ url: '/system-status/history';+};++export type ListSystemStatusHistoryErrors = {+ 401: ErrorResponse;+ 403: ErrorResponse;+ 500: ErrorResponse;+};++export type ListSystemStatusHistoryError = ListSystemStatusHistoryErrors[keyof ListSystemStatusHistoryErrors];++export type ListSystemStatusHistoryResponses = {+ 200: SystemStatusHistory;+};++export type ListSystemStatusHistoryResponse = ListSystemStatusHistoryResponses[keyof ListSystemStatusHistoryResponses];+export type DeleteTeamData = {body?: never;path?: never;diff --git a/packages/sdk/generated/connection/index.ts b/packages/sdk/generated/connection/index.tsindex d0164223c9..e7c4a85af8 100644--- a/packages/sdk/generated/connection/index.ts+++ b/packages/sdk/generated/connection/index.ts@@ -1,4 +1,4 @@// This file is auto-generated by @hey-api/openapi-tsexport { type Options, Sdk } from './sdk.gen';-export type { BatchSendMessageBody, BatchSendMessageHandlerData, BatchSendMessageHandlerError, BatchSendMessageHandlerErrors, BatchSendMessageHandlerResponse, BatchSendMessageHandlerResponses, ClientOptions, Entity, EntityType, GenericErrorResponse, GetEntityHandlerData, GetEntityHandlerError, GetEntityHandlerErrors, GetEntityHandlerResponse, GetEntityHandlerResponses, MessageReceipt, SendMessageBody, SendMessageHandlerData, SendMessageHandlerError, SendMessageHandlerErrors, SendMessageHandlerResponse, SendMessageHandlerResponses, SendMessageResponse, StoredConnectionEntity, StreamEvent, StreamEvents, StreamId, StreamItem, StringIdResponse, ToWebsocketMessage, TrackAction, TrackEntityMessage, UploadFolderStatusUpdate } from './types.gen';+export type { BatchSendMessageBody, BatchSendMessageHandlerData, BatchSendMessageHandlerError, BatchSendMessageHandlerErrors, BatchSendMessageHandlerResponse, BatchSendMessageHandlerResponses, BroadcastMessageHandlerData, BroadcastMessageHandlerError, BroadcastMessageHandlerErrors, BroadcastMessageHandlerResponses, ClientOptions, Entity, EntityType, GenericErrorResponse, GetEntityHandlerData, GetEntityHandlerError, GetEntityHandlerErrors, GetEntityHandlerResponse, GetEntityHandlerResponses, MessageReceipt, SendMessageBody, SendMessageHandlerData, SendMessageHandlerError, SendMessageHandlerErrors, SendMessageHandlerResponse, SendMessageHandlerResponses, SendMessageResponse, StoredConnectionEntity, StreamEvent, StreamEvents, StreamId, StreamItem, StringIdResponse, ToWebsocketMessage, TrackAction, TrackEntityMessage, UploadFolderStatusUpdate } from './types.gen';diff --git a/packages/sdk/generated/connection/sdk.gen.ts b/packages/sdk/generated/connection/sdk.gen.tsindex 05887a5e47..8d50c4d095 100644--- a/packages/sdk/generated/connection/sdk.gen.ts+++ b/packages/sdk/generated/connection/sdk.gen.ts@@ -2,7 +2,7 @@import type { Client, ClientMeta, Options as Options2, RequestResult, TDataShape } from './client';import { client } from './client.gen';-import type { BatchSendMessageHandlerData, BatchSendMessageHandlerErrors, BatchSendMessageHandlerResponses, GetEntityHandlerData, GetEntityHandlerErrors, GetEntityHandlerResponses, SendMessageHandlerData, SendMessageHandlerErrors, SendMessageHandlerResponses } from './types.gen';+import type { BatchSendMessageHandlerData, BatchSendMessageHandlerErrors, BatchSendMessageHandlerResponses, BroadcastMessageHandlerData, BroadcastMessageHandlerErrors, BroadcastMessageHandlerResponses, GetEntityHandlerData, GetEntityHandlerErrors, GetEntityHandlerResponses, SendMessageHandlerData, SendMessageHandlerErrors, SendMessageHandlerResponses } from './types.gen';export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options2<TData, ThrowOnError, TResponse> & {/**@@ -69,6 +69,22 @@ export class Sdk extends HeyApiClient {});}+ /**+ * Sends a message to every open connection on every instance. Delivery is+ * best-effort and asynchronous, so there are no receipts.+ */+ public broadcastMessageHandler<ThrowOnError extends boolean = false>(options: Options<BroadcastMessageHandlerData, ThrowOnError>): RequestResult<BroadcastMessageHandlerResponses, BroadcastMessageHandlerErrors, ThrowOnError> {+ return (options.client ?? this.client).post<BroadcastMessageHandlerResponses, BroadcastMessageHandlerErrors, ThrowOnError>({+ security: [{ name: 'x-internal-auth-key', type: 'apiKey' }],+ url: '/message/broadcast',+ ...options,+ headers: {+ 'Content-Type': 'application/json',+ ...options.headers+ }+ });+ }+public sendMessageHandler<ThrowOnError extends boolean = false>(options: Options<SendMessageHandlerData, ThrowOnError>): RequestResult<SendMessageHandlerResponses, SendMessageHandlerErrors, ThrowOnError> {return (options.client ?? this.client).post<SendMessageHandlerResponses, SendMessageHandlerErrors, ThrowOnError>({security: [{ name: 'x-internal-auth-key', type: 'apiKey' }],diff --git a/packages/sdk/generated/connection/types.gen.ts b/packages/sdk/generated/connection/types.gen.tsindex b5ad410af5..f679fe2f50 100644--- a/packages/sdk/generated/connection/types.gen.ts+++ b/packages/sdk/generated/connection/types.gen.ts@@ -209,6 +209,27 @@ export type BatchSendMessageHandlerResponses = {export type BatchSendMessageHandlerResponse = BatchSendMessageHandlerResponses[keyof BatchSendMessageHandlerResponses];+export type BroadcastMessageHandlerData = {+ body: SendMessageBody;+ path?: never;+ query?: never;+ url: '/message/broadcast';+};++export type BroadcastMessageHandlerErrors = {+ 401: string;+ 500: string;+};++export type BroadcastMessageHandlerError = BroadcastMessageHandlerErrors[keyof BroadcastMessageHandlerErrors];++export type BroadcastMessageHandlerResponses = {+ /**+ * Broadcast accepted+ */+ 202: unknown;+};+export type SendMessageHandlerData = {body: SendMessageBody;path: {diff --git a/packages/sdk/specs/auth.json b/packages/sdk/specs/auth.jsonindex 0572188ec7..125a6f72f1 100644--- a/packages/sdk/specs/auth.json+++ b/packages/sdk/specs/auth.json@@ -3620,6 +3620,145 @@}}},+ "/system-status": {+ "get": {+ "tags": ["system_status"],+ "summary": "The status every user sees. Public: the banner shows wherever the app\nruns, signed in or not.",+ "operationId": "get_system_status",+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/CurrentSystemStatus"+ }+ }+ }+ },+ "500": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ErrorResponse"+ }+ }+ }+ }+ }+ },+ "post": {+ "tags": ["system_status"],+ "summary": "Sets the status every user sees and pushes it to every open app. Macro\nstaff only.",+ "description": "Authenticate with a Macro session, or from a script with a personal API\nkey (Settings → API keys) in the `x-macro-user-api-key` header. The body\nis the new status:\n\n- `{\"status\": \"operational\"}` clears the banner. It takes no message.\n- `{\"status\": \"degraded\", \"message\": \"Search is slow to update.\"}`\n- `{\"status\": \"major_outage\", \"message\": \"Macro is unavailable. We're on it.\"}`\n\nMessages are trimmed and must be 1–500 characters. Every call is kept in\nthe history, even when it repeats the current status.",+ "operationId": "set_system_status",+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/SystemStatus"+ }+ }+ },+ "required": true+ },+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/StatusUpdate"+ }+ }+ }+ },+ "401": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ErrorResponse"+ }+ }+ }+ },+ "403": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ErrorResponse"+ }+ }+ }+ },+ "422": {+ "description": "The body is not a valid status"+ },+ "500": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ErrorResponse"+ }+ }+ }+ }+ }+ }+ },+ "/system-status/history": {+ "get": {+ "tags": ["system_status"],+ "summary": "Recent status updates, newest first, with who set each. Macro staff only.",+ "operationId": "list_system_status_history",+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/SystemStatusHistory"+ }+ }+ }+ },+ "401": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ErrorResponse"+ }+ }+ }+ },+ "403": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ErrorResponse"+ }+ }+ }+ },+ "500": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ErrorResponse"+ }+ }+ }+ }+ }+ }+ },"/team": {"get": {"tags": ["teams::inbound::axum_router::get_team"],@@ -6464,6 +6603,25 @@}}},+ "CurrentSystemStatus": {+ "allOf": [+ {+ "$ref": "#/components/schemas/SystemStatus",+ "description": "The status and its message."+ },+ {+ "type": "object",+ "properties": {+ "updatedAt": {+ "type": ["string", "null"],+ "format": "date-time",+ "description": "When it was set; absent when no status was ever set. Clients keep the\nnewest status they have seen, whether fetched or pushed."+ }+ }+ }+ ],+ "description": "The status every user sees, without who set it."+ },"CursorApiKeyStatus": {"type": "object","description": "What settings needs to render the Cursor connection.\n\nDeliberately thin. `registered` drives the whole UI; `updatedAt` lets it say\nwhen the key was last replaced, which is the only thing a user can check\nagainst their own memory when a session starts failing.\n\nDeliberately *not* reporting anything about the deployment itself. That is\noperator information: a user who sees it cannot act on it, and a service\nthat cannot reach KMS does not start.",@@ -8139,6 +8297,35 @@}}},+ "StatusUpdate": {+ "allOf": [+ {+ "$ref": "#/components/schemas/SystemStatus",+ "description": "The status that was set."+ },+ {+ "type": "object",+ "required": ["id", "userId", "createdAt"],+ "properties": {+ "createdAt": {+ "type": "string",+ "format": "date-time",+ "description": "When it was set."+ },+ "id": {+ "type": "string",+ "format": "uuid",+ "description": "UUIDv7, so ids sort by creation."+ },+ "userId": {+ "type": "string",+ "description": "The staff member who set it."+ }+ }+ }+ ],+ "description": "One status a staff member set. The newest is the current status."+ },"StripeSessionResponse": {"type": "object","description": "Response containing the Stripe session URL",@@ -8172,6 +8359,66 @@}}},+ "SystemStatus": {+ "oneOf": [+ {+ "type": "object",+ "description": "Everything works; no banner is shown.",+ "required": ["status"],+ "properties": {+ "status": {+ "type": "string",+ "enum": ["operational"]+ }+ }+ },+ {+ "type": "object",+ "description": "Some features are slow or failing.",+ "required": ["message", "status"],+ "properties": {+ "message": {+ "type": "string",+ "description": "What users should know."+ },+ "status": {+ "type": "string",+ "enum": ["degraded"]+ }+ }+ },+ {+ "type": "object",+ "description": "Macro is largely unavailable.",+ "required": ["message", "status"],+ "properties": {+ "message": {+ "type": "string",+ "description": "What users should know."+ },+ "status": {+ "type": "string",+ "enum": ["major_outage"]+ }+ }+ }+ ],+ "description": "The platform status. Only the non-operational statuses carry a message."+ },+ "SystemStatusHistory": {+ "type": "object",+ "description": "Recent status updates, newest first.",+ "required": ["updates"],+ "properties": {+ "updates": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/StatusUpdate"+ },+ "description": "The updates."+ }+ }+ },"Team": {"type": "object","description": "The Team struct",diff --git a/packages/sdk/specs/connection.json b/packages/sdk/specs/connection.jsonindex b703288b7a..e3f084a3e2 100644--- a/packages/sdk/specs/connection.json+++ b/packages/sdk/specs/connection.json@@ -53,6 +53,53 @@]}},+ "/message/broadcast": {+ "post": {+ "tags": ["message"],+ "summary": "Sends a message to every open connection on every instance. Delivery is\nbest-effort and asynchronous, so there are no receipts.",+ "operationId": "broadcast_message_handler",+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/SendMessageBody"+ }+ }+ },+ "required": true+ },+ "responses": {+ "202": {+ "description": "Broadcast accepted"+ },+ "401": {+ "description": "",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "500": {+ "description": "",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ }+ },+ "security": [+ {+ "internal-api-key": []+ }+ ]+ }+ },"/message/send/{entity_type}/{entity_id}": {"post": {"tags": ["message"],diff --git a/packages/sdk/src/coverage/skipped.ts b/packages/sdk/src/coverage/skipped.tsindex 0888096efa..1bb58a6a73 100644--- a/packages/sdk/src/coverage/skipped.ts+++ b/packages/sdk/src/coverage/skipped.ts@@ -81,6 +81,7 @@ export const authExcluded = ['getSubscriptionStatus','getTeamByInviteLink','getTeamInviteLink',+ 'getSystemStatus','getTeamInvites',// Introductory offers belong to the app's subscription checkout flow.'getTrialEligibility',@@ -103,6 +104,7 @@ export const authExcluded = ['listCodexEnvironments','listCursorModels','listGtmInviteLinks',+ 'listSystemStatusHistory','logout','mergeGithubPullRequest','oauth2Callback',@@ -137,6 +139,7 @@ export const authExcluded = ['sessionLogin','setGithubPullRequestDraft','setGithubPullRequestState',+ 'setSystemStatus','ssoLogin','startCodexLogin','toggleTeamAutoJoinDomain',@@ -212,6 +215,7 @@ export const cognitionBacklog =export const connectionExcluded = ['batchSendMessageHandler',+ 'broadcastMessageHandler','getEntityHandler','sendMessageHandler',] as const satisfies readonly (keyof ConnectionSdk)[];diff --git a/services/authentication_service/AGENTS.md b/services/authentication_service/AGENTS.mdindex 167542f693..91673670d4 100644--- a/services/authentication_service/AGENTS.md+++ b/services/authentication_service/AGENTS.md@@ -22,7 +22,8 @@ key issuance, and account merge/link flows.## Scope- Owns: FusionAuth-backed login/session issuance, JWT minting, signup- allowlisting, OAuth/OAuth2 account linking, GTM invite links, shared-mailbox+ allowlisting, OAuth/OAuth2 account linking, GTM invite links, the platform+ status banner API (`crates/system_status`), shared-mailboxrelocation signup, Cursor/Codex API key endpoints, introductory trialeligibility and subscription checkout.- Not here: authorization/permission decisions on other entities →diff --git a/services/authentication_service/Cargo.toml b/services/authentication_service/Cargo.tomlindex 25900278db..f863de450d 100644--- a/services/authentication_service/Cargo.toml+++ b/services/authentication_service/Cargo.toml@@ -169,6 +169,11 @@ sqs_client = { path = "../../crates/sqs_client", default-features = false, featu"search",] }strum = { workspace = true }+system_status = { path = "../../crates/system_status", features = [+ "connection_gateway",+ "inbound",+ "postgres",+] }teams = { path = "../../crates/teams" }thiserror = { workspace = true }time = { workspace = true }diff --git a/services/authentication_service/src/api.rs b/services/authentication_service/src/api.rsindex 0910521967..fffa988ce7 100644--- a/services/authentication_service/src/api.rs+++ b/services/authentication_service/src/api.rs@@ -162,6 +162,15 @@ fn api_router(state: ApiContext) -> Router<ApiContext> {},),)+ .nest(+ "/system-status",+ system_status::inbound::axum_router::system_status_router(+ system_status::inbound::axum_router::SystemStatusRouterState {+ service: state.system_status_service.clone(),+ authorization_state: state.authorization_state.clone(),+ },+ ),+ ).nest("/jwt", jwt::router()).nest("/session", session::router()).merge(ai_billing::inbound::ai_billing_router(diff --git a/services/authentication_service/src/api/context.rs b/services/authentication_service/src/api/context.rsindex bcaef18aa6..5dc8019afc 100644--- a/services/authentication_service/src/api/context.rs+++ b/services/authentication_service/src/api/context.rs@@ -55,6 +55,13 @@ use roles_and_permissions::{domain::service::UserRolesAndPermissionsServiceImpl, outbound::pgpool::MacroDB,};use sqlx::PgPool;+use system_status::{+ domain::service::SystemStatusServiceImpl,+ outbound::{+ connection_gateway_broadcaster::ConnectionGatewayStatusBroadcaster,+ pg_system_status_repo::PgSystemStatusRepo,+ },+};use tokio_util::task::TaskTracker;use user_language::{domain::service::UserLanguageServiceImpl, outbound::pg_user_language_repo::PgUserLanguageRepo,@@ -137,6 +144,8 @@ pub(crate) type ReferralServiceType = ReferralServiceImpl<pub(crate) type GtmInviteServiceType = GtmInviteServiceImpl<PgGtmInviteRepo>;pub(crate) type UserLanguageServiceType = UserLanguageServiceImpl<PgUserLanguageRepo>;+pub(crate) type SystemStatusServiceType =+ SystemStatusServiceImpl<PgSystemStatusRepo, ConnectionGatewayStatusBroadcaster>;pub(crate) type GithubLinkServiceType = GithubLinkServiceImpl<PgGithubRepo,@@ -235,6 +244,7 @@ pub(crate) struct ApiContext {pub referral_service: Arc<ReferralServiceType>,pub gtm_invite_service: Arc<GtmInviteServiceType>,pub user_language_service: Arc<UserLanguageServiceType>,+ pub system_status_service: Arc<SystemStatusServiceType>,pub rate_limit_service: RateLimiter,/// The stripe price ids for each paid plan's seatpub stripe_prices: crate::api::user::stripe::StripePrices,diff --git a/services/authentication_service/src/api/swagger.rs b/services/authentication_service/src/api/swagger.rsindex ab1999398f..732a503414 100644--- a/services/authentication_service/src/api/swagger.rs+++ b/services/authentication_service/src/api/swagger.rs@@ -13,6 +13,8 @@ use gtm_invite::inbound::axum_router::dto::{GtmInviteOffer, GtmInviteOfferStatus, PublicGtmInviteLink, RedeemGtmInviteLinkRequest,};use model::authentication::login::request::{AppleLoginRequest, PasswordRequest};+use system_status::domain::models::{CurrentSystemStatus, StatusUpdate, SystemStatus};+use system_status::inbound::axum_router::SystemStatusHistory;use teams::domain::model::{PatchTeamCrmSettingsRequest, PatchTeamCrmSettingsResponse, PatchTeamMemberPlanRequest,PatchTeamRequest, PatchTeamUserRole, Team, TeamInviteDetails, TeamInviteLinkTeam,@@ -216,6 +218,11 @@ use model::user::{gtm_invite::inbound::axum_router::redeem_link::handler::<crate::api::context::GtmInviteServiceType, crate::api::context::RateLimiter, crate::api::context::AuthorizationService>,gtm_invite::inbound::axum_router::get_offer::handler::<crate::api::context::GtmInviteServiceType, crate::api::context::RateLimiter, crate::api::context::AuthorizationService>,+ /// /system-status+ system_status::inbound::axum_router::get_current::handler::<crate::api::context::SystemStatusServiceType, crate::api::context::AuthorizationService>,+ system_status::inbound::axum_router::set_status::handler::<crate::api::context::SystemStatusServiceType, crate::api::context::AuthorizationService>,+ system_status::inbound::axum_router::list_history::handler::<crate::api::context::SystemStatusServiceType, crate::api::context::AuthorizationService>,+/// /mobile-welcome-emailmobile_welcome_email::handler,@@ -271,6 +278,12 @@ use model::user::{GtmInviteOffer,GtmInviteOfferStatus,+ // System status+ SystemStatus,+ CurrentSystemStatus,+ StatusUpdate,+ SystemStatusHistory,+// Plans and AI billingPaidPlan,ChangePlanRequest,diff --git a/services/authentication_service/src/server.rs b/services/authentication_service/src/server.rsindex 1d79239bf0..14d681c6dd 100644--- a/services/authentication_service/src/server.rs+++ b/services/authentication_service/src/server.rs@@ -78,6 +78,13 @@ use referral::{domain::service::ReferralServiceImpl,outbound::{pg_referral_repo::PgReferralRepo, stripe_discount_client::StripeDiscountClient},};+use system_status::{+ domain::service::SystemStatusServiceImpl,+ outbound::{+ connection_gateway_broadcaster::ConnectionGatewayStatusBroadcaster,+ pg_system_status_repo::PgSystemStatusRepo,+ },+};use user_language::{domain::service::UserLanguageServiceImpl, outbound::pg_user_language_repo::PgUserLanguageRepo,};@@ -477,7 +484,7 @@ pub async fn run() -> anyhow::Result<()> {entity_access_service_impl.clone(),),messages::outbound::connection_gateway::ConnectionGatewayMessages(- connection_gateway_client,+ connection_gateway_client.clone(),),channels::outbound::pg_agent_creations::PgAgentCreations::new(db.clone()),),@@ -537,6 +544,10 @@ pub async fn run() -> anyhow::Result<()> {repo: PgGtmInviteRepo::new(db.clone()),config: gtm_invite_config,};+ let system_status_service = Arc::new(SystemStatusServiceImpl::new(+ PgSystemStatusRepo::new(db.clone()),+ ConnectionGatewayStatusBroadcaster::new(connection_gateway_client.clone()),+ ));let codex_connection = if let Some(key_id) = config.codex_oauth_kms_key_id() {let cipher = Arc::new(codex_connection::outbound::cipher::EnvelopeCipher::new(@@ -769,6 +780,7 @@ pub async fn run() -> anyhow::Result<()> {referral_service: Arc::new(referral_service),user_language_service,gtm_invite_service,+ system_status_service,native_app_service: Arc::new(NativeAppServiceImpl {bundle_fetcher: DefaultBundleFetcher::new(AppServiceUrl::new_for_environment(config.environment)diff --git a/services/connection_gateway/AGENTS.md b/services/connection_gateway/AGENTS.mdindex adbe845def..9fed660144 100644--- a/services/connection_gateway/AGENTS.md+++ b/services/connection_gateway/AGENTS.md@@ -9,8 +9,8 @@ the socket themselves.## Start here- `src/api/connection.rs`: WebSocket upgrade endpoint and connection lifecycle.-- `src/api/message.rs`: HTTP endpoint other services call to send a message to- a connected entity.+- `src/api/message.rs`: HTTP endpoints other services call to send a message to+ a connected entity, or (`/message/broadcast`) to every open connection.- `src/service/connection.rs` + `src/service/dynamodb.rs`: connection registry,backed by DynamoDB (tracks which entity is on which instance).- `src/service/sender.rs` + `src/service/redis.rs`: cross-instance message@@ -63,6 +63,10 @@ the socket themselves.after its last `open` or `ping`, compared across instances' clocks. A `ping`for a row that is gone re-creates it, so a lost `open` heals on the nextheartbeat.+- Broadcasts use their own Redis channel (`BROADCAST_CHANNEL`): each instance+ forwards them to every connection it holds, with no DynamoDB lookup and no+ receipts. Keep them rare (e.g. the platform status banner); a broadcast is+ one message per open tab.## Relateddiff --git a/services/connection_gateway/src/api/message.rs b/services/connection_gateway/src/api/message.rsindex bc6f0c4828..ec604e78cb 100644--- a/services/connection_gateway/src/api/message.rs+++ b/services/connection_gateway/src/api/message.rs@@ -1,7 +1,7 @@use crate::{context::{AppState, AuthorizationService},model::message::Message,- service::sender::send_message_to_entity,+ service::{redis::post_broadcast, sender::send_message_to_entity},};use axum::{Json as JsonResponse, Router,@@ -30,9 +30,48 @@ where"/batch_send_unique",post(batch_send_unique_messages_handler),)+ .route("/broadcast", post(broadcast_message_handler)).with_state(state)}+/// Sends a message to every open connection on every instance. Delivery is+/// best-effort and asynchronous, so there are no receipts.+#[utoipa::path(+ post,+ path = "/message/broadcast",+ security(("internal-api-key" = [])),+ request_body = SendMessageBody,+ responses(+ (status = 202, description = "Broadcast accepted"),+ (status = 401, body = String),+ (status = 500, body = String),+ )+)]+#[tracing::instrument(+ skip(_internal_authorization, ctx, body),+ fields(message_type = %body.message_type),+ err(Debug)+)]+pub async fn broadcast_message_handler(+ _internal_authorization: MacroAuthorizationExtractor<AuthorizationService, InternalOnly>,+ State(ctx): State<AppState>,+ Json(body): Json<SendMessageBody>,+) -> Result<StatusCode, (StatusCode, String)> {+ post_broadcast(+ ctx.context.redis_connection.clone(),+ Message::new(body.message_type, body.message.to_string()),+ )+ .await+ .map_err(|_| {+ (+ StatusCode::INTERNAL_SERVER_ERROR,+ "unable to broadcast message".to_string(),+ )+ })?;++ Ok(StatusCode::ACCEPTED)+}+#[utoipa::path(post,path = "/message/send/{entity_type}/{entity_id}",diff --git a/services/connection_gateway/src/api/swagger.rs b/services/connection_gateway/src/api/swagger.rsindex 5be3c070a7..b06ceba4f6 100644--- a/services/connection_gateway/src/api/swagger.rs+++ b/services/connection_gateway/src/api/swagger.rs@@ -37,6 +37,7 @@ impl Modify for SecurityAddon {paths(message::send_message_handler,message::batch_send_message_handler,+ message::broadcast_message_handler,entities::get_entity_handler,),components(diff --git a/services/connection_gateway/src/api/test.rs b/services/connection_gateway/src/api/test.rsindex c5f94bf887..67dc97ea7e 100644--- a/services/connection_gateway/src/api/test.rs+++ b/services/connection_gateway/src/api/test.rs@@ -95,6 +95,10 @@ fn test_router() -> Router {"/message/batch_send_unique",post(message::batch_send_unique_messages_handler),)+ .route(+ "/message/broadcast",+ post(message::broadcast_message_handler),+ ).route("/track/{entity_type}/{entity_id}",get(entities::get_entity_handler),@@ -132,6 +136,7 @@ async fn internal_routes_reject_missing_and_incorrect_keys_before_other_extracti(Method::POST, "/message/send/user/macro%[email protected]"),(Method::POST, "/message/batch_send"),(Method::POST, "/message/batch_send_unique"),+ (Method::POST, "/message/broadcast"),(Method::GET, "/track/user/macro%[email protected]"),];diff --git a/services/connection_gateway/src/service/redis.rs b/services/connection_gateway/src/service/redis.rsindex 4630812b16..90939c7a84 100644--- a/services/connection_gateway/src/service/redis.rs+++ b/services/connection_gateway/src/service/redis.rs@@ -12,6 +12,8 @@ use crate::{};pub const REDIS_CHANNEL: &str = "connection_gateway.messages";+/// Carries messages for every connection on every instance.+pub const BROADCAST_CHANNEL: &str = "connection_gateway.broadcast";#[derive(serde::Serialize, serde::Deserialize)]pub struct MessageWithConnection {@@ -53,6 +55,34 @@ pub async fn post_message(result}+/// Publishes a message for every connection on every instance of the+/// connection gateway, including this one: each instance forwards it to the+/// connections it holds.+pub async fn post_broadcast(mut connection: MultiplexedConnection, message: Message) -> Result<()> {+ let span = tracing::info_span!(+ "connection_gateway.redis_broadcast_publish",+ otel.kind = "producer",+ message_type = %message.message_type,+ otel.status_code = tracing::field::Empty,+ otel.status_description = tracing::field::Empty,+ );+ let result = async {+ let message_json = serde_json::to_string(&message.with_current_trace_context())+ .context("Failed to serialize message")?;++ connection+ .publish::<&str, &str, ()>(BROADCAST_CHANNEL, message_json.as_str())+ .await+ .context("Failed to publish message")+ }+ .instrument(span.clone())+ .await;+ if let Err(error) = &result {+ record_span_error(&span, error);+ }+ result+}+impl FromRedisValue for MessageWithConnection {fn from_redis_value(v: redis::Value) -> Result<Self, ParsingError> {match v {@@ -109,12 +139,19 @@ async fn subscribe_and_forward(ctx: &ApiContext) -> Result<()> {.await.context("failed to open redis pub/sub connection")?.split();- sink.subscribe(REDIS_CHANNEL)+ sink.subscribe(&[REDIS_CHANNEL, BROADCAST_CHANNEL]).await- .context("failed to subscribe to redis relay channel")?;- tracing::info!(channel = REDIS_CHANNEL, "subscribed to redis relay channel");+ .context("failed to subscribe to redis relay channels")?;+ tracing::info!(+ channels = ?[REDIS_CHANNEL, BROADCAST_CHANNEL],+ "subscribed to redis relay channels"+ );while let Some(maybe_message) = stream.next().await {+ if maybe_message.get_channel_name() == BROADCAST_CHANNEL {+ forward_broadcast(ctx, maybe_message.get_payload_bytes()).await;+ continue;+ }let mut message: MessageWithConnection =match maybe_message.get_payload::<MessageWithConnection>() {Ok(msg) => msg,@@ -165,3 +202,45 @@ async fn subscribe_and_forward(ctx: &ApiContext) -> Result<()> {Ok(())}++/// Forwards a broadcast message to every connection this instance holds.+async fn forward_broadcast(ctx: &ApiContext, payload: &[u8]) {+ let mut message: Message = match serde_json::from_slice(payload) {+ Ok(message) => message,+ Err(err) => {+ tracing::error!(error=?err, "failed to parse broadcast message");+ return;+ }+ };++ // Collected first so no map shard lock is held across a send.+ let connection_ids: Vec<String> = ctx+ .connection_manager+ .connections+ .iter()+ .map(|entry| entry.key().clone())+ .collect();+ let span = tracing::info_span!(+ "connection_gateway.redis_broadcast_dispatch",+ otel.kind = "consumer",+ message_type = %message.message_type,+ connection_count = connection_ids.len(),+ failed_count = tracing::field::Empty,+ );+ if let Some(parent) = message.remote_trace_context() {+ let _ = span.set_parent(parent);+ }+ async {+ message = message.with_current_trace_context();+ // A refused send drops only that connection; the rest still get it.+ let results = futures::future::join_all(connection_ids.iter().map(|id| {+ ctx.connection_manager+ .send_message(id.as_str(), message.clone())+ }))+ .await;+ let failed_count = results.iter().filter(|result| result.is_err()).count();+ tracing::Span::current().record("failed_count", failed_count as u64);+ }+ .instrument(span)+ .await;+}