import type { ActivityStore } from "./activity-log.js"; import type { ConnectorConfig } from "./config.js"; import type { DiscordClient } from "./discord-client.js"; import type { GatewayInteractionHandler } from "./discord-gateway.js"; import type { ScopePolicy } from "./policy.js"; import { type RequestButtonStyle } from "./request-button.js"; import type { RequestOptions } from "./types.js"; export type NativeInteractionChangeKind = "continuations" | "pending" | "status"; export type NativeInteractionChangeListener = (kind: NativeInteractionChangeKind) => void; export type NativeInteractionBrokerPhase = "checking" | "disabled" | "failed" | "ready" | "stopped"; export type NativeInteractionErrorCategory = "activity-unavailable" | "application-endpoint-conflict" | "callback-rejected" | "callback-uncertain" | "capacity-rejected" | "channel-evidence-invalid" | "command-contract-mismatch" | "command-inventory-invalid" | "continuation-reference-unavailable" | "followup-evidence-invalid" | "followup-rejected" | "followup-uncertain" | "identity-mismatch" | "payload-invalid" | "reference-unavailable" | "request-button-evidence-invalid" | "response-evidence-invalid" | "response-rejected" | "response-uncertain" | "scope-rejected" | "validation-evidence-unavailable"; export type NativeInteractionSourceKind = "command" | "request-button"; export interface PendingNativeInteraction { channelId: string; commandId: string | null; commandVersion: string | null; createdAt: string; expiresAt: string; guildId: string; interactionId: string; reference: string; request: string; requestButtonIndex: number | null; requestButtonStyle: RequestButtonStyle | null; schemaVersion: number; source: NativeInteractionSourceKind; sourceMessageId: string | null; userId: string; } export interface PendingNativeInteractionList { interactions: PendingNativeInteraction[]; page: { capacity: number; returned: number; }; schemaVersion: number; status: "disabled" | "ok" | "unavailable"; } export interface NativeInteractionContinuation { channelId: string; commandId: string | null; commandVersion: string | null; createdAt: string; expiresAt: string; followupsCompleted: number; followupsRemaining: number; guildId: string; interactionId: string; openedAt: string; reference: string; requestButtonIndex: number | null; requestButtonStyle: RequestButtonStyle | null; schemaVersion: number; source: NativeInteractionSourceKind; sourceMessageId: string | null; userId: string; } export interface NativeInteractionContinuationList { continuations: NativeInteractionContinuation[]; page: { capacity: number; returned: number; }; schemaVersion: number; status: "disabled" | "ok" | "unavailable"; } export interface NativeInteractionContinuationResult { expiresAt: string; followupsRemaining: number; reference: string; } export interface NativeInteractionBrokerStatus { command: { guildCount: number; name: string; verifiedGuildCount: number; }; enabled: boolean; lastError: { at: string; category: NativeInteractionErrorCategory; } | null; limits: { maximumFollowups: number; maximumPending: number; pendingPerUser: number; requestCharacters: number; responseCharacters: number; ttlSeconds: number; }; pending: { count: number; validating: number; }; continuations: { count: number; }; phase: NativeInteractionBrokerPhase; schemaVersion: number; totals: { accepted: number; continuationsExpired: number; expired: number; followups: number; rejected: number; responded: number; uncertain: number; }; } export interface NativeInteractionRequestButtonReadiness { commandId: string | null; commandVersion: string | null; gatewayDelivery: "verified" | null; guildId: string; phase: NativeInteractionBrokerPhase; ready: boolean; schemaVersion: number; } export interface NativeInteractionResponseResult { channelId: string; guildId: string; interactionId: string; continuation: NativeInteractionContinuationResult | null; reference: string; responseMessageId: string; schemaVersion: number; status: "completed"; } export interface NativeInteractionFollowupResult { channelId: string; continuation: NativeInteractionContinuationResult | null; followupsCompleted: number; guildId: string; interactionId: string; reference: string; responseMessageId: string; schemaVersion: number; status: "completed"; verification: "response-and-readback-match"; } export interface NativeInteractionResponseOptions extends RequestOptions { keepOpen?: boolean; } export interface NativeInteractionSource { readonly enabled: boolean; getRequestButtonReadiness(guildId: string): Promise; getStatus(): NativeInteractionBrokerStatus; listContinuations(): Promise; listPending(): Promise; followup(reference: string, response: string, options?: NativeInteractionResponseOptions): Promise; respond(reference: string, response: string, options?: NativeInteractionResponseOptions): Promise; subscribe(listener: NativeInteractionChangeListener): () => void; } export interface NativeInteractionRuntime extends NativeInteractionSource, GatewayInteractionHandler { start(): Promise; stop(): Promise; } export interface NativeInteractionBrokerClient extends Pick { } export interface NativeInteractionScheduler { clearTimeout(handle: unknown): void; setTimeout(handler: () => void, milliseconds: number): unknown; } export interface NativeInteractionBrokerOptions { activityStore: ActivityStore; applicationId: string; botId: string; client: NativeInteractionBrokerClient; clock?: () => Date; config: Pick; policy: ScopePolicy; randomId?: () => string; randomContinuationReference?: () => string; randomReference?: () => string; requestButtonKey: Uint8Array; scheduler?: NativeInteractionScheduler; } export declare class NativeInteractionBroker implements NativeInteractionRuntime { #private; constructor(options: NativeInteractionBrokerOptions); get enabled(): boolean; start(): Promise; getStatus(): NativeInteractionBrokerStatus; getRequestButtonReadiness(guildId: string): Promise; subscribe(listener: NativeInteractionChangeListener): () => void; ingestInteraction(payload: unknown): Promise; listPending(): Promise; listContinuations(): Promise; respond(reference: string, response: string, options?: NativeInteractionResponseOptions): Promise; followup(reference: string, response: string, options?: NativeInteractionResponseOptions): Promise; stop(): Promise; } export declare function createDisabledNativeInteractionSource(config: Pick): NativeInteractionSource; //# sourceMappingURL=native-interaction-broker.d.ts.map