SHARDWIRE
Concepts

Runtime Model

Shardwire turns raw Discord traffic into normalized events, typed action calls, and typed action results.

The bridge runtime has three primary data flows.

1. Event flow

  • Discord gateway traffic enters the bot process.
  • Shardwire normalizes it into bridge payloads.
  • Subscriptions are matched and sent to app processes.

2. Action flow

  • The app process invokes app.actions.<name>(payload).
  • The bridge validates capability access for that action.
  • The bot runtime executes the action and returns an ActionResult<T>.

3. Startup flow

  • Authentication succeeds.
  • Capabilities are negotiated.
  • Optional strict validation checks manifest, intents, runtime subscriptions, and expectedScope.

Why the result wrapper matters

Actions return ActionResult<T>, not exceptions for normal failure branches.

That means you should branch on result.ok:

const result = await app.actions.sendMessage({
  channelId,
  content: 'hello from the app process',
});

if (!result.ok) {
  console.error(result.error.code, result.error.message);
  return;
}

Read the generated reference for ActionResult, ActionError, and the action payload/result maps when you are wiring handlers.

On this page