import type { Entity } from '../core/index.js'; /** * The environment's JWT template. Environment-scoped rather than a collection resource, so * it carries no id and lives in store data instead of a collection. */ export interface WorkOSJwtTemplate { object: 'jwt_template'; /** Template string rendering to a JSON object of claims. See workos/jwt-template.ts. */ content: string; created_at: string; updated_at: string; } /** * The environment's AuthKit session settings, from the seed's `sessionSettings`. Environment- * scoped like the JWT template, so it lives in store data; absent, the defaults in constants.ts. */ export interface WorkOSSessionSettings { /** Lifetime in seconds of every access token `/user_management/authenticate` mints. */ access_token_ttl_seconds: number; } export interface WorkOSOrganization extends Entity { object: 'organization'; name: string; external_id: string | null; metadata: Record; stripe_customer_id: string | null; allow_profiles_outside_organization: boolean; /** * Entitlement slugs minted into org-scoped access tokens. Seed-only state: the spec's * organization shape has no such field, so it is never serialized onto the API object. */ entitlements: string[]; /** * The organization's authentication policy allows SSO only, so hosted AuthKit sends whoever the * policy governs to its connection. Seed-only state, like the domain policy below: production * sets both in the Dashboard and the spec's organization shape has neither, so they are never * serialized. Absent means other methods are allowed. */ require_sso?: boolean; /** The verified domains, lowercased, the organization's domain policy covers. */ domain_policy?: string[]; } export interface WorkOSOrganizationDomain extends Entity { object: 'organization_domain'; organization_id: string; domain: string; state: 'verified' | 'pending'; /** * How the domain was, or is being, verified. Production records `manual` on a domain created * already verified and `dns` once verification starts; a pending domain that has not started * verification has none, and the serializers omit the field. */ verification_strategy?: 'manual' | 'dns'; /** The DNS TXT token, minted when verification starts (`POST /organization_domains/{id}/verify`). */ verification_token?: string; /** Branded TXT record prefix. Only production's dashboard flows set one; API-created domains have none. */ verification_prefix?: string; } export interface WorkOSItContact extends Entity { object: 'it_contact'; /** The owning organization. Not serialized: the spec's ItContact addresses it by route. */ organization_id: string; email: string; /** * Admin Portal invitation state. None of it is serialized — the spec's invite and revoke * routes answer 204 and `ItContact` documents no invitation fields — but it is what makes * "an organization can have at most one active invitation" enforceable. */ invited_at: string | null; invite_intents: string[] | null; /** The setup link an invitation would have emailed. Emulator-only; nothing delivers it. */ invite_setup_link: string | null; } export interface WorkOSOrganizationMembership extends Entity { object: 'organization_membership'; organization_id: string; user_id: string; role: { slug: string; }; /** * Every role the membership holds, written in priority order with `role` the priority role. * Production lists `roles` beside the singular `role` once multiple roles are enabled; readers * re-derive both from the current role priorities (membershipRoleSlugs). Absent on rows written * before this field existed, which read as their single `role`. */ roles?: Array<{ slug: string; }>; status: 'active' | 'inactive' | 'pending'; external_id: string | null; metadata: Record; /** True when Directory Sync owns this membership's role. Absent means false. */ directory_managed?: boolean; } /** An AuthKit group within an organization (`/organizations/{org}/groups`). */ export interface WorkOSGroup extends Entity { object: 'group'; organization_id: string; name: string; description: string | null; } /** Join between a group and an organization membership. Internal — never serialized by id. */ export interface WorkOSGroupMembership extends Entity { group_id: string; organization_membership_id: string; } export interface WorkOSUser extends Entity { object: 'user'; email: string; name: string | null; first_name: string | null; last_name: string | null; email_verified: boolean; profile_picture_url: string | null; last_sign_in_at: string | null; external_id: string | null; metadata: Record; locale: string | null; password_hash: string | null; impersonator: { email: string; reason: string; } | null; /** * The OAuth provider this user authenticates with, as a spec-valid * AuthenticateResponse.authentication_method value (e.g. 'GoogleOAuth', 'MicrosoftOAuth'). * Reported as the authentication_method for OAuth-based grants; when unset the emulator omits * the field rather than inventing a provider. Internal-only — excluded from the user response. */ oauth_provider?: string | null; } export interface WorkOSSession extends Entity { object: 'session'; user_id: string; organization_id: string | null; ip_address: string | null; user_agent: string | null; auth_method: string; status: 'active' | 'expired' | 'revoked'; expires_at: string; ended_at: string | null; } /** * The verification state production keeps on every one-time code it issues, whatever delivers * it: a Magic Auth code, an email verification code, and an MFA challenge are all one * authentication challenge underneath, verified by one rule. Neither field is serialized — * no spec shape carries them — but they are what makes a code single-use and three-strikes. */ export interface OneTimeCodeState { /** Comparisons made so far, hit or miss. Production refuses the code outright after three. */ attempts: number; /** When the code was redeemed; a redeemed code answers `one_time_code_previously_used` from then on. */ verified_at: string | null; } export interface WorkOSEmailVerification extends Entity, OneTimeCodeState { object: 'email_verification'; user_id: string; email: string; code: string; expires_at: string; } /** * Field names follow the spec's `PasswordReset` schema — `password_reset_token`, not a bare * `token` — so the stored record serializes as-is. The SDKs deserialize `password_reset_token`; * the wire shape drifted to `token` once already (issue #98). */ export interface WorkOSPasswordReset extends Entity { object: 'password_reset'; user_id: string; email: string; password_reset_token: string; /** Baked at creation from the emulator's base URL, like an invitation's `accept_invitation_url`. */ password_reset_url: string; expires_at: string; } export interface WorkOSMagicAuth extends Entity, OneTimeCodeState { object: 'magic_auth'; user_id: string; email: string; code: string; expires_at: string; } export interface WorkOSAuthenticationFactor extends Entity { object: 'authentication_factor'; user_id: string; type: 'totp'; /** * When a challenge for this factor last verified, production's `last_verified_at`. Null until * the enrollment challenge clears, and that null is what keeps an abandoned enrollment out of * the factor list and out of the password grant's second-factor step. Not serialized: the * spec's AuthenticationFactor has no such field. */ last_verified_at: string | null; totp: { issuer: string; user: string; /** Base32, as authenticator apps take it. Enrollment is the only response that shows it. */ secret: string; uri: string; }; } export interface WorkOSExternalAuthSession extends Entity { client_id: string; redirect_uri: string; state: string | null; expires_at: string; completed_at: string | null; redeemed_at: string | null; user_id: string | null; } /** * What a grant minted on the AuthKit-domain OAuth surface (`/oauth2/authorize` → `/oauth2/token`) * carries beyond an ordinary AuthKit one. Its presence is also the marker that says which token * endpoint may redeem the code or refresh token: `/oauth2/token` takes only these, and * `/user_management/authenticate` refuses them, so a grant can't cross between two issuers. */ export interface ConnectGrant { /** Scopes granted at authorize time; a refresh may narrow them, never widen. */ scope: string[]; /** * The RFC 8707 `resource` as the client asked for it, registered or not. Whether it is a * registered indicator is decided at each mint, so deleting one takes effect on the next refresh. */ resource: string | null; /** OIDC `nonce` from the authorize request; only a code carries one, since only the code exchange issues an `id_token`. */ nonce?: string | null; } export interface WorkOSAuthorizationCode extends Entity { user_id: string; organization_id: string | null; code: string; redirect_uri: string; expires_at: string; code_challenge: string | null; code_challenge_method: string | null; /** The OAuth client that initiated the authorization, bound to the code so the token claim can't be spoofed at redemption. */ client_id: string | null; /** Set on codes minted by `/oauth2/authorize`'s hosted sign-in; redeemable only at `/oauth2/token`. */ connect?: ConnectGrant | null; /** * How the user proved who they were on the way to this code, when the emulator knows. The * interactive password page records 'Password'; the default auto-redirect checks nothing and * leaves this null, so the exchange reports the OAuth grant it always has rather than a method * nobody verified. */ auth_method: string | null; /** * The gate the interactive login cleared last on the way to this code — 'EmailVerification' or * 'MFA' — when it had to clear one. The exchange then reports what the API grant for that step * reports: the gate's event, with the session recording `auth_method` as the primary. Null when * the password alone earned the code, and always null from the auto-redirect. */ step_up_method: string | null; } export interface WorkOSIdentity extends Entity { object: 'identity'; user_id: string; /** An OAuth provider, e.g. 'GoogleOAuth'. The spec supports no other identity type yet. */ provider: string; /** The user's id at the provider. */ idp_id: string; type: 'OAuth'; } /** The spec's Connection `connection_type` enum, in full. */ export type WorkOSConnectionType = 'Pending' | 'ADFSSAML' | 'AdpOidc' | 'AppleOAuth' | 'Auth0Migration' | 'Auth0SAML' | 'AzureSAML' | 'BitbucketOAuth' | 'CasSAML' | 'ClassLinkSAML' | 'CleverOIDC' | 'CloudflareSAML' | 'CyberArkSAML' | 'DuoSAML' | 'EntraIdOIDC' | 'GenericOIDC' | 'GenericSAML' | 'GitHubOAuth' | 'GitLabOAuth' | 'GoogleOAuth' | 'GoogleOIDC' | 'GoogleSAML' | 'IntuitOAuth' | 'JumpCloudSAML' | 'KeycloakSAML' | 'LastPassSAML' | 'LinkedInOAuth' | 'LoginGovOidc' | 'MagicLink' | 'MicrosoftOAuth' | 'MiniOrangeSAML' | 'NetIqSAML' | 'OktaOIDC' | 'OktaSAML' | 'OneLoginSAML' | 'OracleSAML' | 'PingFederateSAML' | 'PingOneSAML' | 'RipplingSAML' | 'SalesforceSAML' | 'ShibbolethGenericSAML' | 'ShibbolethSAML' | 'SimpleSamlPhpSAML' | 'SalesforceOAuth' | 'SlackOAuth' | 'TestIdp' | 'VercelMarketplaceOAuth' | 'VercelOAuth' | 'VMwareSAML' | 'XeroOAuth'; export interface WorkOSConnectionDomain { object: 'connection_domain'; id: string; domain: string; } export interface WorkOSConnection extends Entity { object: 'connection'; organization_id: string; connection_type: WorkOSConnectionType; name: string; state: 'active' | 'inactive' | 'validating'; domains: WorkOSConnectionDomain[]; } export interface WorkOSSSOProfile extends Entity { object: 'profile'; connection_id: string; connection_type: WorkOSConnectionType; organization_id: string; idp_id: string; email: string; first_name: string | null; last_name: string | null; /** * The full name, stored as its own attribute the way production stores it: the reconciler * sets it only when the connection's attribute map has a `name` key, and never composes it * from the two parts. Null for every profile the emulator mints itself. */ name: string | null; groups: string[]; raw_attributes: Record; } export interface WorkOSSSOAuthorization extends Entity { code: string; connection_id: string; organization_id: string; profile_id: string; redirect_uri: string; state: string | null; /** * The client that started the authorization. The exchange binds the token to it, as it binds * a hosted code's, rather than to whatever `client_id` the redeeming request sends; null only * on a record persisted before the field was recorded. */ client_id: string | null; /** * PKCE, carried from a `/user_management/authorize` request that named a connection or an * organization and was handed to `/sso/authorize`: the exchange at * `/user_management/authenticate` holds the code to it as it holds a hosted one. Null for an * authorization `/sso/authorize` started on its own, which takes no challenge. */ code_challenge: string | null; code_challenge_method: string | null; expires_at: string; } /** * An invitation stores what happened to it, not a state: `state` is derived from `revoked_at`, * `accepted_at` and `expires_at` when it is read (see `invitationState`), as production derives * it, so an invitation expires on its own. */ export interface WorkOSInvitation extends Entity { object: 'invitation'; email: string; token: string; accept_invitation_url: string; organization_id: string | null; inviter_user_id: string | null; role_slug: string | null; expires_at: string; accepted_at: string | null; revoked_at: string | null; accepted_user_id: string | null; } export interface WorkOSRedirectUri extends Entity { object: 'redirect_uri'; uri: string; } /** * An MCP resource indicator (RFC 8707) registered for the environment. The `resource` an * `/oauth2/authorize` or `/oauth2/token` request names becomes the token's `aud` only when it * matches one of these; see `authkit_oauth_resources` in the spec. */ export interface WorkOSAuthkitOauthResource extends Entity { object: 'authkit_oauth_resource'; uri: string; /** The environment default. At most one resource holds it; setting it clears the previous holder. */ default: boolean; } export interface WorkOSCorsOrigin extends Entity { object: 'cors_origin'; origin: string; } export interface WorkOSAuthorizedApplication extends Entity { object: 'authorized_application'; user_id: string; name: string; redirect_uri: string; } /** * States a stored connected account can hold. The spec's enum also has `disconnected`, but * disconnecting an account is deleting it — that value is observable only in the * `pipes.connected_account.disconnected` event a deletion emits, never on a stored row, * so a fresh import after a disconnect can't be answered 409 by a row that no longer works. */ export type ConnectedAccountState = 'connected' | 'needs_reauthorization'; /** Who owns a connected account: the user, or the organization they act for. */ export type ConnectionOwner = 'user' | 'organization'; export interface WorkOSConnectedAccount extends Entity { object: 'connected_account'; /** `null` for an organization-owned account: the organization owns it, not the member who connected it. */ user_id: string | null; organization_id: string | null; /** Provider slug the account is addressed by (`github`, `slack`, …). Not part of the spec's REST shape — requests carry it in the path, events as `provider_slug`. */ provider: string; /** The environment's integration for this provider; every account of one slug shares it. */ data_integration_id: string; scopes: string[]; /** The import DTO and seed only describe OAuth connections, so this is the one value the emulator can be told. */ auth_method: 'oauth'; api_key_last_4: null; state: ConnectedAccountState; /** Always `compatibility`: without the multiple-connections contract, each owner holds one account per provider. */ connection_role: 'compatibility'; /** Developer-attested correlation metadata, never a selector. */ account_identifier: string | null; /** A mutable, non-unique label. */ account_display_name: string | null; /** * The member who established the account: who connected it through an authorize URL, or who * imported or was seeded as establishing an organization's account. `null` for a user's own * imported or seeded account, which is developer-managed, and once that member is deleted. */ established_by_user_id: string | null; /** Tokens the import/update endpoints were given. Kept because deleting the account is specified to remove them; never serialized. */ access_token: string | null; refresh_token: string | null; token_expires_at: string | null; } export type PipeProvider = 'github' | 'slack' | 'google' | 'salesforce'; export type PipeConnectionStatus = 'connected' | 'disconnected' | 'requires_reauth'; export interface WorkOSPipeConnection extends Entity { object: 'pipe_connection'; user_id: string; provider: PipeProvider; scopes: string[]; status: PipeConnectionStatus; external_account_id: string | null; } export interface WorkOSRefreshToken extends Entity { token: string; user_id: string; organization_id: string | null; session_id: string; expires_at: string; /** The client_id the original access token was minted for, carried forward across refresh rotations. */ client_id: string | null; /** Set when the token was issued by `/oauth2/token`; only that endpoint may rotate it. */ connect?: ConnectGrant | null; /** * When this token was exchanged for its successor; null while it is the live token. A retired * token stays stored through the replay grace period so a concurrent or retried refresh can * converge on the same rotation instead of failing. Internal bookkeeping, never serialized. */ exchanged_at: string | null; /** The id of the token the exchange minted; null while this token is the live one. */ exchanged_for_id: string | null; } export interface WorkOSAuthenticationChallenge extends Entity, OneTimeCodeState { object: 'authentication_challenge'; user_id: string; factor_id: string; expires_at: string; /** * The code the challenge accepts. Production derives a TOTP code from the factor's secret; * the emulator mints one at challenge time instead, so a test reads it off the store. */ code: string; } export interface WorkOSDeviceAuthorization extends Entity { device_code: string; user_code: string; user_id: string | null; client_id: string; expires_at: string; interval: number; } export interface WorkOSRole extends Entity { object: 'role'; slug: string; name: string; description: string | null; type: 'EnvironmentRole' | 'OrganizationRole'; organization_id: string | null; is_default_role: boolean; priority: number; resource_type_slug?: string; } export interface WorkOSPermission extends Entity { object: 'permission'; slug: string; name: string; description: string | null; resource_type_slug?: string; } export interface WorkOSRolePermission extends Entity { role_id: string; permission_id: string; } export interface WorkOSAuthorizationResource extends Entity { object: 'authorization_resource'; resource_type_slug: string; external_id: string; organization_id: string; name: string | null; description: string | null; parent_resource_id: string | null; metadata: Record; } export interface WorkOSRoleAssignment extends Entity { object: 'role_assignment'; organization_membership_id: string; /** Present only for assignments derived from a native group's grant. */ group_role_assignment_id?: string; /** The group whose grant this assignment derives from; set alongside group_role_assignment_id. */ group?: { id: string; name: string; }; role_id: string; role_slug: string; resource_id: string | null; resource_external_id: string | null; resource_type_slug: string | null; } /** * A role granted to a native AuthKit group on one resource. Unlike a direct * assignment, a group grant is always resource-scoped: production resolves an * omitted resource to the organization's own resource, so these are never null. */ export interface WorkOSGroupRoleAssignment extends Entity { object: 'group_role_assignment'; group_id: string; role_id: string; role_slug: string; resource_id: string; resource_external_id: string; resource_type_slug: string; } export interface WorkOSDirectory extends Entity { object: 'directory'; name: string; organization_id: string | null; domain: string | null; type: string; state: 'linked' | 'unlinked' | 'deleting' | 'invalid_credentials'; external_key: string; } export interface WorkOSDirectoryUser extends Entity { object: 'directory_user'; directory_id: string; organization_id: string | null; idp_id: string; first_name: string | null; last_name: string | null; email: string | null; username: string | null; state: 'active' | 'inactive'; role: { slug: string; } | null; custom_attributes: Record; raw_attributes: Record; groups: Array<{ object: 'directory_group'; id: string; name: string; }>; } export interface WorkOSDirectoryGroup extends Entity { object: 'directory_group'; directory_id: string; organization_id: string | null; idp_id: string; name: string; raw_attributes: Record; } export interface WorkOSAuditLogAction extends Entity { object: 'audit_log_action'; name: string; description: string | null; condition: string | null; } /** The `actor` of an ingested event, as `AuditLogEventActorDto` takes it. */ export interface WorkOSAuditLogEventActor { id: string; type: string; name?: string | null; metadata?: Record | null; } /** One of an ingested event's `targets`, as `AuditLogEventTargetDto` takes it. */ export interface WorkOSAuditLogEventTarget { id: string; type: string; name?: string | null; metadata?: Record | null; } /** The `context` of an ingested event: where it happened, as `AuditLogEventContextDto` takes it. */ export interface WorkOSAuditLogEventContext { location: string; user_agent?: string | null; } /** * An ingested audit log event, kept the way production keeps the validated `event` body it was * sent: `action` is the bare action name, `version` has been defaulted, and `idempotency_key` is * what a retried request is matched against. Nothing serves it back out — production has no * read endpoint for events either; exports are the read path. */ export interface WorkOSAuditLogEvent extends Entity { object: 'audit_log_event'; organization_id: string; action: string; occurred_at: string; actor: WorkOSAuditLogEventActor; targets: WorkOSAuditLogEventTarget[]; context: WorkOSAuditLogEventContext; metadata?: Record | null; version: number; idempotency_key: string; } export interface WorkOSAuditLogExport extends Entity { object: 'audit_log_export'; organization_id: string; state: 'pending' | 'ready' | 'error'; url: string | null; filters: Record; } export interface WorkOSFeatureFlagOwner { email: string; first_name: string | null; last_name: string | null; } export interface WorkOSFeatureFlag extends Entity { object: 'feature_flag'; slug: string; name: string; description: string | null; owner: WorkOSFeatureFlagOwner | null; tags: string[]; enabled: boolean; /** Value returned for resources matching no target. Production flags are boolean-only. */ default_value: boolean; } /** * A resource the flag is switched on for. Production targeting is membership, not assignment: * `POST /feature-flags/{slug}/targets/{resourceId}` takes no body, so a target's mere existence * means "on for this resource" and there is no value to store or to turn a flag back off with. */ export interface WorkOSFlagTarget extends Entity { object: 'flag_target'; flag_slug: string; resource_id: string; resource_type: 'user' | 'organization'; /** * Reported to the SDK runtime client, whose evaluator skips a target unless this is true. * Always true for targets created over the API — the create route carries no body — but * the field is real on the wire, so it is stored rather than hardcoded at serialization. */ enabled: boolean; /** * The rule this target belongs to, as production's targets carry one. The v2 SDK poll payload * groups a flag's targets into rules — one `one_of` condition per target type — and the runtime * client diffs rules by id from one poll to the next, so the id has to be the same on every * poll. The first target of a type mints it and later ones share it; see `flagRuleIdFor`. */ rule_id: string; } export interface WorkOSConnectApplication extends Entity { object: 'connect_application'; name: string; description: string | null; application_type: 'oauth' | 'm2m'; /** Required for m2m applications; the organization the app belongs to. */ organization_id: string | null; scopes: string[]; /** The `aud` claim minted into m2m tokens. Falls back to client_id when null. */ audience: string | null; redirect_uris: string[]; /** oauth only. A third-party application (`false`) names the organization it belongs to. */ is_first_party: boolean; /** oauth third-party only: registered through dynamic client registration rather than the dashboard. */ was_dynamically_registered: boolean; uses_pkce: boolean; /** * oauth, dynamic registration only (RFC 7591): the metadata the client registered, stored as * production stores it and not enforced at `/oauth2/token`, where production reads neither. * Undefined on a seeded or dashboard-created application. */ grant_types?: string[]; response_types?: string[]; token_endpoint_auth_method?: 'none' | 'client_secret_post' | 'client_secret_basic'; /** Emulator-only Standalone Connect login page; never serialized on the API application. */ login_url: string | null; client_id: string; logo_url: string | null; } export interface WorkOSClientSecret extends Entity { object: 'connect_application_secret'; application_id: string; /** The plaintext secret. Returned once at creation and never serialized again. */ value: string; secret_hint: string; last_used_at: string | null; } export interface WorkOSDataIntegrationAuth extends Entity { slug: string; code: string; redirect_uri: string; state: string | null; expires_at: string; } /** * A pending `POST /data-integrations/{slug}/authorize`: the URL it returns carries `token`, and * visiting that URL connects the account the request described. */ export interface WorkOSDataIntegrationAuthorization extends Entity { slug: string; token: string; connection_owner: ConnectionOwner; user_id: string; organization_id: string | null; return_to: string | null; /** The label connecting applies; omitted when the request left it out, so an existing label is kept. */ account_display_name?: string | null; expires_at: string; } export interface WorkOSRadarAttempt extends Entity { object: 'radar_attempt'; user_id: string | null; ip_address: string; user_agent: string | null; verdict: 'allow' | 'deny' | 'challenge'; signals: Array<{ type: string; confidence: number; }>; } /** The entity that owns an API key. Mirrors the spec's discriminated `owner` union. */ export type WorkOSApiKeyOwner = { type: 'organization'; id: string; } | { type: 'user'; id: string; organization_id: string; }; export interface WorkOSApiKey extends Entity { object: 'api_key'; name: string; /** Full secret value, e.g. `sk_test_...`. Internal — never serialized; only `obfuscated_value` is returned. */ key: string; /** Internal — used to register the key in the auth allow-list; never serialized. */ environment: string; owner: WorkOSApiKeyOwner; permissions: string[]; last_used_at: string | null; expires_at: string | null; } export interface WorkOSVaultObjectVersion { id: string; created_at: string; current_version: boolean; size: number; etag: string; } export interface WorkOSVaultObject extends Entity { name: string; value: string; key_context: Record; environment_id: string; key_id: string; updated_by: { id: string; name: string; }; version_id: string; versions: WorkOSVaultObjectVersion[]; } export interface WorkOSEvent extends Entity { object: 'event'; event: string; data: Record; /** * The organization the event occurred within, which is what the list endpoint's * `organization_id` filter selects on. Internal — the spec's Event has no such field — and * kept apart from `data`, which cannot stand in for it: `group.member_added` carries only * ids, and `organization.created` carries the organization itself. Resolved when the event * is recorded, so it outlives the rows it refers to. */ organization_id: string | null; environment_id: string | null; /** * The spec's per-event `context` envelope. Only flag events populate it so far — the * emulator has no actor model for the rest — so it is omitted rather than faked elsewhere. */ context?: Record; } export interface WorkOSWebhookEndpoint extends Entity { object: 'webhook_endpoint'; endpoint_url: string; secret: string; /** `enabled` or `disabled`, the wire vocabulary `PATCH /webhook_endpoints/:id` sets it with. */ status: 'enabled' | 'disabled'; /** Subscribed event names. Empty subscribes to everything — reachable only through a seed. */ events: string[]; } export interface WorkOSAgentBlueprintInvocableBy { /** Membership role slugs allowed to start delegated sessions; empty means any member. */ role_slugs: string[]; /** Organizations allowed to invoke the blueprint; empty means every organization. */ organization_ids: string[]; } export interface WorkOSAgentBlueprintSessionSettings { /** Hard ceiling on how long any session chain rooted in a blueprint may live, in seconds. */ max_age_seconds: number; access_token_ttl_seconds: number; refresh_token_ttl_seconds: number; } export interface WorkOSAgentBlueprint extends Entity { object: 'agent_blueprint'; name: string; description: string | null; /** Permission slugs that cap what any instance of this blueprint may be granted. */ permissions: string[]; invocable_by: WorkOSAgentBlueprintInvocableBy; session_settings: WorkOSAgentBlueprintSessionSettings; } /** * One instance exists per (blueprint, organization) for autonomous sessions and per * (blueprint, organization, membership) for user-delegated ones; minting reuses it. */ export interface WorkOSAgentInstance extends Entity { object: 'agent_instance'; agent_blueprint_id: string; organization_id: string; organization_membership_id: string | null; type: 'autonomous' | 'delegated'; } export interface WorkOSAgentInstanceSession extends Entity { object: 'agent_instance_session'; agent_instance_id: string; expires_at: string; revoked_at: string | null; /** Current refresh token; replaced on every refresh so a presented token is single-use. */ refresh_token: string; /** Session this one was chained from via an `agent_delegated` grant; null for chain roots. */ parent_session_id: string | null; /** Backing user session of a delegated chain root; only the root records it. */ user_session_id: string | null; /** Permission slugs granted at the last mint, reported on the session-created event. */ permissions: string[]; intent: string | null; }