Skip to content

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 ​

ts
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 ​

ParameterTypeDefault valueDescription
nodeSlackApproverNodeundefinedPassive Slack approver AST node.
ctxRuntimeDriverContextundefinedRuntime driver context.
transport?SlackTransportdefaultSlackTransportPluggable Slack transport.

Returns ​

SlackApproverAdapter

Methods ​

cancelDecision() ​

ts
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 ​

ParameterTypeDescription
runIdstringIdentifier of the harness run owning the request.
requestIdstringIdentifier of the decision request to cancel.

Returns ​

Promise<void>

Resolves once the Slack message has been updated and pending state cleared.

Implementation of ​

HumanAdapter.cancelDecision


dispatchSignal() ​

ts
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 ParameterDescription
TPayloadSignal payload type.

Parameters ​

ParameterTypeDescription
signalIdstringTarget signal identifier.
payloadTPayloadSignal 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() ​

ts
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() ​

ts
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 ​

ParameterTypeDescription
messagestringFormatted 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 ​

HumanAdapter.notify


requestDecision() ​

ts
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 ParameterDescription
TRequestRequest brief payload type.
TResponseValidated response payload type.

Parameters ​

ParameterTypeDescription
reqHumanDecisionRequest<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 ​

HumanAdapter.requestDecision


start() ​

ts
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 ​

ParameterTypeDescription
runtimeHarnessRuntimeControllerActive 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 ​

ControlPlaneAdapter.start


submitDecision() ​

ts
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 ​

ParameterTypeDescription
runIdstringEnclosing harness run identifier (or '' to resolve via requestId index).
requestIdstringDecision request identifier.
rawResponseunknownRaw response payload submitted by the human operator.

Returns ​

void

Throws ​

If no pending decision exists for (runId, requestId) or rawResponse fails responseSchema.

Released under the MIT License.