Class: SlackApproverAdapter
Defined in: slack/src/executors/slack-approver-adapter.ts:27
Bidirectional Slack Socket Mode HumanAdapter and ControlPlaneAdapter (slack:approver).
Delivers outbound notifications, posts interactive Block Kit decision blocks with optional keep-alive heartbeats, cancels superseded prompts via cancelDecision, and bridges Socket Mode control-plane signals.
Implements
Constructors
Constructor
new SlackApproverAdapter(
node,
ctx,
transport?
): SlackApproverAdapter;Defined in: slack/src/executors/slack-approver-adapter.ts:50
Initializes a SlackApproverAdapter bound to node, ctx, and transport.
Resolves appToken, botToken, and channel lazily at invocation time via ctx.resolveEnv.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
node | SlackApproverNode | undefined | Passive Slack approver AST node. |
ctx | RuntimeDriverContext | undefined | Runtime driver context. |
transport? | SlackTransport | defaultSlackTransport | Pluggable Slack transport. |
Returns
SlackApproverAdapter
Methods
cancelDecision()
cancelDecision(runId, requestId): Promise<void>;Defined in: slack/src/executors/slack-approver-adapter.ts:169
Cancels an in-flight decision request, marks the Slack message superseded, and rejects the pending promise.
Safe to call idempotently when (runId, requestId) has already settled.
Parameters
| Parameter | Type | Description |
|---|---|---|
runId | string | Identifier of the harness run owning the request. |
requestId | string | Identifier of the decision request to cancel. |
Returns
Promise<void>
Resolves once the Slack message has been updated and pending state cleared.
Implementation of
dispatchSignal()
dispatchSignal<TPayload>(signalId, payload): Promise<void>;Defined in: slack/src/executors/slack-approver-adapter.ts:272
Dispatches an inbound control-plane signal received over Slack Socket Mode into the active runtime.
Throws an actionable error if the control plane has not been started or has already been closed.
Type Parameters
| Type Parameter | Description |
|---|---|
TPayload | Signal payload type. |
Parameters
| Parameter | Type | Description |
|---|---|---|
signalId | string | Target signal identifier. |
payload | TPayload | Signal payload emitted by the Slack operator. |
Returns
Promise<void>
Resolves once runtime.emitSignal completes.
Throws
If the Slack Socket Mode control plane is not currently active.
getActiveRuns()
getActiveRuns(): Promise<readonly ActiveRunSummary[]>;Defined in: slack/src/executors/slack-approver-adapter.ts:290
Queries active harness runs through the bound HarnessRuntimeController.
Used by Slack control-plane slash commands to inspect active lane runs.
Returns
Promise<readonly ActiveRunSummary[]>
Active run summaries from the runtime controller.
Throws
If the Slack Socket Mode control plane is not currently active.
notify()
notify(message): Promise<void>;Defined in: slack/src/executors/slack-approver-adapter.ts:71
Sends a one-way notification message to node.channel via chat.postMessage.
Resolves botToken and channel from ctx.resolveEnv before invoking transport.postMessage.
Parameters
| Parameter | Type | Description |
|---|---|---|
message | string | Formatted notification text to post. |
Returns
Promise<void>
Resolves once the message is delivered to Slack.
Throws
If botToken or channel resolution fails or Slack delivery fails.
Implementation of
requestDecision()
requestDecision<TRequest, TResponse>(req): Promise<TResponse>;Defined in: slack/src/executors/slack-approver-adapter.ts:103
Posts an interactive Block Kit decision block to Slack and awaits a schema-validated human response.
Emits periodic thread heartbeat pings when req.keepAliveSeconds is configured and cleans up deterministic timers and AbortSignal listeners inside finally.
Type Parameters
| Type Parameter | Description |
|---|---|
TRequest | Request brief payload type. |
TResponse | Validated response payload type. |
Parameters
| Parameter | Type | Description |
|---|---|---|
req | HumanDecisionRequest<TRequest, TResponse> | Decision request descriptor and response schema. |
Returns
Promise<TResponse>
Schema-validated human decision response.
Throws
If req.signal aborts, cancelDecision supersedes the request, or credential resolution fails.
Implementation of
start()
start(runtime): Promise<ControlPlaneHandle>;Defined in: slack/src/executors/slack-approver-adapter.ts:231
Starts the Slack Socket Mode control-plane listener bound to runtime.
Resolves appToken via ctx.resolveEnv and connects Socket Mode for inbound interactive actions and signals.
Parameters
| Parameter | Type | Description |
|---|---|---|
runtime | HarnessRuntimeController | Active runtime controller for signals and run queries. |
Returns
Promise<ControlPlaneHandle>
Handle with .close() to stop the Socket Mode listener.
Throws
If appToken resolution fails or Socket Mode connection fails.
Implementation of
submitDecision()
submitDecision(
runId,
requestId,
rawResponse
): void;Defined in: slack/src/executors/slack-approver-adapter.ts:203
Submits an interactive human response for (runId, requestId) and validates it against responseSchema.
Invoked by the Socket Mode interaction handler when a human operator submits a decision block.
Parameters
| Parameter | Type | Description |
|---|---|---|
runId | string | Enclosing harness run identifier (or '' to resolve via requestId index). |
requestId | string | Decision request identifier. |
rawResponse | unknown | Raw response payload submitted by the human operator. |
Returns
void
Throws
If no pending decision exists for (runId, requestId) or rawResponse fails responseSchema.