import { AppConfig, AppVariables } from "./types/app.js";
import "./types/index.js";
import { createAgentsHono } from "./createApp.js";
import { NativeSandboxConfig, SandboxConfig, VercelSandboxConfig } from "./domains/run/types/executionContext.js";
import "./env.js";
import { createAuth0Provider, createOIDCProvider } from "./ssoHelpers.js";
import { SSOProviderConfig, UserAuthConfig, createAgentsApp } from "./factory.js";
import { Hono } from "hono";
import * as zod205 from "zod";
import * as hono_types12 from "hono/types";
import * as better_auth78 from "better-auth";
import * as better_auth_plugins69 from "better-auth/plugins";
import * as _better_auth_sso10 from "@better-auth/sso";

//#region src/index.d.ts
declare const auth: better_auth78.Auth<{
  baseURL: string;
  secret: string;
  database: (options: better_auth78.BetterAuthOptions) => better_auth78.DBAdapter<better_auth78.BetterAuthOptions>;
  emailAndPassword: {
    enabled: true;
    minPasswordLength: number;
    maxPasswordLength: number;
    requireEmailVerification: false;
    autoSignIn: true;
  };
  account: {
    accountLinking: {
      enabled: true;
      trustedProviders: ("google" | "email-password" | "auth0")[];
    };
  };
  databaseHooks: {
    session: {
      create: {
        before: (session: {
          id: string;
          createdAt: Date;
          updatedAt: Date;
          userId: string;
          expiresAt: Date;
          token: string;
          ipAddress?: string | null | undefined;
          userAgent?: string | null | undefined;
        } & Record<string, unknown>) => Promise<{
          data: {
            activeOrganizationId: string | null;
            id: string;
            createdAt: Date;
            updatedAt: Date;
            userId: string;
            expiresAt: Date;
            token: string;
            ipAddress?: string | null | undefined;
            userAgent?: string | null | undefined;
          };
        }>;
      };
    };
  };
  socialProviders: {
    google: {
      redirectURI?: string | undefined;
      clientId: string;
      accessType?: ("offline" | "online") | undefined;
      display?: ("page" | "popup" | "touch" | "wap") | undefined;
      hd?: string | undefined;
      clientSecret?: string | undefined;
      scope?: string[] | undefined;
      disableDefaultScope?: boolean | undefined;
      clientKey?: string | undefined;
      disableIdTokenSignIn?: boolean | undefined;
      verifyIdToken?: ((token: string, nonce?: string) => Promise<boolean>) | undefined;
      getUserInfo?: ((token: better_auth78.OAuth2Tokens) => Promise<{
        user: {
          id: string;
          name?: string;
          email?: string | null;
          image?: string;
          emailVerified: boolean;
          [key: string]: any;
        };
        data: any;
      } | null>) | undefined;
      refreshAccessToken?: ((refreshToken: string) => Promise<better_auth78.OAuth2Tokens>) | undefined;
      mapProfileToUser?: ((profile: better_auth78.GoogleProfile) => {
        id?: string;
        name?: string;
        email?: string | null;
        image?: string;
        emailVerified?: boolean;
        [key: string]: any;
      } | Promise<{
        id?: string;
        name?: string;
        email?: string | null;
        image?: string;
        emailVerified?: boolean;
        [key: string]: any;
      }>) | undefined;
      disableImplicitSignUp?: boolean | undefined;
      disableSignUp?: boolean | undefined;
      prompt?: ("select_account" | "consent" | "login" | "none" | "select_account consent") | undefined;
      responseMode?: ("query" | "form_post") | undefined;
      overrideUserInfoOnSignIn?: boolean | undefined;
    };
  } | undefined;
  session: {
    expiresIn: number;
    updateAge: number;
    cookieCache: {
      enabled: true;
      maxAge: number;
      strategy: "compact";
    };
  };
  advanced: {
    ipAddress?: {
      ipAddressHeaders?: string[];
      disableIpTracking?: boolean;
    } | undefined;
    useSecureCookies?: boolean | undefined;
    disableCSRFCheck?: boolean | undefined;
    disableOriginCheck?: boolean | undefined;
    crossSubDomainCookies?: {
      enabled: boolean;
      additionalCookies?: string[];
      domain?: string;
    } | undefined;
    cookies?: {
      [key: string]: {
        name?: string;
        attributes?: better_auth78.CookieOptions;
      };
    } | undefined;
    defaultCookieAttributes: better_auth78.CookieOptions;
    cookiePrefix?: string | undefined;
    database?: {
      defaultFindManyLimit?: number;
      useNumberId?: boolean;
      generateId?: better_auth78.GenerateIdFn | false | "serial" | "uuid";
    } | undefined;
    trustedProxyHeaders?: boolean | undefined;
    backgroundTasks?: {
      handler: (promise: Promise<void>) => void;
    };
  };
  trustedOrigins: string[];
  plugins: [{
    id: "bearer";
    hooks: {
      before: {
        matcher(context: better_auth78.HookEndpointContext): boolean;
        handler: (inputContext: better_auth78.MiddlewareInputContext<better_auth78.MiddlewareOptions>) => Promise<{
          context: {
            headers: Headers;
          };
        } | undefined>;
      }[];
      after: {
        matcher(context: better_auth78.HookEndpointContext): true;
        handler: (inputContext: better_auth78.MiddlewareInputContext<better_auth78.MiddlewareOptions>) => Promise<void>;
      }[];
    };
    options: better_auth_plugins69.BearerOptions | undefined;
  }, {
    id: "sso";
    endpoints: {
      spMetadata: ReturnType<() => better_auth78.StrictEndpoint<"/sso/saml2/sp/metadata", {
        method: "GET";
        query: zod205.ZodObject<{
          providerId: zod205.ZodString;
          format: zod205.ZodDefault<zod205.ZodEnum<{
            xml: "xml";
            json: "json";
          }>>;
        }, better_auth78.$strip>;
        metadata: {
          openapi: {
            operationId: string;
            summary: string;
            description: string;
            responses: {
              "200": {
                description: string;
              };
            };
          };
        };
      }, Response>>;
      registerSSOProvider: better_auth78.StrictEndpoint<"/sso/register", {
        method: "POST";
        body: zod205.ZodObject<{
          providerId: zod205.ZodString;
          issuer: zod205.ZodString;
          domain: zod205.ZodString;
          oidcConfig: zod205.ZodOptional<zod205.ZodObject<{
            clientId: zod205.ZodString;
            clientSecret: zod205.ZodString;
            authorizationEndpoint: zod205.ZodOptional<zod205.ZodString>;
            tokenEndpoint: zod205.ZodOptional<zod205.ZodString>;
            userInfoEndpoint: zod205.ZodOptional<zod205.ZodString>;
            tokenEndpointAuthentication: zod205.ZodOptional<zod205.ZodEnum<{
              client_secret_post: "client_secret_post";
              client_secret_basic: "client_secret_basic";
            }>>;
            jwksEndpoint: zod205.ZodOptional<zod205.ZodString>;
            discoveryEndpoint: zod205.ZodOptional<zod205.ZodString>;
            skipDiscovery: zod205.ZodOptional<zod205.ZodBoolean>;
            scopes: zod205.ZodOptional<zod205.ZodArray<zod205.ZodString>>;
            pkce: zod205.ZodOptional<zod205.ZodDefault<zod205.ZodBoolean>>;
            mapping: zod205.ZodOptional<zod205.ZodObject<{
              id: zod205.ZodString;
              email: zod205.ZodString;
              emailVerified: zod205.ZodOptional<zod205.ZodString>;
              name: zod205.ZodString;
              image: zod205.ZodOptional<zod205.ZodString>;
              extraFields: zod205.ZodOptional<zod205.ZodRecord<zod205.ZodString, zod205.ZodAny>>;
            }, better_auth78.$strip>>;
          }, better_auth78.$strip>>;
          samlConfig: zod205.ZodOptional<zod205.ZodObject<{
            entryPoint: zod205.ZodString;
            cert: zod205.ZodString;
            callbackUrl: zod205.ZodString;
            audience: zod205.ZodOptional<zod205.ZodString>;
            idpMetadata: zod205.ZodOptional<zod205.ZodObject<{
              metadata: zod205.ZodOptional<zod205.ZodString>;
              entityID: zod205.ZodOptional<zod205.ZodString>;
              cert: zod205.ZodOptional<zod205.ZodString>;
              privateKey: zod205.ZodOptional<zod205.ZodString>;
              privateKeyPass: zod205.ZodOptional<zod205.ZodString>;
              isAssertionEncrypted: zod205.ZodOptional<zod205.ZodBoolean>;
              encPrivateKey: zod205.ZodOptional<zod205.ZodString>;
              encPrivateKeyPass: zod205.ZodOptional<zod205.ZodString>;
              singleSignOnService: zod205.ZodOptional<zod205.ZodArray<zod205.ZodObject<{
                Binding: zod205.ZodString;
                Location: zod205.ZodString;
              }, better_auth78.$strip>>>;
            }, better_auth78.$strip>>;
            spMetadata: zod205.ZodObject<{
              metadata: zod205.ZodOptional<zod205.ZodString>;
              entityID: zod205.ZodOptional<zod205.ZodString>;
              binding: zod205.ZodOptional<zod205.ZodString>;
              privateKey: zod205.ZodOptional<zod205.ZodString>;
              privateKeyPass: zod205.ZodOptional<zod205.ZodString>;
              isAssertionEncrypted: zod205.ZodOptional<zod205.ZodBoolean>;
              encPrivateKey: zod205.ZodOptional<zod205.ZodString>;
              encPrivateKeyPass: zod205.ZodOptional<zod205.ZodString>;
            }, better_auth78.$strip>;
            wantAssertionsSigned: zod205.ZodOptional<zod205.ZodBoolean>;
            signatureAlgorithm: zod205.ZodOptional<zod205.ZodString>;
            digestAlgorithm: zod205.ZodOptional<zod205.ZodString>;
            identifierFormat: zod205.ZodOptional<zod205.ZodString>;
            privateKey: zod205.ZodOptional<zod205.ZodString>;
            decryptionPvk: zod205.ZodOptional<zod205.ZodString>;
            additionalParams: zod205.ZodOptional<zod205.ZodRecord<zod205.ZodString, zod205.ZodAny>>;
            mapping: zod205.ZodOptional<zod205.ZodObject<{
              id: zod205.ZodString;
              email: zod205.ZodString;
              emailVerified: zod205.ZodOptional<zod205.ZodString>;
              name: zod205.ZodString;
              firstName: zod205.ZodOptional<zod205.ZodString>;
              lastName: zod205.ZodOptional<zod205.ZodString>;
              extraFields: zod205.ZodOptional<zod205.ZodRecord<zod205.ZodString, zod205.ZodAny>>;
            }, better_auth78.$strip>>;
          }, better_auth78.$strip>>;
          organizationId: zod205.ZodOptional<zod205.ZodString>;
          overrideUserInfo: zod205.ZodOptional<zod205.ZodDefault<zod205.ZodBoolean>>;
        }, better_auth78.$strip>;
        use: ((inputContext: better_auth78.MiddlewareInputContext<better_auth78.MiddlewareOptions>) => Promise<{
          session: {
            session: Record<string, any> & {
              id: string;
              createdAt: Date;
              updatedAt: Date;
              userId: string;
              expiresAt: Date;
              token: string;
              ipAddress?: string | null | undefined;
              userAgent?: string | null | undefined;
            };
            user: Record<string, any> & {
              id: string;
              createdAt: Date;
              updatedAt: Date;
              email: string;
              emailVerified: boolean;
              name: string;
              image?: string | null | undefined;
            };
          };
        }>)[];
        metadata: {
          openapi: {
            operationId: string;
            summary: string;
            description: string;
            responses: {
              "200": {
                description: string;
                content: {
                  "application/json": {
                    schema: {
                      type: "object";
                      properties: {
                        issuer: {
                          type: string;
                          format: string;
                          description: string;
                        };
                        domain: {
                          type: string;
                          description: string;
                        };
                        domainVerified: {
                          type: string;
                          description: string;
                        };
                        domainVerificationToken: {
                          type: string;
                          description: string;
                        };
                        oidcConfig: {
                          type: string;
                          properties: {
                            issuer: {
                              type: string;
                              format: string;
                              description: string;
                            };
                            pkce: {
                              type: string;
                              description: string;
                            };
                            clientId: {
                              type: string;
                              description: string;
                            };
                            clientSecret: {
                              type: string;
                              description: string;
                            };
                            authorizationEndpoint: {
                              type: string;
                              format: string;
                              nullable: boolean;
                              description: string;
                            };
                            discoveryEndpoint: {
                              type: string;
                              format: string;
                              description: string;
                            };
                            userInfoEndpoint: {
                              type: string;
                              format: string;
                              nullable: boolean;
                              description: string;
                            };
                            scopes: {
                              type: string;
                              items: {
                                type: string;
                              };
                              nullable: boolean;
                              description: string;
                            };
                            tokenEndpoint: {
                              type: string;
                              format: string;
                              nullable: boolean;
                              description: string;
                            };
                            tokenEndpointAuthentication: {
                              type: string;
                              enum: string[];
                              nullable: boolean;
                              description: string;
                            };
                            jwksEndpoint: {
                              type: string;
                              format: string;
                              nullable: boolean;
                              description: string;
                            };
                            mapping: {
                              type: string;
                              nullable: boolean;
                              properties: {
                                id: {
                                  type: string;
                                  description: string;
                                };
                                email: {
                                  type: string;
                                  description: string;
                                };
                                emailVerified: {
                                  type: string;
                                  nullable: boolean;
                                  description: string;
                                };
                                name: {
                                  type: string;
                                  description: string;
                                };
                                image: {
                                  type: string;
                                  nullable: boolean;
                                  description: string;
                                };
                                extraFields: {
                                  type: string;
                                  additionalProperties: {
                                    type: string;
                                  };
                                  nullable: boolean;
                                  description: string;
                                };
                              };
                              required: string[];
                            };
                          };
                          required: string[];
                          description: string;
                        };
                        organizationId: {
                          type: string;
                          nullable: boolean;
                          description: string;
                        };
                        userId: {
                          type: string;
                          description: string;
                        };
                        providerId: {
                          type: string;
                          description: string;
                        };
                        redirectURI: {
                          type: string;
                          format: string;
                          description: string;
                        };
                      };
                      required: string[];
                    };
                  };
                };
              };
            };
          };
        };
      }, {
        redirectURI: string;
        oidcConfig: _better_auth_sso10.OIDCConfig | null;
        samlConfig: _better_auth_sso10.SAMLConfig | null;
      } & Omit<{
        issuer: string;
        oidcConfig?: _better_auth_sso10.OIDCConfig | undefined;
        samlConfig?: _better_auth_sso10.SAMLConfig | undefined;
        userId: string;
        providerId: string;
        organizationId?: string | undefined;
        domain: string;
      }, "oidcConfig" | "samlConfig">>;
      signInSSO: ReturnType<(options?: _better_auth_sso10.SSOOptions) => better_auth78.StrictEndpoint<"/sign-in/sso", {
        method: "POST";
        body: zod205.ZodObject<{
          email: zod205.ZodOptional<zod205.ZodString>;
          organizationSlug: zod205.ZodOptional<zod205.ZodString>;
          providerId: zod205.ZodOptional<zod205.ZodString>;
          domain: zod205.ZodOptional<zod205.ZodString>;
          callbackURL: zod205.ZodString;
          errorCallbackURL: zod205.ZodOptional<zod205.ZodString>;
          newUserCallbackURL: zod205.ZodOptional<zod205.ZodString>;
          scopes: zod205.ZodOptional<zod205.ZodArray<zod205.ZodString>>;
          loginHint: zod205.ZodOptional<zod205.ZodString>;
          requestSignUp: zod205.ZodOptional<zod205.ZodBoolean>;
          providerType: zod205.ZodOptional<zod205.ZodEnum<{
            saml: "saml";
            oidc: "oidc";
          }>>;
        }, better_auth78.$strip>;
        metadata: {
          openapi: {
            operationId: string;
            summary: string;
            description: string;
            requestBody: {
              content: {
                "application/json": {
                  schema: {
                    type: "object";
                    properties: {
                      email: {
                        type: string;
                        description: string;
                      };
                      issuer: {
                        type: string;
                        description: string;
                      };
                      providerId: {
                        type: string;
                        description: string;
                      };
                      callbackURL: {
                        type: string;
                        description: string;
                      };
                      errorCallbackURL: {
                        type: string;
                        description: string;
                      };
                      newUserCallbackURL: {
                        type: string;
                        description: string;
                      };
                      loginHint: {
                        type: string;
                        description: string;
                      };
                    };
                    required: string[];
                  };
                };
              };
            };
            responses: {
              "200": {
                description: string;
                content: {
                  "application/json": {
                    schema: {
                      type: "object";
                      properties: {
                        url: {
                          type: string;
                          format: string;
                          description: string;
                        };
                        redirect: {
                          type: string;
                          description: string;
                          enum: boolean[];
                        };
                      };
                      required: string[];
                    };
                  };
                };
              };
            };
          };
        };
      }, {
        url: string;
        redirect: boolean;
      }>>;
      callbackSSO: ReturnType<(options?: _better_auth_sso10.SSOOptions) => better_auth78.StrictEndpoint<"/sso/callback/:providerId", {
        method: "GET";
        query: zod205.ZodObject<{
          code: zod205.ZodOptional<zod205.ZodString>;
          state: zod205.ZodString;
          error: zod205.ZodOptional<zod205.ZodString>;
          error_description: zod205.ZodOptional<zod205.ZodString>;
        }, better_auth78.$strip>;
        allowedMediaTypes: string[];
        metadata: {
          openapi: {
            operationId: string;
            summary: string;
            description: string;
            responses: {
              "302": {
                description: string;
              };
            };
          };
          scope: "server";
        };
      }, never>>;
      callbackSSOSAML: ReturnType<(options?: _better_auth_sso10.SSOOptions) => better_auth78.StrictEndpoint<"/sso/saml2/callback/:providerId", {
        method: "POST";
        body: zod205.ZodObject<{
          SAMLResponse: zod205.ZodString;
          RelayState: zod205.ZodOptional<zod205.ZodString>;
        }, better_auth78.$strip>;
        metadata: {
          allowedMediaTypes: string[];
          openapi: {
            operationId: string;
            summary: string;
            description: string;
            responses: {
              "302": {
                description: string;
              };
              "400": {
                description: string;
              };
              "401": {
                description: string;
              };
            };
          };
          scope: "server";
        };
      }, never>>;
      acsEndpoint: ReturnType<(options?: _better_auth_sso10.SSOOptions) => better_auth78.StrictEndpoint<"/sso/saml2/sp/acs/:providerId", {
        method: "POST";
        params: zod205.ZodObject<{
          providerId: zod205.ZodOptional<zod205.ZodString>;
        }, better_auth78.$strip>;
        body: zod205.ZodObject<{
          SAMLResponse: zod205.ZodString;
          RelayState: zod205.ZodOptional<zod205.ZodString>;
        }, better_auth78.$strip>;
        metadata: {
          allowedMediaTypes: string[];
          openapi: {
            operationId: string;
            summary: string;
            description: string;
            responses: {
              "302": {
                description: string;
              };
            };
          };
          scope: "server";
        };
      }, never>>;
    } & {
      requestDomainVerification: ReturnType<(options: _better_auth_sso10.SSOOptions) => better_auth78.StrictEndpoint<"/sso/request-domain-verification", {
        method: "POST";
        body: zod205.ZodObject<{
          providerId: zod205.ZodString;
        }, better_auth78.$strip>;
        metadata: {
          openapi: {
            summary: string;
            description: string;
            responses: {
              "404": {
                description: string;
              };
              "409": {
                description: string;
              };
              "201": {
                description: string;
              };
            };
          };
        };
        use: ((inputContext: better_auth78.MiddlewareInputContext<better_auth78.MiddlewareOptions>) => Promise<{
          session: {
            session: Record<string, any> & {
              id: string;
              createdAt: Date;
              updatedAt: Date;
              userId: string;
              expiresAt: Date;
              token: string;
              ipAddress?: string | null | undefined;
              userAgent?: string | null | undefined;
            };
            user: Record<string, any> & {
              id: string;
              createdAt: Date;
              updatedAt: Date;
              email: string;
              emailVerified: boolean;
              name: string;
              image?: string | null | undefined;
            };
          };
        }>)[];
      }, {
        domainVerificationToken: string;
      }>>;
      verifyDomain: ReturnType<(options: _better_auth_sso10.SSOOptions) => better_auth78.StrictEndpoint<"/sso/verify-domain", {
        method: "POST";
        body: zod205.ZodObject<{
          providerId: zod205.ZodString;
        }, better_auth78.$strip>;
        metadata: {
          openapi: {
            summary: string;
            description: string;
            responses: {
              "404": {
                description: string;
              };
              "409": {
                description: string;
              };
              "502": {
                description: string;
              };
              "204": {
                description: string;
              };
            };
          };
        };
        use: ((inputContext: better_auth78.MiddlewareInputContext<better_auth78.MiddlewareOptions>) => Promise<{
          session: {
            session: Record<string, any> & {
              id: string;
              createdAt: Date;
              updatedAt: Date;
              userId: string;
              expiresAt: Date;
              token: string;
              ipAddress?: string | null | undefined;
              userAgent?: string | null | undefined;
            };
            user: Record<string, any> & {
              id: string;
              createdAt: Date;
              updatedAt: Date;
              email: string;
              emailVerified: boolean;
              name: string;
              image?: string | null | undefined;
            };
          };
        }>)[];
      }, void>>;
    };
    schema: any;
    options: _better_auth_sso10.SSOOptions & {
      domainVerification?: {
        enabled: true;
      };
    };
  }, {
    id: "oauth-proxy";
    options: NoInfer<{
      productionURL: string;
    }>;
    endpoints: {
      oAuthProxy: better_auth78.StrictEndpoint<"/oauth-proxy-callback", {
        method: "GET";
        operationId: string;
        query: zod205.ZodObject<{
          callbackURL: zod205.ZodString;
          cookies: zod205.ZodString;
        }, better_auth78.$strip>;
        use: ((inputContext: better_auth78.MiddlewareInputContext<better_auth78.MiddlewareOptions>) => Promise<void>)[];
        metadata: {
          openapi: {
            operationId: string;
            description: string;
            parameters: {
              in: "query";
              name: string;
              required: true;
              description: string;
            }[];
            responses: {
              302: {
                description: string;
                headers: {
                  Location: {
                    description: string;
                    schema: {
                      type: string;
                    };
                  };
                };
              };
            };
          };
        };
      }, never>;
    };
    hooks: {
      before: {
        matcher(context: better_auth78.HookEndpointContext): boolean;
        handler: (inputContext: better_auth78.MiddlewareInputContext<better_auth78.MiddlewareOptions>) => Promise<void>;
      }[];
      after: {
        matcher(context: better_auth78.HookEndpointContext): boolean;
        handler: (inputContext: better_auth78.MiddlewareInputContext<better_auth78.MiddlewareOptions>) => Promise<void>;
      }[];
    };
  }, {
    id: "organization";
    endpoints: better_auth_plugins69.OrganizationEndpoints<{
      allowUserToCreateOrganization: true;
      ac: better_auth_plugins69.AccessControl;
      roles: {
        member: {
          authorize<K_1 extends "organization" | "ac" | "member" | "project" | "team" | "invitation">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins69.Statements>[key] | {
            actions: better_auth_plugins69.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins69.Statements>[key];
            connector: "OR" | "AND";
          } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins69.AuthorizeResponse;
          statements: better_auth_plugins69.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins69.Statements>;
        };
        admin: {
          authorize<K_1 extends "organization" | "ac" | "member" | "project" | "team" | "invitation">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins69.Statements>[key] | {
            actions: better_auth_plugins69.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins69.Statements>[key];
            connector: "OR" | "AND";
          } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins69.AuthorizeResponse;
          statements: better_auth_plugins69.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins69.Statements>;
        };
        owner: {
          authorize<K_1 extends "organization" | "ac" | "member" | "project" | "team" | "invitation">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins69.Statements>[key] | {
            actions: better_auth_plugins69.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins69.Statements>[key];
            connector: "OR" | "AND";
          } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins69.AuthorizeResponse;
          statements: better_auth_plugins69.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins69.Statements>;
        };
      };
      creatorRole: "admin";
      membershipLimit: number;
      invitationLimit: number;
      invitationExpiresIn: number;
      sendInvitationEmail(data: {
        id: string;
        role: string;
        email: string;
        organization: better_auth_plugins69.Organization;
        invitation: better_auth_plugins69.Invitation;
        inviter: better_auth_plugins69.Member & {
          user: better_auth78.User;
        };
      }): Promise<void>;
      organizationHooks: {
        afterAcceptInvitation: ({
          member,
          user,
          organization: org
        }: {
          invitation: better_auth_plugins69.Invitation & Record<string, any>;
          member: better_auth_plugins69.Member & Record<string, any>;
          user: better_auth78.User & Record<string, any>;
          organization: better_auth_plugins69.Organization & Record<string, any>;
        }) => Promise<void>;
        beforeUpdateMemberRole: ({
          member,
          organization: org,
          newRole
        }: {
          member: better_auth_plugins69.Member & Record<string, any>;
          newRole: string;
          user: better_auth78.User & Record<string, any>;
          organization: better_auth_plugins69.Organization & Record<string, any>;
        }) => Promise<void>;
        afterRemoveMember: ({
          member,
          organization: org
        }: {
          member: better_auth_plugins69.Member & Record<string, any>;
          user: better_auth78.User & Record<string, any>;
          organization: better_auth_plugins69.Organization & Record<string, any>;
        }) => Promise<void>;
      };
    }>;
    schema: {
      organization: {
        modelName: string;
        fields: {
          name: {
            type: "string";
            required: true;
            sortable: true;
          };
          slug: {
            type: "string";
            required: true;
            unique: true;
            sortable: true;
          };
          logo: {
            type: "string";
            required: false;
          };
          createdAt: {
            type: "date";
            required: true;
          };
          updatedAt: {
            type: "date";
            required: false;
          };
        };
      };
      member: {
        modelName: string;
        fields: {
          organizationId: {
            type: "string";
            required: true;
            references: {
              model: "organization";
              field: "id";
            };
          };
          userId: {
            type: "string";
            required: true;
            references: {
              model: "user";
              field: "id";
            };
          };
          role: {
            type: "string";
            required: true;
            defaultValue: "member";
          };
          createdAt: {
            type: "date";
            required: true;
          };
        };
      };
      invitation: {
        modelName: string;
        fields: {
          organizationId: {
            type: "string";
            required: true;
            references: {
              model: "organization";
              field: "id";
            };
          };
          email: {
            type: "string";
            required: true;
            sortable: true;
          };
          role: {
            type: "string";
            required: true;
            sortable: true;
          };
          status: {
            type: "string";
            required: true;
            sortable: true;
            defaultValue: "pending";
          };
          expiresAt: {
            type: "date";
            required: false;
          };
          createdAt: {
            type: "date";
            required: true;
            defaultValue: Date;
          };
          inviterId: {
            type: "string";
            required: true;
            references: {
              model: "user";
              field: "id";
            };
          };
        };
      };
      session: {
        fields: {
          activeOrganizationId: {
            type: "string";
            required: false;
          };
        };
      };
    };
    $Infer: {
      Organization: {
        id: string;
        name: string;
        slug: string;
        createdAt: Date;
        logo?: string | null | undefined;
        metadata?: any;
      };
      Invitation: {
        id: string;
        organizationId: string;
        email: string;
        role: "member" | "admin" | "owner";
        status: better_auth_plugins69.InvitationStatus;
        inviterId: string;
        expiresAt: Date;
        createdAt: Date;
      };
      Member: {
        id: string;
        organizationId: string;
        role: "member" | "admin" | "owner";
        createdAt: Date;
        userId: string;
        user: {
          id: string;
          email: string;
          name: string;
          image?: string | undefined;
        };
      };
      Team: any;
      TeamMember: any;
      ActiveOrganization: {
        members: {
          id: string;
          organizationId: string;
          role: "member" | "admin" | "owner";
          createdAt: Date;
          userId: string;
          user: {
            id: string;
            email: string;
            name: string;
            image?: string | undefined;
          };
        }[];
        invitations: {
          id: string;
          organizationId: string;
          email: string;
          role: "member" | "admin" | "owner";
          status: better_auth_plugins69.InvitationStatus;
          inviterId: string;
          expiresAt: Date;
          createdAt: Date;
        }[];
      } & {
        id: string;
        name: string;
        slug: string;
        createdAt: Date;
        logo?: string | null | undefined;
        metadata?: any;
      };
    };
    $ERROR_CODES: {
      readonly YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_ORGANIZATION: "You are not allowed to create a new organization";
      readonly YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_ORGANIZATIONS: "You have reached the maximum number of organizations";
      readonly ORGANIZATION_ALREADY_EXISTS: "Organization already exists";
      readonly ORGANIZATION_SLUG_ALREADY_TAKEN: "Organization slug already taken";
      readonly ORGANIZATION_NOT_FOUND: "Organization not found";
      readonly USER_IS_NOT_A_MEMBER_OF_THE_ORGANIZATION: "User is not a member of the organization";
      readonly YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_ORGANIZATION: "You are not allowed to update this organization";
      readonly YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_ORGANIZATION: "You are not allowed to delete this organization";
      readonly NO_ACTIVE_ORGANIZATION: "No active organization";
      readonly USER_IS_ALREADY_A_MEMBER_OF_THIS_ORGANIZATION: "User is already a member of this organization";
      readonly MEMBER_NOT_FOUND: "Member not found";
      readonly ROLE_NOT_FOUND: "Role not found";
      readonly YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM: "You are not allowed to create a new team";
      readonly TEAM_ALREADY_EXISTS: "Team already exists";
      readonly TEAM_NOT_FOUND: "Team not found";
      readonly YOU_CANNOT_LEAVE_THE_ORGANIZATION_AS_THE_ONLY_OWNER: "You cannot leave the organization as the only owner";
      readonly YOU_CANNOT_LEAVE_THE_ORGANIZATION_WITHOUT_AN_OWNER: "You cannot leave the organization without an owner";
      readonly YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_MEMBER: "You are not allowed to delete this member";
      readonly YOU_ARE_NOT_ALLOWED_TO_INVITE_USERS_TO_THIS_ORGANIZATION: "You are not allowed to invite users to this organization";
      readonly USER_IS_ALREADY_INVITED_TO_THIS_ORGANIZATION: "User is already invited to this organization";
      readonly INVITATION_NOT_FOUND: "Invitation not found";
      readonly YOU_ARE_NOT_THE_RECIPIENT_OF_THE_INVITATION: "You are not the recipient of the invitation";
      readonly EMAIL_VERIFICATION_REQUIRED_BEFORE_ACCEPTING_OR_REJECTING_INVITATION: "Email verification required before accepting or rejecting invitation";
      readonly YOU_ARE_NOT_ALLOWED_TO_CANCEL_THIS_INVITATION: "You are not allowed to cancel this invitation";
      readonly INVITER_IS_NO_LONGER_A_MEMBER_OF_THE_ORGANIZATION: "Inviter is no longer a member of the organization";
      readonly YOU_ARE_NOT_ALLOWED_TO_INVITE_USER_WITH_THIS_ROLE: "You are not allowed to invite a user with this role";
      readonly FAILED_TO_RETRIEVE_INVITATION: "Failed to retrieve invitation";
      readonly YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_TEAMS: "You have reached the maximum number of teams";
      readonly UNABLE_TO_REMOVE_LAST_TEAM: "Unable to remove last team";
      readonly YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_MEMBER: "You are not allowed to update this member";
      readonly ORGANIZATION_MEMBERSHIP_LIMIT_REACHED: "Organization membership limit reached";
      readonly YOU_ARE_NOT_ALLOWED_TO_CREATE_TEAMS_IN_THIS_ORGANIZATION: "You are not allowed to create teams in this organization";
      readonly YOU_ARE_NOT_ALLOWED_TO_DELETE_TEAMS_IN_THIS_ORGANIZATION: "You are not allowed to delete teams in this organization";
      readonly YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_TEAM: "You are not allowed to update this team";
      readonly YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_TEAM: "You are not allowed to delete this team";
      readonly INVITATION_LIMIT_REACHED: "Invitation limit reached";
      readonly TEAM_MEMBER_LIMIT_REACHED: "Team member limit reached";
      readonly USER_IS_NOT_A_MEMBER_OF_THE_TEAM: "User is not a member of the team";
      readonly YOU_CAN_NOT_ACCESS_THE_MEMBERS_OF_THIS_TEAM: "You are not allowed to list the members of this team";
      readonly YOU_DO_NOT_HAVE_AN_ACTIVE_TEAM: "You do not have an active team";
      readonly YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM_MEMBER: "You are not allowed to create a new member";
      readonly YOU_ARE_NOT_ALLOWED_TO_REMOVE_A_TEAM_MEMBER: "You are not allowed to remove a team member";
      readonly YOU_ARE_NOT_ALLOWED_TO_ACCESS_THIS_ORGANIZATION: "You are not allowed to access this organization as an owner";
      readonly YOU_ARE_NOT_A_MEMBER_OF_THIS_ORGANIZATION: "You are not a member of this organization";
      readonly MISSING_AC_INSTANCE: "Dynamic Access Control requires a pre-defined ac instance on the server auth plugin. Read server logs for more information";
      readonly YOU_MUST_BE_IN_AN_ORGANIZATION_TO_CREATE_A_ROLE: "You must be in an organization to create a role";
      readonly YOU_ARE_NOT_ALLOWED_TO_CREATE_A_ROLE: "You are not allowed to create a role";
      readonly YOU_ARE_NOT_ALLOWED_TO_UPDATE_A_ROLE: "You are not allowed to update a role";
      readonly YOU_ARE_NOT_ALLOWED_TO_DELETE_A_ROLE: "You are not allowed to delete a role";
      readonly YOU_ARE_NOT_ALLOWED_TO_READ_A_ROLE: "You are not allowed to read a role";
      readonly YOU_ARE_NOT_ALLOWED_TO_LIST_A_ROLE: "You are not allowed to list a role";
      readonly YOU_ARE_NOT_ALLOWED_TO_GET_A_ROLE: "You are not allowed to get a role";
      readonly TOO_MANY_ROLES: "This organization has too many roles";
      readonly INVALID_RESOURCE: "The provided permission includes an invalid resource";
      readonly ROLE_NAME_IS_ALREADY_TAKEN: "That role name is already taken";
      readonly CANNOT_DELETE_A_PRE_DEFINED_ROLE: "Cannot delete a pre-defined role";
    };
    options: NoInfer<{
      allowUserToCreateOrganization: true;
      ac: better_auth_plugins69.AccessControl;
      roles: {
        member: {
          authorize<K_1 extends "organization" | "ac" | "member" | "project" | "team" | "invitation">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins69.Statements>[key] | {
            actions: better_auth_plugins69.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins69.Statements>[key];
            connector: "OR" | "AND";
          } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins69.AuthorizeResponse;
          statements: better_auth_plugins69.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins69.Statements>;
        };
        admin: {
          authorize<K_1 extends "organization" | "ac" | "member" | "project" | "team" | "invitation">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins69.Statements>[key] | {
            actions: better_auth_plugins69.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins69.Statements>[key];
            connector: "OR" | "AND";
          } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins69.AuthorizeResponse;
          statements: better_auth_plugins69.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins69.Statements>;
        };
        owner: {
          authorize<K_1 extends "organization" | "ac" | "member" | "project" | "team" | "invitation">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins69.Statements>[key] | {
            actions: better_auth_plugins69.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins69.Statements>[key];
            connector: "OR" | "AND";
          } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins69.AuthorizeResponse;
          statements: better_auth_plugins69.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins69.Statements>;
        };
      };
      creatorRole: "admin";
      membershipLimit: number;
      invitationLimit: number;
      invitationExpiresIn: number;
      sendInvitationEmail(data: {
        id: string;
        role: string;
        email: string;
        organization: better_auth_plugins69.Organization;
        invitation: better_auth_plugins69.Invitation;
        inviter: better_auth_plugins69.Member & {
          user: better_auth78.User;
        };
      }): Promise<void>;
      organizationHooks: {
        afterAcceptInvitation: ({
          member,
          user,
          organization: org
        }: {
          invitation: better_auth_plugins69.Invitation & Record<string, any>;
          member: better_auth_plugins69.Member & Record<string, any>;
          user: better_auth78.User & Record<string, any>;
          organization: better_auth_plugins69.Organization & Record<string, any>;
        }) => Promise<void>;
        beforeUpdateMemberRole: ({
          member,
          organization: org,
          newRole
        }: {
          member: better_auth_plugins69.Member & Record<string, any>;
          newRole: string;
          user: better_auth78.User & Record<string, any>;
          organization: better_auth_plugins69.Organization & Record<string, any>;
        }) => Promise<void>;
        afterRemoveMember: ({
          member,
          organization: org
        }: {
          member: better_auth_plugins69.Member & Record<string, any>;
          user: better_auth78.User & Record<string, any>;
          organization: better_auth_plugins69.Organization & Record<string, any>;
        }) => Promise<void>;
      };
    }>;
  }, {
    id: "device-authorization";
    schema: {
      deviceCode: {
        fields: {
          deviceCode: {
            type: "string";
            required: true;
          };
          userCode: {
            type: "string";
            required: true;
          };
          userId: {
            type: "string";
            required: false;
          };
          expiresAt: {
            type: "date";
            required: true;
          };
          status: {
            type: "string";
            required: true;
          };
          lastPolledAt: {
            type: "date";
            required: false;
          };
          pollingInterval: {
            type: "number";
            required: false;
          };
          clientId: {
            type: "string";
            required: false;
          };
          scope: {
            type: "string";
            required: false;
          };
        };
      };
    };
    endpoints: {
      deviceCode: better_auth78.StrictEndpoint<"/device/code", {
        method: "POST";
        body: zod205.ZodObject<{
          client_id: zod205.ZodString;
          scope: zod205.ZodOptional<zod205.ZodString>;
        }, better_auth78.$strip>;
        error: zod205.ZodObject<{
          error: zod205.ZodEnum<{
            invalid_request: "invalid_request";
            invalid_client: "invalid_client";
          }>;
          error_description: zod205.ZodString;
        }, better_auth78.$strip>;
        metadata: {
          openapi: {
            description: string;
            responses: {
              200: {
                description: string;
                content: {
                  "application/json": {
                    schema: {
                      type: "object";
                      properties: {
                        device_code: {
                          type: string;
                          description: string;
                        };
                        user_code: {
                          type: string;
                          description: string;
                        };
                        verification_uri: {
                          type: string;
                          format: string;
                          description: string;
                        };
                        verification_uri_complete: {
                          type: string;
                          format: string;
                          description: string;
                        };
                        expires_in: {
                          type: string;
                          description: string;
                        };
                        interval: {
                          type: string;
                          description: string;
                        };
                      };
                    };
                  };
                };
              };
              400: {
                description: string;
                content: {
                  "application/json": {
                    schema: {
                      type: "object";
                      properties: {
                        error: {
                          type: string;
                          enum: string[];
                        };
                        error_description: {
                          type: string;
                        };
                      };
                    };
                  };
                };
              };
            };
          };
        };
      }, {
        device_code: string;
        user_code: string;
        verification_uri: string;
        verification_uri_complete: string;
        expires_in: number;
        interval: number;
      }>;
      deviceToken: better_auth78.StrictEndpoint<"/device/token", {
        method: "POST";
        body: zod205.ZodObject<{
          grant_type: zod205.ZodLiteral<"urn:ietf:params:oauth:grant-type:device_code">;
          device_code: zod205.ZodString;
          client_id: zod205.ZodString;
        }, better_auth78.$strip>;
        error: zod205.ZodObject<{
          error: zod205.ZodEnum<{
            invalid_request: "invalid_request";
            authorization_pending: "authorization_pending";
            slow_down: "slow_down";
            expired_token: "expired_token";
            access_denied: "access_denied";
            invalid_grant: "invalid_grant";
          }>;
          error_description: zod205.ZodString;
        }, better_auth78.$strip>;
        metadata: {
          openapi: {
            description: string;
            responses: {
              200: {
                description: string;
                content: {
                  "application/json": {
                    schema: {
                      type: "object";
                      properties: {
                        session: {
                          $ref: string;
                        };
                        user: {
                          $ref: string;
                        };
                      };
                    };
                  };
                };
              };
              400: {
                description: string;
                content: {
                  "application/json": {
                    schema: {
                      type: "object";
                      properties: {
                        error: {
                          type: string;
                          enum: string[];
                        };
                        error_description: {
                          type: string;
                        };
                      };
                    };
                  };
                };
              };
            };
          };
        };
      }, {
        access_token: string;
        token_type: string;
        expires_in: number;
        scope: string;
      }>;
      deviceVerify: better_auth78.StrictEndpoint<"/device", {
        method: "GET";
        query: zod205.ZodObject<{
          user_code: zod205.ZodString;
        }, better_auth78.$strip>;
        error: zod205.ZodObject<{
          error: zod205.ZodEnum<{
            invalid_request: "invalid_request";
          }>;
          error_description: zod205.ZodString;
        }, better_auth78.$strip>;
        metadata: {
          openapi: {
            description: string;
            responses: {
              200: {
                description: string;
                content: {
                  "application/json": {
                    schema: {
                      type: "object";
                      properties: {
                        user_code: {
                          type: string;
                          description: string;
                        };
                        status: {
                          type: string;
                          enum: string[];
                          description: string;
                        };
                      };
                    };
                  };
                };
              };
            };
          };
        };
      }, {
        user_code: string;
        status: string;
      }>;
      deviceApprove: better_auth78.StrictEndpoint<"/device/approve", {
        method: "POST";
        body: zod205.ZodObject<{
          userCode: zod205.ZodString;
        }, better_auth78.$strip>;
        error: zod205.ZodObject<{
          error: zod205.ZodEnum<{
            invalid_request: "invalid_request";
            expired_token: "expired_token";
            device_code_already_processed: "device_code_already_processed";
          }>;
          error_description: zod205.ZodString;
        }, better_auth78.$strip>;
        requireHeaders: true;
        metadata: {
          openapi: {
            description: string;
            responses: {
              200: {
                description: string;
                content: {
                  "application/json": {
                    schema: {
                      type: "object";
                      properties: {
                        success: {
                          type: string;
                        };
                      };
                    };
                  };
                };
              };
            };
          };
        };
      }, {
        success: boolean;
      }>;
      deviceDeny: better_auth78.StrictEndpoint<"/device/deny", {
        method: "POST";
        body: zod205.ZodObject<{
          userCode: zod205.ZodString;
        }, better_auth78.$strip>;
        error: zod205.ZodObject<{
          error: zod205.ZodEnum<{
            invalid_request: "invalid_request";
            expired_token: "expired_token";
          }>;
          error_description: zod205.ZodString;
        }, better_auth78.$strip>;
        metadata: {
          openapi: {
            description: string;
            responses: {
              200: {
                description: string;
                content: {
                  "application/json": {
                    schema: {
                      type: "object";
                      properties: {
                        success: {
                          type: string;
                        };
                      };
                    };
                  };
                };
              };
            };
          };
        };
      }, {
        success: boolean;
      }>;
    };
    $ERROR_CODES: {
      readonly INVALID_DEVICE_CODE: "Invalid device code";
      readonly EXPIRED_DEVICE_CODE: "Device code has expired";
      readonly EXPIRED_USER_CODE: "User code has expired";
      readonly AUTHORIZATION_PENDING: "Authorization pending";
      readonly ACCESS_DENIED: "Access denied";
      readonly INVALID_USER_CODE: "Invalid user code";
      readonly DEVICE_CODE_ALREADY_PROCESSED: "Device code already processed";
      readonly POLLING_TOO_FREQUENTLY: "Polling too frequently";
      readonly USER_NOT_FOUND: "User not found";
      readonly FAILED_TO_CREATE_SESSION: "Failed to create session";
      readonly INVALID_DEVICE_CODE_STATUS: "Invalid device code status";
      readonly AUTHENTICATION_REQUIRED: "Authentication required";
    };
    options: Partial<{
      expiresIn: better_auth_plugins69.TimeString;
      interval: better_auth_plugins69.TimeString;
      deviceCodeLength: number;
      userCodeLength: number;
      schema: {
        deviceCode?: {
          modelName?: string | undefined;
          fields?: {
            deviceCode?: string | undefined;
            userCode?: string | undefined;
            userId?: string | undefined;
            expiresAt?: string | undefined;
            status?: string | undefined;
            lastPolledAt?: string | undefined;
            pollingInterval?: string | undefined;
            clientId?: string | undefined;
            scope?: string | undefined;
          } | undefined;
        } | undefined;
      };
      generateDeviceCode?: (() => string | Promise<string>) | undefined;
      generateUserCode?: (() => string | Promise<string>) | undefined;
      validateClient?: ((clientId: string) => boolean | Promise<boolean>) | undefined;
      onDeviceAuthRequest?: ((clientId: string, scope: string | undefined) => void | Promise<void>) | undefined;
      verificationUri?: string | undefined;
    }>;
  }];
}>;
declare const app: Hono<hono_types12.BlankEnv, hono_types12.BlankSchema, "/">;
//#endregion
export { type AppConfig, type AppVariables, Hono, type NativeSandboxConfig, type SSOProviderConfig, type SandboxConfig, type UserAuthConfig, type VercelSandboxConfig, auth, createAgentsApp, createAgentsHono, createAuth0Provider, createOIDCProvider, app as default };