import type { RuntimeContext } from "../runtime/state/context.js"; import type { StateStack } from "../runtime/state/stateStack.js"; import type { ThreadStore } from "../runtime/state/threadStore.js"; export type OAuthConfig = { authUrl: string; tokenUrl: string; clientId: string; clientSecret: string; scopes: string | string[]; port?: number; extraAuthParams?: string | Record; }; /** * Deprecated context-injected wrapper kept in place during the ALS * migration so the registry/codegen path keeps working until the * follow-up cleanup PR removes it. New stdlib `.agency` files should * call `_authorize` instead. * * Context-injected: the 5-minute callback wait, the local server, and * the token-exchange `fetch` all see the abort signal so an aborted * run doesn't leave a server listening on the OAuth port. */ export declare function __internal_authorize(ctx: RuntimeContext, stack: StateStack, _threads: ThreadStore, name: string, config: OAuthConfig): Promise<{ success: boolean; }>; /** * ALS-reading replacement for `__internal_authorize`. Reads ctx/stack * from the AsyncLocalStorage frame so callers (both agency-side and * internal stdlib callers like `calendar.ts`'s `_authorizeCalendar`) * get full cancellation without needing to thread params. */ export declare function _authorize(name: string, config: OAuthConfig): Promise<{ success: boolean; }>; /** * Deprecated context-injected wrapper kept in place during the ALS * migration; see comment on `__internal_authorize`. New stdlib * `.agency` files should call `_getAccessToken` instead. * * Context-injected: a refresh-token exchange `fetch` can stall on * a slow OAuth provider; abort tears it down. */ export declare function __internal_getAccessToken(ctx: RuntimeContext, stack: StateStack, _threads: ThreadStore, name: string): Promise; /** * ALS-reading replacement for `__internal_getAccessToken`. Reads * ctx/stack from the AsyncLocalStorage frame so callers (both * agency-side and internal stdlib callers like `calendar.ts`) get * full refresh-token cancellation without needing to thread params. */ export declare function _getAccessToken(name: string): Promise; export declare function _isAuthorized(name: string): Promise; export declare function _revokeAuth(name: string): Promise<{ revoked: boolean; }>;