Class FeishuChannel

java.lang.Object
io.agentscope.extensions.channel.feishu.FeishuChannel
All Implemented Interfaces:
io.agentscope.harness.agent.gateway.channel.Channel

public final class FeishuChannel extends Object implements io.agentscope.harness.agent.gateway.channel.Channel
Feishu (飞书 / Lark) channel adapter.

Inbound: relies on Spring-managed FeishuCallbackController which receives the URL verification handshake and event-subscription callbacks, optionally decrypts via FeishuCrypto, deduplicates by header.event_id, runs the bot-loop guard, and dispatches into this channel.

Outbound: uses FeishuOutboundClient to call /open-apis/im/v1/messages, authenticating with a tenant_access_token from FeishuAccessTokenProvider.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    type value used in agentscope.json and ChannelFactory.
  • Method Summary

    Modifier and Type
    Method
    Description
     
    io.agentscope.harness.agent.gateway.channel.ChannelConfig
     
    void
    deliver(io.agentscope.harness.agent.gateway.channel.OutboundAddress address, List<io.agentscope.core.message.Msg> messages)
     
    reactor.core.publisher.Mono<String>
    deliverWithReceipt(io.agentscope.harness.agent.gateway.channel.OutboundAddress address, io.agentscope.core.message.Msg message, String deliveryId)
     
    reactor.core.publisher.Mono<io.agentscope.core.message.Msg>
    dispatch(io.agentscope.harness.agent.gateway.channel.InboundMessage message)
     
    fromProperties(String channelId, io.agentscope.harness.agent.gateway.channel.ChannelConfig routing, Map<String,Object> rawProperties)
    Factory used by ChannelFactory.
    fromProperties(String channelId, io.agentscope.harness.agent.gateway.channel.ChannelConfig routing, Map<String,Object> rawProperties, io.agentscope.extensions.channel.common.InboundEventDeduplicator idempotency)
    Factory variant that lets the application supply the InboundEventDeduplicator used to drop platform redeliveries — for example a shared-storage implementation so duplicates are recognized across instances.
    fromProperties(String channelId, io.agentscope.harness.agent.gateway.channel.ChannelConfig routing, Map<String,Object> rawProperties, io.agentscope.extensions.channel.common.InboundEventDeduplicator idempotency, io.agentscope.extensions.channel.common.AccessTokenStore tokenStore)
    Factory variant that additionally lets the application supply the AccessTokenStore caching the outbound access token — for example a shared-storage implementation so one instance's refresh or invalidation serves the whole deployment.
    void
    init(io.agentscope.harness.agent.gateway.Gateway gateway)
     
    void
     
    void
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.agentscope.harness.agent.gateway.channel.Channel

    applyRoutingConfig, dispatchStream
  • Field Details

  • Method Details

    • fromProperties

      public static FeishuChannel fromProperties(String channelId, io.agentscope.harness.agent.gateway.channel.ChannelConfig routing, Map<String,Object> rawProperties)
      Factory used by ChannelFactory. Uses a process-local IdempotencyStore and InMemoryAccessTokenStore; use the overloads taking InboundEventDeduplicator and AccessTokenStore to supply shared-storage implementations.
    • fromProperties

      public static FeishuChannel fromProperties(String channelId, io.agentscope.harness.agent.gateway.channel.ChannelConfig routing, Map<String,Object> rawProperties, io.agentscope.extensions.channel.common.InboundEventDeduplicator idempotency)
      Factory variant that lets the application supply the InboundEventDeduplicator used to drop platform redeliveries — for example a shared-storage implementation so duplicates are recognized across instances. The process-local IdempotencyStore is used otherwise. Note the Feishu callback controller currently delegates deduplication to the durable intake, so the supplied store is held for channels that consult it.
      Parameters:
      idempotency - deduplicator for inbound events; must be thread-safe
    • fromProperties

      public static FeishuChannel fromProperties(String channelId, io.agentscope.harness.agent.gateway.channel.ChannelConfig routing, Map<String,Object> rawProperties, io.agentscope.extensions.channel.common.InboundEventDeduplicator idempotency, io.agentscope.extensions.channel.common.AccessTokenStore tokenStore)
      Factory variant that additionally lets the application supply the AccessTokenStore caching the outbound access token — for example a shared-storage implementation so one instance's refresh or invalidation serves the whole deployment. The process-local InMemoryAccessTokenStore is used otherwise.
      Parameters:
      channelId - the channel id (key in agentscope.json#channels)
      routing - the ChannelConfig parsed from the file entry's routing block
      rawProperties - provider-specific properties (appId, appSecret, encryptKey, ...)
      idempotency - deduplicator for inbound events; must be thread-safe
      tokenStore - cache for this channel's access token — one instance per credential, not to be shared across channels with different credentials; must be thread-safe
    • channelId

      public String channelId()
      Specified by:
      channelId in interface io.agentscope.harness.agent.gateway.channel.Channel
    • config

      public io.agentscope.harness.agent.gateway.channel.ChannelConfig config()
      Specified by:
      config in interface io.agentscope.harness.agent.gateway.channel.Channel
    • init

      public void init(io.agentscope.harness.agent.gateway.Gateway gateway)
      Specified by:
      init in interface io.agentscope.harness.agent.gateway.channel.Channel
    • start

      public void start()
      Specified by:
      start in interface io.agentscope.harness.agent.gateway.channel.Channel
    • stop

      public void stop()
      Specified by:
      stop in interface io.agentscope.harness.agent.gateway.channel.Channel
    • dispatch

      public reactor.core.publisher.Mono<io.agentscope.core.message.Msg> dispatch(io.agentscope.harness.agent.gateway.channel.InboundMessage message)
      Specified by:
      dispatch in interface io.agentscope.harness.agent.gateway.channel.Channel
    • deliverWithReceipt

      public reactor.core.publisher.Mono<String> deliverWithReceipt(io.agentscope.harness.agent.gateway.channel.OutboundAddress address, io.agentscope.core.message.Msg message, String deliveryId)
      Specified by:
      deliverWithReceipt in interface io.agentscope.harness.agent.gateway.channel.Channel
    • deliver

      public void deliver(io.agentscope.harness.agent.gateway.channel.OutboundAddress address, List<io.agentscope.core.message.Msg> messages)
      Specified by:
      deliver in interface io.agentscope.harness.agent.gateway.channel.Channel