/** * The legacy Codex account, rotation and source shapes the Codex routes * return. A leaf module so both the legacy accessors in the root barrel and * the shared-core projections (`subscription-core-codex-compat`) use them * without importing the root barrel. */ import type { CodexPlanEntitlementExclusion } from "./codex-plan-entitlement.js"; import type { CodexCredentialCooldownKind } from "./codex-token-resolver.js"; export type WorkspaceCodexSubscriptionMode = "automatic" | "workspace" | "organization" | "disabled"; export type EffectiveCodexSubscriptionSource = "workspace" | "organization" | "disabled"; export type WorkspaceCodexSubscriptionSource = { accountId: string; workspaceId: string; workspaceKind: "personal" | "shared"; mode: WorkspaceCodexSubscriptionMode; effectiveSource: EffectiveCodexSubscriptionSource; workspaceAvailable: boolean; organizationAvailable: boolean; /** Some of the workspace's own accounts are not in use here. Absent from older servers. */ workspaceSetAside?: boolean; /** * How many organization accounts other than the workspace's own reach this * workspace (accounts limited to chosen people aside). Absent from older servers. */ organizationCount?: number; }; export type CodexAccountStatus = { allowedModelIds?: string[] | null; /** * The workspace whose own account this is, or null for the organization's * and personal accounts. In another workspace's list it was shared there * by its owner (D-52), and that workspace can only remove it. */ ownerWorkspaceId?: string | null; /** * Organization list only: shared workspaces that list the account among * their own (it was connected there). */ ownInWorkspaceIds?: string[]; /** Organization list only: who the account reaches. */ reach?: import("./subscription-core/administration.js").SubscriptionCoreConnectionReach; id: string; source: Exclude; chatgptAccountId: string | null; label: string | null; accountEmail: string | null; planType: string | null; /** Last provider plan observation; absent on pre-plan-tracking fixtures. */ planCheckedAt?: Date | null; /** Plan before the most recent observed plan change, and when it was seen. */ planPreviousType?: string | null; planChangedAt?: Date | null; /** Models the current plan was proven not to include (see codex-plan-entitlement). */ planEntitlementExclusion?: CodexPlanEntitlementExclusion | null; status: string; /** New automatic allocations only; health/refresh and existing turns remain independent. */ /** Spending consent is account-owned and off until explicitly enabled. */ extraCreditsEnabled?: boolean; extraCreditsVersion?: number; extraCreditsUpdatedBySubjectId?: string | null; extraCreditsUpdatedAt?: Date | null; includedUsageUnavailableUntil?: Date | null; allocatorEnabled: boolean; allocatorVersion: number; allocatorUpdatedBySubjectId: string | null; allocatorUpdatedAt: Date | null; resetCreditAvailableCount: number | null; resetCreditsCheckedAt: Date | null; connectedBySubjectId: string | null; isActive: boolean; expiresAt: Date | null; lastRefreshAt: Date | null; /** When the account was last signed in (connected or reconnected); null when unknown. */ signedInAt: Date | null; lastError: string | null; primaryUsedPercent: number | null; primaryResetAt: Date | null; secondaryUsedPercent: number | null; secondaryResetAt: Date | null; usageCheckedAt: Date | null; exhaustedUntil: Date | null; /** Typed provider-refusal provenance; null for legacy/cleared cooldowns. */ exhaustedKind: CodexCredentialCooldownKind | null; }; export type CodexRotationSettings = { activeCredentialId: string | null; /** False keeps new allocations on the active account; true permits pool failover. */ rotationEnabled: boolean; rotationStrategy: string; };