import { f as TangleExecutionEnvironment, j as TangleExecutionKeySource } from '../model-dF2h4xT9.js';
import { PlatformIdentity, PlatformBillingClient } from '../billing/index.js';

/**
 * Cross-site Tangle SSO for agent apps: signed-state CSRF cookies plus the
 * full start/callback orchestration against the platform's /cross-site
 * bridge. The platform wire client and account persistence are structural
 * seams (`TangleSsoAuthClient` / `TangleSsoAccountStore`), so this module
 * never imports agent-runtime, an auth framework, or a database driver.
 * WebCrypto only — runs in workerd without node compatibility flags.
 */
interface SsoStateConfig {
    /** HMAC-SHA256 secret (e.g. the app's auth secret). */
    secret: string;
    /** State lifetime in ms. Default 600 000. */
    ttlMs?: number;
    /** Injectable clock (ms since epoch). Default Date.now. */
    now?: () => number;
}
/** Mint a `<randomHex32>.<timestamp36>.<hmacHex>` state value. The timestamp
 *  is inside the signed payload, so expiry survives cookie-attribute tampering. */
declare function createSignedSsoState(config: SsoStateConfig): Promise<string>;
/** Verify the MAC (constant-time) and the signed TTL. */
declare function verifySignedSsoState(state: string, config: SsoStateConfig): Promise<boolean>;
interface TangleSsoExchangeResult {
    apiKey: string;
    user: {
        id: string;
        email: string;
        name?: string | null;
    };
    plan?: {
        tier: string;
    } | null;
}
/** Structural mirror of the platform auth wire client — any object with these
 *  two methods satisfies it without this module importing the concrete class. */
interface TangleSsoAuthClient {
    authorizeUrl(options: {
        state: string;
        redirectUri?: string;
    }): string;
    exchange(code: string): Promise<TangleSsoExchangeResult>;
}
/** Thrown by `upsertUserByEmail` when the app-local user row cannot be
 *  created; the callback handler maps it to `?error=tangle_user_create_failed`.
 *  Any other store error propagates. */
declare class TangleSsoUserCreateError extends Error {
    constructor(message?: string);
}
/**
 * Account persistence seam. Covers both storage styles in use: link-table
 * apps (a per-user platform-link row) and session-column apps (the key on the
 * session row) — `saveTangleLink` receives both `userId` and `sessionToken`,
 * and each app persists with the key it needs. `createSession` runs first so
 * the token is always available to `saveTangleLink`.
 */
interface TangleSsoAccountStore {
    /** Find-or-create the app-local user. `tangleUserId` is the platform's
     *  stable user id — match on it first when the app stores it (emails are
     *  mutable on the platform; the id is not), falling back to email for
     *  first-time logins. */
    upsertUserByEmail(input: {
        email: string;
        name: string | null;
        tangleUserId: string;
    }): Promise<{
        userId: string;
    }>;
    /** Create an app session row; returns the session-cookie token value. */
    createSession(input: {
        userId: string;
        expiresAt: Date;
        ipAddress: string | null;
        userAgent: string | null;
    }): Promise<{
        token: string;
    }>;
    /** Persist the platform link (API key + platform identity). */
    saveTangleLink(input: {
        userId: string;
        sessionToken: string;
        tangleUserId: string;
        email: string;
        name: string | null;
        apiKey: string;
        planTier: string | null;
    }): Promise<void>;
}
/** Successful-login context handed to the `setSessionCookie` seam. */
interface TangleSsoSessionCookieArgs {
    /** Session token returned by `store.createSession`. */
    token: string;
    /** Session expiry (now + `sessionTtlSeconds`). */
    expiresAt: Date;
    /** Mirrors `sessionTtlSeconds` after defaulting. */
    ttlSeconds: number;
    /** Mirrors `TangleSsoHandlerOptions.secureCookies`. */
    secure: boolean;
}
/**
 * Sign a session token to better-call's signed-cookie contract — the value
 * better-auth's `getSignedCookie` verifies: `<token>.<signature>` where the
 * signature is the raw HMAC-SHA256 of the token under `secret`, encoded as
 * STANDARD base64 WITH padding (32 bytes → 44 chars ending `=`; better-call
 * rejects any other length or suffix, so url-safe/unpadded variants read back
 * as a null session). The joined value is percent-encoded once at cookie
 * serialization, matching better-call's `serializeSignedCookie` byte-exactly.
 */
declare function signSessionCookieValue(token: string, secret: string): Promise<string>;
/** Structural slice of a `betterAuth()` instance — only what cookie minting
 *  reads. No better-auth import: the signing contract is implemented by
 *  `signSessionCookieValue`, byte-compatible with better-auth's own
 *  `makeSignature`. */
interface BetterAuthSessionCookieSource {
    $context: PromiseLike<{
        secret: string;
        authCookies: {
            sessionToken: {
                /** Final cookie name — better-auth decides the `__Secure-` prefix
                 *  (and any `advanced.cookiePrefix`) once at `betterAuth()` init. */
                name: string;
                attributes: {
                    secure?: boolean;
                    sameSite?: string;
                    path?: string;
                    httpOnly?: boolean;
                    domain?: string;
                };
            };
        };
    }>;
}
interface BetterAuthSessionCookieMinterOptions {
    /** Receives the shadowed-cookie-name warning (see below). Default
     *  console.warn. */
    warn?: (message: string) => void;
}
/**
 * Canonical `setSessionCookie` wiring for better-auth apps: mint the session
 * Set-Cookie exactly as better-auth's own login flows do — name + attributes
 * from `auth.$context.authCookies.sessionToken` (better-auth stays
 * authoritative over prefix/name/attributes) and the value signed to
 * better-call's `getSignedCookie` contract. A raw unprefixed
 * `better-auth.session_token` left by an earlier login is explicitly expired
 * so it cannot shadow the real cookie.
 *
 * Warns when the app's session cookie still has better-auth's DEFAULT name:
 * the Tangle platform (id.tangle.tools) sets a `Domain=.tangle.tools` cookie
 * under that exact name, and equal-path cookies are sent oldest-first — the
 * platform's cookie is always older (the user signs in there before the app's
 * callback runs), so the app reads the platform's token, fails its own
 * signature check, and every fresh login lands logged-out. Per-app
 * `advanced.cookiePrefix` is the fix.
 *
 * Throws on a domain-scoped session cookie for the same reason: a
 * `Domain=`-wide session cookie is exactly the shadowing footgun.
 */
declare function createBetterAuthSessionCookieMinter(auth: BetterAuthSessionCookieSource, options?: BetterAuthSessionCookieMinterOptions): (args: TangleSsoSessionCookieArgs) => Promise<string[]>;
interface TangleSsoHandlerOptions {
    auth: TangleSsoAuthClient;
    store: TangleSsoAccountStore;
    /** HMAC secret for the state cookie. */
    stateSecret: string;
    /** Absolute callback URL registered with the platform. */
    callbackUrl: string;
    stateCookieName: string;
    /** Default 'better-auth.session_token'. Ignored when `setSessionCookie` is
     *  provided. The default path prepends `__Secure-` iff `secureCookies`. */
    sessionCookieName?: string;
    /** Mint the host auth framework's own session cookie(s); return complete
     *  Set-Cookie header values (the handler appends them verbatim and sets no
     *  session cookie itself). Supply this when the framework should stay
     *  authoritative over name/prefix/signing/attributes — e.g. better-auth:
     *  `auth.$context.authCookies.sessionToken` + `makeSignature`. */
    setSessionCookie?: (args: TangleSsoSessionCookieArgs) => readonly string[] | Promise<readonly string[]>;
    /** HMAC-SHA256 secret the host auth framework verifies session cookies with
     *  (better-auth: its `secret`). Required when `setSessionCookie` is absent —
     *  the default cookie is minted to better-call's signed contract via
     *  `signSessionCookieValue`; an unsigned or mis-signed value reads back as a
     *  null session, so there is deliberately no fallback to `stateSecret`
     *  (which is not guaranteed to be the auth secret). */
    sessionCookieSecret?: string;
    /** Adds `Secure` to every cookie this module sets, and (default session
     *  cookie only) the `__Secure-` name prefix. Must match the auth
     *  framework's own secure-cookie decision (better-auth: https `baseURL` /
     *  `advanced.useSecureCookies`), or it will look up a different cookie name
     *  than the one set here. */
    secureCookies: boolean;
    /** Default 604 800 (7 days). */
    sessionTtlSeconds?: number;
    /** Default 600. Applies to both the cookie Max-Age and the signed TTL. */
    stateTtlSeconds?: number;
    /** Default '/app'. */
    defaultRedirectPath?: string;
    /** Default '/login'. */
    loginPath?: string;
    /** Failure log hook (e.g. console.error). Default no-op. */
    log?: (message: string, error?: unknown) => void;
    now?: () => number;
}
interface TangleSsoHandlers {
    /** GET start route: mint + sign state, set the state cookie, 302 to the
     *  platform authorize URL. `?redirect=` carries the post-login path. */
    start(request: Request): Promise<Response>;
    /** GET callback route: verify state, exchange the code, upsert the user,
     *  create the session, save the platform link, set the session cookie
     *  (via the `setSessionCookie` seam, else signed to better-call's contract
     *  with `sessionCookieSecret`), 302 to the saved redirect. Every failure
     *  302s to `loginPath?error=…` with the state cookie cleared. */
    callback(request: Request): Promise<Response>;
}
declare function createTangleSsoHandlers(opts: TangleSsoHandlerOptions): TangleSsoHandlers;

/**
 * Integrations-hub proxy routes: the app-side surface that forwards an
 * authenticated user's requests to the platform's `/v1/integrations/*` API
 * using their stored platform key. Auth, key lookup, and the wire client are
 * structural seams (`HubProxyContext`); error detection is by name + shape so
 * it survives bundlers duplicating module instances.
 */

/** Hub bearer provenance mirrors the execution-key source union. */
type TangleHubBearerSource = TangleExecutionKeySource;
interface ResolvedTangleHubBearer {
    bearer: string;
    source: TangleHubBearerSource;
}
interface ResolveUserTangleHubBearerOptions {
    userId: string;
    /** Deployment context. Only local development may use env credentials. */
    environment?: TangleExecutionEnvironment;
    /** Env to read for the local-development bearer. */
    env?: Record<string, string | undefined>;
    /** App-owned lookup for the caller's linked platform API key. */
    getUserApiKey: () => string | null | undefined | Promise<string | null | undefined>;
}
interface ResolveUserTangleHubBearerForUserOptions<UserId = string> {
    userId: UserId;
    environment?: TangleExecutionEnvironment;
    env?: Record<string, string | undefined>;
    getUserApiKey: (userId: UserId) => string | null | undefined | Promise<string | null | undefined>;
}
declare class TangleBearerMissingError extends Error {
    readonly userId: string;
    constructor(userId: string);
}
/**
 * Resolve the Tangle bearer used by the integration hub proxy.
 *
 * Local development may use a server env key so apps can exercise the hub
 * without completing cross-site SSO. Deployed contexts must use the caller's
 * linked platform key; this keeps integration ownership aligned with the user.
 */
declare function resolveUserTangleHubBearer(opts: ResolveUserTangleHubBearerOptions): Promise<ResolvedTangleHubBearer>;
declare function resolveUserTangleHubBearerForUser<UserId = string>(opts: ResolveUserTangleHubBearerForUserOptions<UserId>): Promise<ResolvedTangleHubBearer>;
/** Structural guard (name + userId shape) — robust when the error class is
 *  constructed in a different module instance than the one checking it. */
declare function isTangleBearerMissingError(error: unknown): error is TangleBearerMissingError;
/** Structural detection of the platform hub wire error (name + numeric status). */
declare function isPlatformHubErrorLike(error: unknown): error is Error & {
    status: number;
    code?: string;
};
/** Structural subset of the platform hub wire client — extra methods are fine. */
interface HubClientLike {
    catalog(): Promise<unknown>;
    listConnections(): Promise<unknown>;
    revokeConnection(connectionId: string): Promise<unknown>;
    startAuth(input: {
        providerId: string;
        connectorId: string;
        returnUrl: string;
        requestedScopes?: string[];
    }): Promise<{
        authorizationUrl: string;
        state: string;
    }>;
    listHealthchecks(): Promise<unknown>;
}
interface HubProxyContext {
    /** Resolve the authenticated user id. Throw the app's own auth Response /
     *  redirect to reject — it propagates untouched. */
    requireUserId(request: Request): Promise<string>;
    /** The user's platform bearer; throw `TangleBearerMissingError` when unlinked. */
    getBearer(userId: string): Promise<string>;
    /** A hub client bound to the bearer. */
    createHubClient(bearer: string): HubClientLike;
}
interface HubProxyRouteArgs {
    request: Request;
    params?: Record<string, string | undefined>;
}
interface HubProxyRoutes {
    /** GET → `{ catalog }`. */
    catalog(args: HubProxyRouteArgs): Promise<Response>;
    /** GET → `{ connections }`. */
    connections(args: HubProxyRouteArgs): Promise<Response>;
    /** DELETE → the platform revocation result verbatim; 405 otherwise. */
    connectionDelete(args: {
        request: Request;
        params: {
            connectionId: string;
        };
    }): Promise<Response>;
    /** GET → `{ healthchecks }`. */
    healthchecks(args: HubProxyRouteArgs): Promise<Response>;
    /** POST `{ providerId, connectorId, returnUrl, requestedScopes? }` →
     *  `{ authorizationUrl, state }`; 405 non-POST; 400 on bad JSON / missing fields. */
    authStart(args: HubProxyRouteArgs): Promise<Response>;
}
declare function createHubProxyRoutes(ctx: HubProxyContext): HubProxyRoutes;

/**
 * Platform billing HTTP transport + tier state for apps on the shared
 * Tangle balance model (id.tangle.tools). Reads authenticate as the user via
 * their per-user platform key (the platform resolves the caller from the
 * key; service or impersonation headers on read routes are rejected). The
 * deduct write authenticates as the product service (`Bearer <serviceToken>`
 * + `X-Service-Name`) and names the target user in the body. Also provides a
 * fetch-backed implementation of the `/billing` module's
 * `PlatformBillingClient` seam (type-only import — no runtime coupling).
 */

type TanglePlanTier = 'free' | 'pro' | 'enterprise';
/** 'pro' | 'enterprise' pass through; anything else (null, unknown) → 'free'. */
declare function normalizeTanglePlanTier(plan: string | null | undefined): TanglePlanTier;
declare class PlatformBillingHttpError extends Error {
    readonly status: number;
    constructor(status: number, detail: string);
}
/** Structural guard (name + numeric status) — robust across module instances. */
declare function isPlatformBillingHttpError(error: unknown): error is PlatformBillingHttpError;
interface PlatformBillingHttpOptions {
    /** Platform root, e.g. https://id.tangle.tools (trailing slashes stripped). */
    baseUrl: string;
    /** Used only by `deduct()`; resolved lazily so reads never require it.
     *  Throws at call time when empty. */
    serviceToken: string | (() => string);
    /** Product slug — the `X-Service-Name` header and the deduct `product` field. */
    productSlug: string;
    fetchImpl?: typeof fetch;
    /** Default 10 000. */
    timeoutMs?: number;
}
interface PlatformSubscriptionInfo {
    tier: TanglePlanTier;
    status: string | null;
}
interface PlatformBalanceSnapshot {
    balance: number;
    lifetimeSpent: number;
    updatedAt?: string;
}
interface PlatformUsageProductRow {
    product: string | null;
    totalSpent: number;
    count: number;
}
/** Lifecycle of a per-product seat subscription, mirroring the Stripe states
 *  the platform persists. 'none' = the user has never held this seat. */
type SeatStatus = 'none' | 'active' | 'trialing' | 'past_due' | 'canceled';
/**
 * Per-product entitlement snapshot from the platform — the single read that
 * tells a product whether to show its workspace or the seat paywall. Shape
 * matches `GET /v1/billing/product-entitlement?product=<id>`.
 *
 * `hasSeat` and `onFreeTier` are computed platform-side from the raw seat row
 * + cumulative spend so the gate is identical across all five products:
 * - `hasSeat`     — an active/trialing seat whose period has not lapsed.
 * - `onFreeTier`  — no active seat AND cumulative spend below the free cap
 *                   ($2 / 200¢ lifetime). Keys off lifetime spend, not wallet
 *                   balance, so a router top-up never re-opens free access.
 */
interface ProductEntitlement {
    seatStatus: SeatStatus;
    /** ISO timestamp the active seat's paid period runs until; null when none. */
    currentPeriodEnd: string | null;
    /** Cumulative inference spend across the whole suite, in dollars. */
    lifetimeSpentUsd: number;
    hasSeat: boolean;
    onFreeTier: boolean;
}
interface PlatformBillingHttp {
    /** GET /v1/plans/current (user bearer). */
    getSubscription(userApiKey: string): Promise<PlatformSubscriptionInfo>;
    /** GET /v1/billing/balance (user bearer). */
    getBalance(userApiKey: string): Promise<PlatformBalanceSnapshot>;
    /** GET /v1/billing/usage (user bearer). */
    getUsageByProduct(userApiKey: string): Promise<PlatformUsageProductRow[]>;
    /** GET /v1/billing/product-entitlement?product=<id> (user bearer). */
    getProductEntitlement(userApiKey: string, productId: string): Promise<ProductEntitlement>;
    /** POST /v1/billing/deduct (service token). */
    deduct(input: {
        platformUserId: string;
        amountUsd: number;
        type: string;
        description: string;
        referenceId: string;
    }): Promise<void>;
    /** Absolute URL of the platform's billing-management surface. */
    billingUrl(): string;
    /** Absolute URL of the $100/mo seat checkout for `productId`. */
    seatCheckoutUrl(productId: string): string;
}
declare function createPlatformBillingHttp(opts: PlatformBillingHttpOptions): PlatformBillingHttp;
/**
 * Platform Stripe checkout URL for a product's $100/mo seat. One shared price
 * carries `metadata.productId`; the platform distinguishes the product from
 * the `product` query param (not five distinct prices). Mirrors the
 * `billingUrl()` shape — a deterministic platform-rooted URL, no network call.
 */
declare function seatCheckoutUrl(baseUrl: string, productId: string): string;
interface TangleTierPolicy {
    concurrency: number;
    overageAllowed: boolean;
}
declare const DEFAULT_TANGLE_TIER_POLICY: Record<TanglePlanTier, TangleTierPolicy>;
interface TangleTierState {
    tier: TanglePlanTier;
    subscriptionStatus: string | null;
    remainingBalanceUsd: number;
    lifetimeSpentUsd: number;
    concurrency: number;
    overageAllowed: boolean;
}
/**
 * Read subscription + balance and project them onto the tier policy. A
 * null/absent key fails CLOSED (free tier, zero balance) — a billable run is
 * never started against an unknown balance. Platform errors throw; callers
 * on the billable path choose their posture explicitly.
 */
declare function readTangleTierState(http: PlatformBillingHttp, userApiKey: string | null | undefined, policy?: Record<TanglePlanTier, TangleTierPolicy>): Promise<TangleTierState>;
/** Lifetime free-tier cap: $2 (200¢) cumulative inference spend, expressed in
 *  dollars. Free product access ends once cumulative spend crosses this. */
declare const FREE_TIER_SPEND_CAP_USD = 2;
/**
 * Default name of the per-app feature flag gating seat billing. While OFF the
 * entitlement read is skipped and access fails OPEN (entitled) so nothing
 * changes live until a product flips the flag.
 */
declare const DEFAULT_SEAT_BILLING_ENABLED_ENV_VAR = "SEAT_BILLING_ENABLED";
interface SeatBillingFlagOptions {
    env?: Record<string, string | undefined>;
    /** Override the flag name; default {@link DEFAULT_SEAT_BILLING_ENABLED_ENV_VAR}. */
    flagEnvVar?: string;
}
/**
 * Seat billing is OFF unless the flag is explicitly truthy ('true'/'1'/'on'/
 * 'enabled'). Default OFF — pre-rollout, the paywall never engages. Returns
 * false when no env is available (browser bundles) so the client stays
 * fail-open there too.
 */
declare function isSeatBillingEnabled(opts?: SeatBillingFlagOptions): boolean;
/**
 * Read a user's entitlement for one product. Fails OPEN: an absent key,
 * disabled flag, or unreachable seat endpoint all return a permissive snapshot
 * (`hasSeat: true`) so consumers never break pre-rollout. The platform owns the
 * `hasSeat`/`onFreeTier` computation; this client only transports + degrades
 * safely.
 *
 * @param flag — pass {@link isSeatBillingEnabled} (or your own boolean) so the
 *   product owns when the gate engages. When false, no network call is made.
 */
declare function getProductEntitlement(http: Pick<PlatformBillingHttp, 'getProductEntitlement'>, userApiKey: string | null | undefined, productId: string, flag?: boolean): Promise<ProductEntitlement>;
/** Entitled = holds an active seat OR is still inside the free tier. The one
 *  predicate all five products gate on. */
declare function isProductEntitled(ent: ProductEntitlement): boolean;
interface PlatformIdentityStore {
    resolveIdentity(userId: string): Promise<PlatformIdentity | null>;
}
/** Concrete fetch-backed `PlatformBillingClient<TanglePlanTier>` for
 *  `createPlatformBalanceManager` (from `/billing`). */
declare function createTanglePlatformBillingClient(http: PlatformBillingHttp, identity: PlatformIdentityStore): PlatformBillingClient<TanglePlanTier>;

/**
 * Request guards for agent-app routes: session auth (302 redirect for pages,
 * JSON 401 for APIs), admin allowlisting (404 — the route stays invisible to
 * non-admins), and the billable-balance gate (402 with a stable code).
 * Session resolution is a seam; thrown Responses follow the router convention
 * of surfacing a thrown Response as the route result.
 */
interface AuthGuardOptions<Session> {
    /** e.g. a better-auth `auth.api.getSession` wrapped by the app. */
    getSession(request: Request): Promise<Session | null | undefined>;
    /** Default '/login'. */
    loginPath?: string;
}
interface AuthGuard<Session> {
    /** Page guard — throws a 302 redirect Response to `loginPath`. */
    requireUser(request: Request): Promise<Session>;
    /** API guard — throws JSON 401 `{ error: 'Unauthorized', code: 'auth.unauthenticated' }`. */
    requireApiUser(request: Request): Promise<Session>;
    /** `apiResponse` selects the 401 JSON path over the redirect. */
    requireSession(request: Request, opts?: {
        apiResponse?: boolean;
    }): Promise<Session>;
    getOptionalSession(request: Request): Promise<Session | null>;
}
declare function createAuthGuard<Session>(opts: AuthGuardOptions<Session>): AuthGuard<Session>;
/** Comma/whitespace separated → trimmed, lowercased, empties dropped. */
declare function parseAdminEmails(raw: string | null | undefined): string[];
interface AdminGuardOptions<Session> {
    requireUser(request: Request): Promise<Session>;
    emailOf(session: Session): string | null | undefined;
    /** Resolved per request; an EMPTY allowlist refuses everyone. */
    allowedEmails(): string[];
}
/** Non-admins (and empty allowlists) get 404, keeping the route invisible —
 *  better than a "forbidden" footprint that advertises its existence. */
declare function createAdminGuard<Session>(opts: AdminGuardOptions<Session>): (request: Request) => Promise<Session>;
interface BillableBalanceState {
    overageAllowed: boolean;
    remainingBalanceUsd: number;
}
interface AssertBillableBalanceOptions {
    env?: Record<string, string | undefined>;
    /** App-specific enforcement override flag (e.g. 'GTM_BILLING_ENFORCEMENT'),
     *  fed to `isTangleBillingEnforcementDisabled`. */
    enforcementEnvVar?: string;
    /** Default 'Add balance or upgrade your plan to invoke this agent.'. */
    errorMessage?: string;
    /** Merged into the 402 JSON body (e.g. `{ organizationId }`). */
    errorBody?: Record<string, unknown>;
}
/**
 * Gate a billable turn: passes when enforcement is disabled (dev default),
 * the tier allows overage, or remaining balance is positive. Otherwise throws
 * a 402 Response with the stable `billing.balance_required` code so clients
 * can route to the billing screen.
 */
declare function assertBillableBalance(state: BillableBalanceState, opts?: AssertBillableBalanceOptions): void;

export { type AdminGuardOptions, type AssertBillableBalanceOptions, type AuthGuard, type AuthGuardOptions, type BetterAuthSessionCookieMinterOptions, type BetterAuthSessionCookieSource, type BillableBalanceState, DEFAULT_SEAT_BILLING_ENABLED_ENV_VAR, DEFAULT_TANGLE_TIER_POLICY, FREE_TIER_SPEND_CAP_USD, type HubClientLike, type HubProxyContext, type HubProxyRouteArgs, type HubProxyRoutes, type PlatformBalanceSnapshot, type PlatformBillingHttp, PlatformBillingHttpError, type PlatformBillingHttpOptions, type PlatformIdentityStore, type PlatformSubscriptionInfo, type PlatformUsageProductRow, type ProductEntitlement, type ResolveUserTangleHubBearerForUserOptions, type ResolveUserTangleHubBearerOptions, type ResolvedTangleHubBearer, type SeatBillingFlagOptions, type SeatStatus, type SsoStateConfig, TangleBearerMissingError, type TangleHubBearerSource, type TanglePlanTier, type TangleSsoAccountStore, type TangleSsoAuthClient, type TangleSsoExchangeResult, type TangleSsoHandlerOptions, type TangleSsoHandlers, type TangleSsoSessionCookieArgs, TangleSsoUserCreateError, type TangleTierPolicy, type TangleTierState, assertBillableBalance, createAdminGuard, createAuthGuard, createBetterAuthSessionCookieMinter, createHubProxyRoutes, createPlatformBillingHttp, createSignedSsoState, createTanglePlatformBillingClient, createTangleSsoHandlers, getProductEntitlement, isPlatformBillingHttpError, isPlatformHubErrorLike, isProductEntitled, isSeatBillingEnabled, isTangleBearerMissingError, normalizeTanglePlanTier, parseAdminEmails, readTangleTierState, resolveUserTangleHubBearer, resolveUserTangleHubBearerForUser, seatCheckoutUrl, signSessionCookieValue, verifySignedSsoState };
