shardwire 1.4.0 → 1.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -106,7 +106,7 @@ app.on(
106
106
  ## Startup lifecycle
107
107
 
108
108
  - **`createBotBridge(...)`** starts the WebSocket server immediately; `await bridge.ready()` resolves when the Discord client has finished its initial `ready` handshake (same timing you would expect from a normal bot login).
109
- - **Register `app.on(...)` handlers before `await app.ready()`** so subscriptions are known when the app authenticates. `ready()` connects, completes auth, negotiates capabilities from intents + secret scope, then throws `BridgeCapabilityError` if any registered handler targets an event the app is not allowed to receive.
109
+ - **Register `app.on(...)` handlers before `await app.ready()`** so subscriptions are known when the app authenticates. `ready()` connects, completes auth, negotiates capabilities from intents + secret scope, then throws `BridgeCapabilityError` if any registered handler targets an event the app is not allowed to receive. To probe connectivity and negotiated caps first (and validate a planned surface with `desired`), use **`await app.preflight(desired)`** before registering handlers.
110
110
  - **Sticky `ready`**: if the bot was already ready before the app connected, the bridge replays the latest `ready` payload to matching subscriptions after auth.
111
111
 
112
112
  ## Built-In Events
@@ -270,6 +270,16 @@ const capabilities = app.capabilities();
270
270
  console.log(capabilities.events, capabilities.actions);
271
271
  ```
272
272
 
273
+ ### Discovery, preflight, and workflow helpers
274
+
275
+ - **`app.catalog()`** — static list of built-in events (with required gateway intents), actions, and subscription filter keys (no connection required).
276
+ - **`getShardwireCatalog()`** — same data without an `AppBridge` instance.
277
+ - **`app.explainCapability({ kind: 'event' | 'action', name })`** — whether a name is built-in and, after connect, whether the negotiated bridge allows it.
278
+ - **`app.preflight(desired?)`** — awaits auth, returns `issues[]` (errors/warnings) for transport hints, `desired` vs negotiated caps, and subscription/capability mismatches. Prefer calling **before** `app.on(...)` if you want to validate `desired.events` / `desired.actions` without registering handlers yet.
279
+ - **Workflows** — `deferThenEditInteractionReply`, `deferUpdateThenEditInteractionReply`, `createThreadThenSendMessage` chain common action sequences.
280
+
281
+ `FORBIDDEN` results for actions outside negotiated capabilities include `error.details.reasonCode === 'action_not_in_capabilities'`. `BridgeCapabilityError` from `ready()` / `on()` may include `details.requiredIntents` for disallowed event subscriptions.
282
+
273
283
  ## Run the Included Examples
274
284
 
275
285
  ### Minimal (single shared secret)
@@ -319,13 +329,21 @@ SHARDWIRE_SECRET_MODERATION=moderation-secret \
319
329
  ## Public API
320
330
 
321
331
  ```ts
322
- import { createBotBridge, connectBotBridge } from 'shardwire';
332
+ import {
333
+ connectBotBridge,
334
+ createBotBridge,
335
+ createThreadThenSendMessage,
336
+ deferThenEditInteractionReply,
337
+ getShardwireCatalog,
338
+ } from 'shardwire';
323
339
  ```
324
340
 
325
341
  Main exports include:
326
342
 
327
343
  - `createBotBridge(options)`
328
344
  - `connectBotBridge(options)`
345
+ - `getShardwireCatalog()`
346
+ - `deferThenEditInteractionReply`, `deferUpdateThenEditInteractionReply`, `createThreadThenSendMessage`
329
347
  - `BridgeCapabilityError`
330
348
  - bot/app option types
331
349
  - normalized event payload types (for example `BridgeMessage`, `BridgeInteraction`, `BridgeGuildMember`)
package/dist/index.d.mts CHANGED
@@ -469,6 +469,51 @@ interface EventSubscriptionFilter {
469
469
  /** Matches guild thread channels only: same as message `channelId` when `channelType` is a guild thread. */
470
470
  threadId?: Snowflake | readonly Snowflake[];
471
471
  }
472
+ /** Keys supported on `EventSubscriptionFilter` for `app.on(..., filter)`. */
473
+ type ShardwireSubscriptionFilterKey = keyof EventSubscriptionFilter;
474
+ /** One built-in event and its gateway intent requirements (for `app.catalog()`). */
475
+ interface ShardwireCatalogEvent {
476
+ name: BotEventName;
477
+ requiredIntents: readonly BotIntentName[];
478
+ }
479
+ /** Static discovery surface for built-in events, actions, and subscription filters. */
480
+ interface ShardwireCatalog {
481
+ events: readonly ShardwireCatalogEvent[];
482
+ actions: readonly BotActionName[];
483
+ subscriptionFilters: readonly ShardwireSubscriptionFilterKey[];
484
+ }
485
+ type CapabilityExplanationKind = 'event' | 'action';
486
+ type CapabilityExplanationReasonCode = 'unknown_name' | 'not_negotiated' | 'allowed' | 'denied_by_bridge';
487
+ /** Result of `app.explainCapability(...)`. */
488
+ interface CapabilityExplanation {
489
+ kind: CapabilityExplanationKind;
490
+ name: string;
491
+ /** Whether this name is a built-in Shardwire event or action. */
492
+ known: boolean;
493
+ /** Required gateway intents when `kind` is `event` and `known`. */
494
+ requiredIntents?: readonly BotIntentName[];
495
+ /** After authentication, whether the bridge allows this capability. */
496
+ allowedByBridge?: boolean;
497
+ reasonCode: CapabilityExplanationReasonCode;
498
+ remediation?: string;
499
+ }
500
+ type PreflightIssueSeverity = 'error' | 'warning';
501
+ interface PreflightIssue {
502
+ severity: PreflightIssueSeverity;
503
+ code: string;
504
+ message: string;
505
+ remediation?: string;
506
+ }
507
+ interface PreflightReport {
508
+ ok: boolean;
509
+ connected: boolean;
510
+ capabilities: BridgeCapabilities | null;
511
+ issues: PreflightIssue[];
512
+ }
513
+ interface PreflightDesired {
514
+ events?: readonly BotEventName[];
515
+ actions?: readonly BotActionName[];
516
+ }
472
517
  interface EventSubscription<K extends BotEventName = BotEventName> {
473
518
  name: K;
474
519
  filter?: EventSubscriptionFilter;
@@ -566,10 +611,19 @@ interface ActionFailure {
566
611
  error: ActionError;
567
612
  }
568
613
  type ActionResult<T> = ActionSuccess<T> | ActionFailure;
614
+ /** Structured context on `BridgeCapabilityError` and capability-related action failures. */
615
+ interface BridgeCapabilityErrorDetails {
616
+ reasonCode: 'not_in_capabilities' | 'unknown_event' | 'unknown_action';
617
+ kind?: 'event' | 'action';
618
+ name?: string;
619
+ remediation: string;
620
+ requiredIntents?: readonly BotIntentName[];
621
+ }
569
622
  declare class BridgeCapabilityError extends Error {
570
623
  readonly kind: 'event' | 'action';
571
624
  readonly name: string;
572
- constructor(kind: 'event' | 'action', name: string, message?: string);
625
+ readonly details?: BridgeCapabilityErrorDetails | undefined;
626
+ constructor(kind: 'event' | 'action', name: string, message?: string, details?: BridgeCapabilityErrorDetails | undefined);
573
627
  }
574
628
  type EventHandler<K extends BotEventName> = (payload: BotEventPayloadMap[K]) => void;
575
629
  type AppBridgeActionInvokeOptions = {
@@ -596,6 +650,27 @@ interface AppBridge {
596
650
  connected(): boolean;
597
651
  connectionId(): string | null;
598
652
  capabilities(): BridgeCapabilities;
653
+ /**
654
+ * Static discovery: built-in events (with intent hints), actions, and subscription filter keys.
655
+ * Does not require a connection.
656
+ */
657
+ catalog(): ShardwireCatalog;
658
+ /**
659
+ * Explain whether an event or action is built-in and whether the current connection allows it.
660
+ * Call after `await app.ready()` for `allowedByBridge` / `reasonCode` beyond `not_negotiated`.
661
+ */
662
+ explainCapability(query: {
663
+ kind: 'event';
664
+ name: BotEventName;
665
+ } | {
666
+ kind: 'action';
667
+ name: BotActionName;
668
+ }): CapabilityExplanation;
669
+ /**
670
+ * Run startup diagnostics after authenticating. Does not throw on subscription/capability mismatches;
671
+ * use `report.ok` and `report.issues`. Call before `app.on(...)` to validate `desired` against negotiated caps.
672
+ */
673
+ preflight(desired?: PreflightDesired): Promise<PreflightReport>;
599
674
  on<K extends BotEventName>(name: K, handler: EventHandler<K>, filter?: EventSubscriptionFilter): Unsubscribe;
600
675
  off<K extends BotEventName>(name: K, handler: EventHandler<K>): void;
601
676
  }
@@ -604,4 +679,35 @@ declare function createBotBridge(options: BotBridgeOptions): BotBridge;
604
679
 
605
680
  declare function connectBotBridge(options: AppBridgeOptions): AppBridge;
606
681
 
607
- export { type ActionError, type ActionErrorDetails, type ActionFailure, type ActionResult, type ActionSuccess, type AddMemberRoleActionPayload, type AddMessageReactionActionPayload, type AppBridge, type AppBridgeActionInvokeOptions, type AppBridgeActions, type AppBridgeMetricsHooks, type AppBridgeOptions, type ArchiveThreadActionPayload, type BanMemberActionPayload, type BotActionName, type BotActionPayloadMap, type BotActionResultDataMap, type BotBridge, type BotBridgeOptions, type BotBridgeSecret, type BotEventName, type BotEventPayloadMap, type BotIntentName, type BridgeAttachment, type BridgeCapabilities, BridgeCapabilityError, type BridgeChannel, type BridgeDeletedMessage, type BridgeGuild, type BridgeGuildMember, type BridgeInteraction, type BridgeInteractionKind, type BridgeMessage, type BridgeMessageInput, type BridgeMessageReaction, type BridgeMessageReference, type BridgeReactionEmoji, type BridgeThread, type BridgeUser, type ChannelCreateEventPayload, type ChannelDeleteEventPayload, type ChannelUpdateEventPayload, type CreateChannelActionPayload, type CreateThreadActionPayload, type DeferInteractionActionPayload, type DeferInteractionActionResult, type DeferUpdateInteractionActionPayload, type DeferUpdateInteractionActionResult, type DeleteChannelActionPayload, type DeleteChannelActionResult, type DeleteInteractionReplyActionPayload, type DeleteInteractionReplyActionResult, type DeleteMessageActionPayload, type DeleteMessageActionResult, type EditChannelActionPayload, type EditInteractionReplyActionPayload, type EditMessageActionPayload, type EventEnvelopeBase, type EventHandler, type EventSubscription, type EventSubscriptionFilter, type FetchMemberActionPayload, type FetchMessageActionPayload, type FollowUpInteractionActionPayload, type GuildCreateEventPayload, type GuildDeleteEventPayload, type GuildMemberAddEventPayload, type GuildMemberRemoveEventPayload, type GuildMemberUpdateEventPayload, type InteractionCreateEventPayload, type KickMemberActionPayload, type MemberModerationActionResult, type MessageBulkDeleteEventPayload, type MessageCreateEventPayload, type MessageDeleteEventPayload, type MessageReactionActionResult, type MessageReactionAddEventPayload, type MessageReactionRemoveEventPayload, type MessageUpdateEventPayload, type ReadyEventPayload, type RemoveMemberRoleActionPayload, type RemoveMemberTimeoutActionPayload, type RemoveOwnMessageReactionActionPayload, type ReplyToInteractionActionPayload, type ScopedSecretConfig, type SecretPermissions, type SendMessageActionPayload, type ShardwireLogger, type ShowModalActionPayload, type ShowModalActionResult, type ThreadCreateEventPayload, type ThreadDeleteEventPayload, type ThreadUpdateEventPayload, type TimeoutMemberActionPayload, type Unsubscribe, type UpdateInteractionActionPayload, connectBotBridge, createBotBridge };
682
+ /** Returns the full static Shardwire catalog (not negotiated per-connection). */
683
+ declare function getShardwireCatalog(): ShardwireCatalog;
684
+
685
+ /**
686
+ * Defer a slash/menu interaction, then edit the deferred reply.
687
+ * Useful for long-running handlers that must acknowledge within Discord's window.
688
+ */
689
+ declare function deferThenEditInteractionReply(app: Pick<AppBridge, 'actions'>, args: {
690
+ interactionId: DeferInteractionActionPayload['interactionId'];
691
+ defer?: Pick<DeferInteractionActionPayload, 'ephemeral'>;
692
+ edit: EditInteractionReplyActionPayload;
693
+ }, options?: AppBridgeActionInvokeOptions): Promise<ActionResult<BotActionResultDataMap['editInteractionReply']>>;
694
+ /**
695
+ * Defer a component interaction with type `DEFER_UPDATE_MESSAGE`, then edit the reply.
696
+ */
697
+ declare function deferUpdateThenEditInteractionReply(app: Pick<AppBridge, 'actions'>, args: {
698
+ interactionId: DeferUpdateInteractionActionPayload['interactionId'];
699
+ edit: EditInteractionReplyActionPayload;
700
+ }, options?: AppBridgeActionInvokeOptions): Promise<ActionResult<BotActionResultDataMap['editInteractionReply']>>;
701
+
702
+ /**
703
+ * Create a thread from a parent channel (optionally on a message), then send a message in that thread.
704
+ */
705
+ declare function createThreadThenSendMessage(app: Pick<AppBridge, 'actions'>, args: {
706
+ thread: CreateThreadActionPayload;
707
+ message: Omit<SendMessageActionPayload, 'channelId'>;
708
+ }, options?: AppBridgeActionInvokeOptions): Promise<{
709
+ threadResult: ActionResult<BotActionResultDataMap['createThread']>;
710
+ messageResult: ActionResult<BotActionResultDataMap['sendMessage']>;
711
+ }>;
712
+
713
+ export { type ActionError, type ActionErrorDetails, type ActionFailure, type ActionResult, type ActionSuccess, type AddMemberRoleActionPayload, type AddMessageReactionActionPayload, type AppBridge, type AppBridgeActionInvokeOptions, type AppBridgeActions, type AppBridgeMetricsHooks, type AppBridgeOptions, type ArchiveThreadActionPayload, type BanMemberActionPayload, type BotActionName, type BotActionPayloadMap, type BotActionResultDataMap, type BotBridge, type BotBridgeOptions, type BotBridgeSecret, type BotEventName, type BotEventPayloadMap, type BotIntentName, type BridgeAttachment, type BridgeCapabilities, BridgeCapabilityError, type BridgeCapabilityErrorDetails, type BridgeChannel, type BridgeDeletedMessage, type BridgeGuild, type BridgeGuildMember, type BridgeInteraction, type BridgeInteractionKind, type BridgeMessage, type BridgeMessageInput, type BridgeMessageReaction, type BridgeMessageReference, type BridgeReactionEmoji, type BridgeThread, type BridgeUser, type CapabilityExplanation, type CapabilityExplanationKind, type CapabilityExplanationReasonCode, type ChannelCreateEventPayload, type ChannelDeleteEventPayload, type ChannelUpdateEventPayload, type CreateChannelActionPayload, type CreateThreadActionPayload, type DeferInteractionActionPayload, type DeferInteractionActionResult, type DeferUpdateInteractionActionPayload, type DeferUpdateInteractionActionResult, type DeleteChannelActionPayload, type DeleteChannelActionResult, type DeleteInteractionReplyActionPayload, type DeleteInteractionReplyActionResult, type DeleteMessageActionPayload, type DeleteMessageActionResult, type EditChannelActionPayload, type EditInteractionReplyActionPayload, type EditMessageActionPayload, type EventEnvelopeBase, type EventHandler, type EventSubscription, type EventSubscriptionFilter, type FetchMemberActionPayload, type FetchMessageActionPayload, type FollowUpInteractionActionPayload, type GuildCreateEventPayload, type GuildDeleteEventPayload, type GuildMemberAddEventPayload, type GuildMemberRemoveEventPayload, type GuildMemberUpdateEventPayload, type InteractionCreateEventPayload, type KickMemberActionPayload, type MemberModerationActionResult, type MessageBulkDeleteEventPayload, type MessageCreateEventPayload, type MessageDeleteEventPayload, type MessageReactionActionResult, type MessageReactionAddEventPayload, type MessageReactionRemoveEventPayload, type MessageUpdateEventPayload, type PreflightDesired, type PreflightIssue, type PreflightIssueSeverity, type PreflightReport, type ReadyEventPayload, type RemoveMemberRoleActionPayload, type RemoveMemberTimeoutActionPayload, type RemoveOwnMessageReactionActionPayload, type ReplyToInteractionActionPayload, type ScopedSecretConfig, type SecretPermissions, type SendMessageActionPayload, type ShardwireCatalog, type ShardwireCatalogEvent, type ShardwireLogger, type ShardwireSubscriptionFilterKey, type ShowModalActionPayload, type ShowModalActionResult, type ThreadCreateEventPayload, type ThreadDeleteEventPayload, type ThreadUpdateEventPayload, type TimeoutMemberActionPayload, type Unsubscribe, type UpdateInteractionActionPayload, connectBotBridge, createBotBridge, createThreadThenSendMessage, deferThenEditInteractionReply, deferUpdateThenEditInteractionReply, getShardwireCatalog };
package/dist/index.d.ts CHANGED
@@ -469,6 +469,51 @@ interface EventSubscriptionFilter {
469
469
  /** Matches guild thread channels only: same as message `channelId` when `channelType` is a guild thread. */
470
470
  threadId?: Snowflake | readonly Snowflake[];
471
471
  }
472
+ /** Keys supported on `EventSubscriptionFilter` for `app.on(..., filter)`. */
473
+ type ShardwireSubscriptionFilterKey = keyof EventSubscriptionFilter;
474
+ /** One built-in event and its gateway intent requirements (for `app.catalog()`). */
475
+ interface ShardwireCatalogEvent {
476
+ name: BotEventName;
477
+ requiredIntents: readonly BotIntentName[];
478
+ }
479
+ /** Static discovery surface for built-in events, actions, and subscription filters. */
480
+ interface ShardwireCatalog {
481
+ events: readonly ShardwireCatalogEvent[];
482
+ actions: readonly BotActionName[];
483
+ subscriptionFilters: readonly ShardwireSubscriptionFilterKey[];
484
+ }
485
+ type CapabilityExplanationKind = 'event' | 'action';
486
+ type CapabilityExplanationReasonCode = 'unknown_name' | 'not_negotiated' | 'allowed' | 'denied_by_bridge';
487
+ /** Result of `app.explainCapability(...)`. */
488
+ interface CapabilityExplanation {
489
+ kind: CapabilityExplanationKind;
490
+ name: string;
491
+ /** Whether this name is a built-in Shardwire event or action. */
492
+ known: boolean;
493
+ /** Required gateway intents when `kind` is `event` and `known`. */
494
+ requiredIntents?: readonly BotIntentName[];
495
+ /** After authentication, whether the bridge allows this capability. */
496
+ allowedByBridge?: boolean;
497
+ reasonCode: CapabilityExplanationReasonCode;
498
+ remediation?: string;
499
+ }
500
+ type PreflightIssueSeverity = 'error' | 'warning';
501
+ interface PreflightIssue {
502
+ severity: PreflightIssueSeverity;
503
+ code: string;
504
+ message: string;
505
+ remediation?: string;
506
+ }
507
+ interface PreflightReport {
508
+ ok: boolean;
509
+ connected: boolean;
510
+ capabilities: BridgeCapabilities | null;
511
+ issues: PreflightIssue[];
512
+ }
513
+ interface PreflightDesired {
514
+ events?: readonly BotEventName[];
515
+ actions?: readonly BotActionName[];
516
+ }
472
517
  interface EventSubscription<K extends BotEventName = BotEventName> {
473
518
  name: K;
474
519
  filter?: EventSubscriptionFilter;
@@ -566,10 +611,19 @@ interface ActionFailure {
566
611
  error: ActionError;
567
612
  }
568
613
  type ActionResult<T> = ActionSuccess<T> | ActionFailure;
614
+ /** Structured context on `BridgeCapabilityError` and capability-related action failures. */
615
+ interface BridgeCapabilityErrorDetails {
616
+ reasonCode: 'not_in_capabilities' | 'unknown_event' | 'unknown_action';
617
+ kind?: 'event' | 'action';
618
+ name?: string;
619
+ remediation: string;
620
+ requiredIntents?: readonly BotIntentName[];
621
+ }
569
622
  declare class BridgeCapabilityError extends Error {
570
623
  readonly kind: 'event' | 'action';
571
624
  readonly name: string;
572
- constructor(kind: 'event' | 'action', name: string, message?: string);
625
+ readonly details?: BridgeCapabilityErrorDetails | undefined;
626
+ constructor(kind: 'event' | 'action', name: string, message?: string, details?: BridgeCapabilityErrorDetails | undefined);
573
627
  }
574
628
  type EventHandler<K extends BotEventName> = (payload: BotEventPayloadMap[K]) => void;
575
629
  type AppBridgeActionInvokeOptions = {
@@ -596,6 +650,27 @@ interface AppBridge {
596
650
  connected(): boolean;
597
651
  connectionId(): string | null;
598
652
  capabilities(): BridgeCapabilities;
653
+ /**
654
+ * Static discovery: built-in events (with intent hints), actions, and subscription filter keys.
655
+ * Does not require a connection.
656
+ */
657
+ catalog(): ShardwireCatalog;
658
+ /**
659
+ * Explain whether an event or action is built-in and whether the current connection allows it.
660
+ * Call after `await app.ready()` for `allowedByBridge` / `reasonCode` beyond `not_negotiated`.
661
+ */
662
+ explainCapability(query: {
663
+ kind: 'event';
664
+ name: BotEventName;
665
+ } | {
666
+ kind: 'action';
667
+ name: BotActionName;
668
+ }): CapabilityExplanation;
669
+ /**
670
+ * Run startup diagnostics after authenticating. Does not throw on subscription/capability mismatches;
671
+ * use `report.ok` and `report.issues`. Call before `app.on(...)` to validate `desired` against negotiated caps.
672
+ */
673
+ preflight(desired?: PreflightDesired): Promise<PreflightReport>;
599
674
  on<K extends BotEventName>(name: K, handler: EventHandler<K>, filter?: EventSubscriptionFilter): Unsubscribe;
600
675
  off<K extends BotEventName>(name: K, handler: EventHandler<K>): void;
601
676
  }
@@ -604,4 +679,35 @@ declare function createBotBridge(options: BotBridgeOptions): BotBridge;
604
679
 
605
680
  declare function connectBotBridge(options: AppBridgeOptions): AppBridge;
606
681
 
607
- export { type ActionError, type ActionErrorDetails, type ActionFailure, type ActionResult, type ActionSuccess, type AddMemberRoleActionPayload, type AddMessageReactionActionPayload, type AppBridge, type AppBridgeActionInvokeOptions, type AppBridgeActions, type AppBridgeMetricsHooks, type AppBridgeOptions, type ArchiveThreadActionPayload, type BanMemberActionPayload, type BotActionName, type BotActionPayloadMap, type BotActionResultDataMap, type BotBridge, type BotBridgeOptions, type BotBridgeSecret, type BotEventName, type BotEventPayloadMap, type BotIntentName, type BridgeAttachment, type BridgeCapabilities, BridgeCapabilityError, type BridgeChannel, type BridgeDeletedMessage, type BridgeGuild, type BridgeGuildMember, type BridgeInteraction, type BridgeInteractionKind, type BridgeMessage, type BridgeMessageInput, type BridgeMessageReaction, type BridgeMessageReference, type BridgeReactionEmoji, type BridgeThread, type BridgeUser, type ChannelCreateEventPayload, type ChannelDeleteEventPayload, type ChannelUpdateEventPayload, type CreateChannelActionPayload, type CreateThreadActionPayload, type DeferInteractionActionPayload, type DeferInteractionActionResult, type DeferUpdateInteractionActionPayload, type DeferUpdateInteractionActionResult, type DeleteChannelActionPayload, type DeleteChannelActionResult, type DeleteInteractionReplyActionPayload, type DeleteInteractionReplyActionResult, type DeleteMessageActionPayload, type DeleteMessageActionResult, type EditChannelActionPayload, type EditInteractionReplyActionPayload, type EditMessageActionPayload, type EventEnvelopeBase, type EventHandler, type EventSubscription, type EventSubscriptionFilter, type FetchMemberActionPayload, type FetchMessageActionPayload, type FollowUpInteractionActionPayload, type GuildCreateEventPayload, type GuildDeleteEventPayload, type GuildMemberAddEventPayload, type GuildMemberRemoveEventPayload, type GuildMemberUpdateEventPayload, type InteractionCreateEventPayload, type KickMemberActionPayload, type MemberModerationActionResult, type MessageBulkDeleteEventPayload, type MessageCreateEventPayload, type MessageDeleteEventPayload, type MessageReactionActionResult, type MessageReactionAddEventPayload, type MessageReactionRemoveEventPayload, type MessageUpdateEventPayload, type ReadyEventPayload, type RemoveMemberRoleActionPayload, type RemoveMemberTimeoutActionPayload, type RemoveOwnMessageReactionActionPayload, type ReplyToInteractionActionPayload, type ScopedSecretConfig, type SecretPermissions, type SendMessageActionPayload, type ShardwireLogger, type ShowModalActionPayload, type ShowModalActionResult, type ThreadCreateEventPayload, type ThreadDeleteEventPayload, type ThreadUpdateEventPayload, type TimeoutMemberActionPayload, type Unsubscribe, type UpdateInteractionActionPayload, connectBotBridge, createBotBridge };
682
+ /** Returns the full static Shardwire catalog (not negotiated per-connection). */
683
+ declare function getShardwireCatalog(): ShardwireCatalog;
684
+
685
+ /**
686
+ * Defer a slash/menu interaction, then edit the deferred reply.
687
+ * Useful for long-running handlers that must acknowledge within Discord's window.
688
+ */
689
+ declare function deferThenEditInteractionReply(app: Pick<AppBridge, 'actions'>, args: {
690
+ interactionId: DeferInteractionActionPayload['interactionId'];
691
+ defer?: Pick<DeferInteractionActionPayload, 'ephemeral'>;
692
+ edit: EditInteractionReplyActionPayload;
693
+ }, options?: AppBridgeActionInvokeOptions): Promise<ActionResult<BotActionResultDataMap['editInteractionReply']>>;
694
+ /**
695
+ * Defer a component interaction with type `DEFER_UPDATE_MESSAGE`, then edit the reply.
696
+ */
697
+ declare function deferUpdateThenEditInteractionReply(app: Pick<AppBridge, 'actions'>, args: {
698
+ interactionId: DeferUpdateInteractionActionPayload['interactionId'];
699
+ edit: EditInteractionReplyActionPayload;
700
+ }, options?: AppBridgeActionInvokeOptions): Promise<ActionResult<BotActionResultDataMap['editInteractionReply']>>;
701
+
702
+ /**
703
+ * Create a thread from a parent channel (optionally on a message), then send a message in that thread.
704
+ */
705
+ declare function createThreadThenSendMessage(app: Pick<AppBridge, 'actions'>, args: {
706
+ thread: CreateThreadActionPayload;
707
+ message: Omit<SendMessageActionPayload, 'channelId'>;
708
+ }, options?: AppBridgeActionInvokeOptions): Promise<{
709
+ threadResult: ActionResult<BotActionResultDataMap['createThread']>;
710
+ messageResult: ActionResult<BotActionResultDataMap['sendMessage']>;
711
+ }>;
712
+
713
+ export { type ActionError, type ActionErrorDetails, type ActionFailure, type ActionResult, type ActionSuccess, type AddMemberRoleActionPayload, type AddMessageReactionActionPayload, type AppBridge, type AppBridgeActionInvokeOptions, type AppBridgeActions, type AppBridgeMetricsHooks, type AppBridgeOptions, type ArchiveThreadActionPayload, type BanMemberActionPayload, type BotActionName, type BotActionPayloadMap, type BotActionResultDataMap, type BotBridge, type BotBridgeOptions, type BotBridgeSecret, type BotEventName, type BotEventPayloadMap, type BotIntentName, type BridgeAttachment, type BridgeCapabilities, BridgeCapabilityError, type BridgeCapabilityErrorDetails, type BridgeChannel, type BridgeDeletedMessage, type BridgeGuild, type BridgeGuildMember, type BridgeInteraction, type BridgeInteractionKind, type BridgeMessage, type BridgeMessageInput, type BridgeMessageReaction, type BridgeMessageReference, type BridgeReactionEmoji, type BridgeThread, type BridgeUser, type CapabilityExplanation, type CapabilityExplanationKind, type CapabilityExplanationReasonCode, type ChannelCreateEventPayload, type ChannelDeleteEventPayload, type ChannelUpdateEventPayload, type CreateChannelActionPayload, type CreateThreadActionPayload, type DeferInteractionActionPayload, type DeferInteractionActionResult, type DeferUpdateInteractionActionPayload, type DeferUpdateInteractionActionResult, type DeleteChannelActionPayload, type DeleteChannelActionResult, type DeleteInteractionReplyActionPayload, type DeleteInteractionReplyActionResult, type DeleteMessageActionPayload, type DeleteMessageActionResult, type EditChannelActionPayload, type EditInteractionReplyActionPayload, type EditMessageActionPayload, type EventEnvelopeBase, type EventHandler, type EventSubscription, type EventSubscriptionFilter, type FetchMemberActionPayload, type FetchMessageActionPayload, type FollowUpInteractionActionPayload, type GuildCreateEventPayload, type GuildDeleteEventPayload, type GuildMemberAddEventPayload, type GuildMemberRemoveEventPayload, type GuildMemberUpdateEventPayload, type InteractionCreateEventPayload, type KickMemberActionPayload, type MemberModerationActionResult, type MessageBulkDeleteEventPayload, type MessageCreateEventPayload, type MessageDeleteEventPayload, type MessageReactionActionResult, type MessageReactionAddEventPayload, type MessageReactionRemoveEventPayload, type MessageUpdateEventPayload, type PreflightDesired, type PreflightIssue, type PreflightIssueSeverity, type PreflightReport, type ReadyEventPayload, type RemoveMemberRoleActionPayload, type RemoveMemberTimeoutActionPayload, type RemoveOwnMessageReactionActionPayload, type ReplyToInteractionActionPayload, type ScopedSecretConfig, type SecretPermissions, type SendMessageActionPayload, type ShardwireCatalog, type ShardwireCatalogEvent, type ShardwireLogger, type ShardwireSubscriptionFilterKey, type ShowModalActionPayload, type ShowModalActionResult, type ThreadCreateEventPayload, type ThreadDeleteEventPayload, type ThreadUpdateEventPayload, type TimeoutMemberActionPayload, type Unsubscribe, type UpdateInteractionActionPayload, connectBotBridge, createBotBridge, createThreadThenSendMessage, deferThenEditInteractionReply, deferUpdateThenEditInteractionReply, getShardwireCatalog };