Table of Contents

Class InterceptModeHandler

Namespace
JD.AI.Channels.OpenClaw.Routing
Assembly
JD.AI.Channels.OpenClaw.dll

Intercept mode: suppresses OpenClaw's agent and routes the message through JD.AI instead. On receiving a user message, calls chat.abort to stop OpenClaw's processing, runs the message through JD.AI (Semantic Kernel → Ollama/provider), then injects the response back via chat.inject (without re-triggering OpenClaw's agent).

public sealed class InterceptModeHandler : IOpenClawModeHandler
Inheritance
InterceptModeHandler
Implements
Inherited Members

Constructors

InterceptModeHandler(ILogger<InterceptModeHandler>)

Intercept mode: suppresses OpenClaw's agent and routes the message through JD.AI instead. On receiving a user message, calls chat.abort to stop OpenClaw's processing, runs the message through JD.AI (Semantic Kernel → Ollama/provider), then injects the response back via chat.inject (without re-triggering OpenClaw's agent).

public InterceptModeHandler(ILogger<InterceptModeHandler> logger)

Parameters

logger ILogger<InterceptModeHandler>

Properties

Mode

The routing mode this handler supports.

public OpenClawRoutingMode Mode { get; }

Property Value

OpenClawRoutingMode

Methods

HandleAsync(OpenClawEvent, string, OpenClawChannelRouteConfig, OpenClawBridgeChannel, Func<string, string, Task<string?>>, CancellationToken)

Processes an incoming OpenClaw event. Returns true if the message was handled.

public Task<bool> HandleAsync(OpenClawEvent evt, string channelName, OpenClawChannelRouteConfig routeConfig, OpenClawBridgeChannel bridge, Func<string, string, Task<string?>> messageProcessor, CancellationToken ct = default)

Parameters

evt OpenClawEvent

The raw OpenClaw event.

channelName string

The OpenClaw channel name (e.g., "discord", "signal").

routeConfig OpenClawChannelRouteConfig

The per-channel routing configuration.

bridge OpenClawBridgeChannel

The OpenClaw bridge for sending responses.

messageProcessor Func<string, string, Task<string>>

Callback that runs user content through the JD.AI agent and returns the response.

ct CancellationToken

Cancellation token.

Returns

Task<bool>