Class GitHubInboundMapper

java.lang.Object
io.agentscope.extensions.channel.github.GitHubInboundMapper

public final class GitHubInboundMapper extends Object
Maps a GitHub webhook delivery into an InboundMessage.

MVP handles two event types:

  • issue_comment — comments on issues OR PRs (GitHub fires issue_comment for both; the issue object has a pull_request subobject when it's a PR)
  • pull_request_review_comment — line-anchored review comments on PR diffs

The peer model:

  • peerKind = PeerKind.THREAD
  • peerId = "<owner>/<repo>#<number>" — stable identifier the outbound client parses to build the comment URL.
  • Constructor Details

    • GitHubInboundMapper

      public GitHubInboundMapper(String channelId)
  • Method Details

    • extractCommentId

      public static Optional<Long> extractCommentId(com.fasterxml.jackson.databind.JsonNode payload)
      Returns the comment.id used as the idempotency key. Immutable per GitHub: edits arrive as action=edited on the same id which we ignore in MVP.
    • extractCommenterId

      public static Optional<Long> extractCommenterId(com.fasterxml.jackson.databind.JsonNode payload)
      Returns the numeric id of the comment author. Used by the channel for bot-loop self-detection.
    • map

      public Optional<io.agentscope.harness.agent.gateway.channel.InboundMessage> map(String eventType, com.fasterxml.jackson.databind.JsonNode payload)
      Maps an issue_comment or pull_request_review_comment payload into an InboundMessage. Returns empty for unsupported actions (only "created" is mapped) or malformed payloads.