Skip to content

SlackHost

Defined in: packages/platform-slack/src/host/index.ts:46

The Slack host: the shared bot node tree plus Block Kit serialization and interactive action routing.

  • BotHost

new SlackHost(options?): SlackHost

Defined in: packages/platform-slack/src/host/index.ts:52

SlackHostOptions = {}

SlackHost

BaseBotHost.constructor

readonly container: BotNode

Defined in: packages/core/src/host/index.ts:30

BaseBotHost.container


readonly controlled: ReadonlySet<string>

Defined in: packages/core/src/host/index.ts:32

BaseBotHost.controlled


readonly elements: readonly string[]

Defined in: packages/core/src/host/index.ts:31

BaseBotHost.elements


readonly platform: string

Defined in: packages/core/src/host/index.ts:35

The platform this host serializes for, such as discord or slack.

BaseBotHost.platform


readonly runsMounts: true = true

Defined in: packages/core/src/host/index.ts:33

BaseBotHost.runsMounts

get commits(): number

Defined in: packages/core/src/host/index.ts:45

How many commits this host has completed.

number

BaseBotHost.commits


get session(): HostSession | null

Defined in: packages/core/src/host/index.ts:62

The session whose id and version are stamped onto interaction ids.

HostSession | null

BaseBotHost.session

commit(): void

Defined in: packages/platform-slack/src/host/index.ts:73

void


createContainer(): BotNode

Defined in: packages/core/src/host/index.ts:180

BotNode

BaseBotHost.createContainer


createElement(tag): BotNode

Defined in: packages/core/src/host/index.ts:170

string

BotNode

BaseBotHost.createElement


createText(text): BotNode

Defined in: packages/core/src/host/index.ts:174

string

BotNode

BaseBotHost.createText


dispatchInteraction(payload): Effect<boolean>

Defined in: packages/platform-slack/src/host/index.ts:118

Routes a Slack block action to the rendered button handler.

Slack requires an acknowledgement within three seconds, so the action is acked before the handler runs and the message is updated.

AckFn<void> | AckFn<string | SayArguments> | AckFn<DialogValidation>

DialogSubmitAction | BlockElementAction | InteractiveAction

SlackAction

FunctionCompleteFn

FunctionFailFn

FunctionInputs

DialogSubmitAction | BlockElementAction | InteractiveAction

RespondFn

Effect<boolean>


freeze(nodes?): void

Defined in: packages/core/src/host/index.ts:126

Marks every interactive node disabled, so a painted copy shows the state without offering controls that cannot route to a live root.

readonly BotNode[] = ...

void

BaseBotHost.freeze


handles(actionId): boolean

Defined in: packages/platform-slack/src/host/index.ts:108

Whether a rendered button owns this Slack action_id.

string

boolean


insertBefore(parent, node, ref): void

Defined in: packages/core/src/host/index.ts:220

BotNode

BotNode

BotNode | undefined

void

BaseBotHost.insertBefore


interactionIds(): readonly string[]

Defined in: packages/platform-slack/src/host/index.ts:63

Action ids currently routed by this host.

readonly string[]


nextOf(node): BotNode | undefined

Defined in: packages/core/src/host/index.ts:232

BotNode

BotNode | undefined

BaseBotHost.nextOf


nodes(): readonly BotNode[]

Defined in: packages/core/src/host/index.ts:166

Every node in document order.

Hosts walk the tree several times per commit (ids, routing, serialization). Taking one list and passing it to the other steps keeps those walks in sync and avoids re-traversing the whole tree for each concern.

readonly BotNode[]

BaseBotHost.nodes


parentOf(node): BotNode | undefined

Defined in: packages/core/src/host/index.ts:228

The node’s parent, or undefined once it’s removed. instanceAt relies on this.

BotNode

BotNode | undefined

BaseBotHost.parentOf


prepareInteractionIds(nodes?): string | undefined

Defined in: packages/core/src/host/index.ts:87

Assigns every interactive node its platform-facing custom id.

Without a session the id keeps the old host-generated value. With one, auto ids are document-order ordinals and explicit ids keep the author’s text as the key, both wrapped with the session and its current version. A restored tree therefore produces the same ids as the state it shows.

Returns a message when an id exceeds the platform limit. Callers surface that message as a target failure instead of throwing from the renderer.

readonly BotNode[] = ...

string | undefined

BaseBotHost.prepareInteractionIds


remove(node): void

Defined in: packages/core/src/host/index.ts:224

BotNode

void

BaseBotHost.remove


setAttr(node, name, value, _previous?): void

Defined in: packages/core/src/host/index.ts:188

Sets an attribute of node, or removes it when value is undefined. previous is the value the renderer takes the attribute to hold before the call: the one it last set, or the one hydration read from the node, and undefined when it holds none.

BotNode

string

string | undefined

string

void

BaseBotHost.setAttr


setEvents(node, handlers, dispatch, options): void

Defined in: packages/core/src/host/index.ts:239

BotNode

Readonly<Record<string, View.Handler<unknown, any>>>

Dispatch

Readonly<Record<string, View.EventOptions>>

void

BaseBotHost.setEvents


setInteractionIndex(listener): void

Defined in: packages/platform-slack/src/host/index.ts:68

Replaces the client index whenever a commit changes action ids.

(ids) => void

void


setProp(node, name, value): void

Defined in: packages/core/src/host/index.ts:204

BotNode

string

unknown

void

BaseBotHost.setProp


setSession(session): void

Defined in: packages/core/src/host/index.ts:67

Binds the host to a resumable message session.

HostSession | null

void

BaseBotHost.setSession


setSessionVersion(version): void

Defined in: packages/core/src/host/index.ts:72

Advances the version used by the next commit.

number

void

BaseBotHost.setSessionVersion


setText(node, text): void

Defined in: packages/core/src/host/index.ts:184

BotNode

string

void

BaseBotHost.setText


snapshot(inert?): readonly KnownBlock[]

Defined in: packages/platform-slack/src/host/index.ts:101

The Block Kit payload for the current tree, without sending it. With inert, controls render disabled, for a historical copy a live root cannot route.

boolean = false

readonly KnownBlock[]


waitForCommit(after, timeoutMs?): Effect<void>

Defined in: packages/core/src/host/index.ts:146

Waits until a commit after after has run, or the timeout elapses.

number

number = 100

Effect<void>

BaseBotHost.waitForCommit


static layer(options?): Layer<Host | Renderer, never, MessageTarget>

Defined in: packages/platform-slack/src/host/index.ts:165

Provides this host and the Effect UI renderer for a MessageTarget.

SlackHostLayerOptions = {}

Layer<Host | Renderer, never, MessageTarget>


static layerFrom(host): Layer<Host | Renderer>

Defined in: packages/platform-slack/src/host/index.ts:179

Provides an existing host instance and the renderer.

SlackHost

Layer<Host | Renderer>