//#region src/oauth/events.d.ts /** * Lifecycle event emitter for the OAuth subsystem. Distinct from the * audit emitter (which targets the tamper-evident chain) - these * events drive in-process consumers like the MCP client (Phase 09) * that needs to react to `mcp.auth.expired` by triggering re-auth. * * @packageDocumentation */ /** * Discriminator for `OAuthLifecycleEvent`. * * @stable */ type OAuthLifecycleEventName = 'oauth.granted' | 'oauth.refreshed' | 'oauth.revoked' | 'oauth.registered' | 'mcp.auth.expired'; /** * Lifecycle event payload. Intentionally minimal so the framework can * keep the same shape across consumers. * * @stable */ interface OAuthLifecycleEvent { readonly type: OAuthLifecycleEventName; readonly serverId: string; readonly ts: number; readonly reason?: string; readonly metadata?: Readonly>; } /** * Callback shape accepted by {@link onOAuthLifecycle}. * * @stable */ type OAuthLifecycleListener = (event: OAuthLifecycleEvent) => void; /** * Subscribe to OAuth lifecycle events. Returns an unsubscribe * function. * * @stable */ declare function onOAuthLifecycle(listener: OAuthLifecycleListener): () => void; /** * Emit a lifecycle event. Listeners that throw are isolated from the * OAuth fast path. * * @stable */ declare function emitOAuthLifecycle(event: OAuthLifecycleEvent): void; /** * Reset the listener set. Used by tests. * * @experimental */ declare function _resetOAuthLifecycleListenersForTesting(): void; //#endregion export { OAuthLifecycleEvent, OAuthLifecycleEventName, OAuthLifecycleListener, _resetOAuthLifecycleListenersForTesting, emitOAuthLifecycle, onOAuthLifecycle }; //# sourceMappingURL=events.d.ts.map