Bridge SDK

Parsers

Utility functions for extracting structured data from bridge messages.

Parsers

Utility functions for extracting structured data from bridge message content. These handle the XML-wrapped formats that the bridge uses for multi-user messages and task notifications.

parseConversationBuffer

Parses <conversation-buffer> blocks from user messages. When multiple users send messages to the same session, the bridge composes them into a buffer format.

import { parseConversationBuffer } from '@oro.ad/bridge-sdk'

const content = `The following messages were sent by team members:

<conversation-buffer>
[john, 14:30] Hello Claude
[jane, 14:31] Can you help with the API?
</conversation-buffer>`

const entries = parseConversationBuffer(content)
// [
//   { sender: 'john', time: '14:30', content: 'Hello Claude' },
//   { sender: 'jane', time: '14:31', content: 'Can you help with the API?' }
// ]

Returns null if no buffer block is found.

interface ConversationBufferEntry {
  sender: string
  time: string
  content: string
}

parseTaskNotifications

Parses <task-notification> blocks from agent output. These appear when Claude Code completes background tasks.

import { parseTaskNotifications } from '@oro.ad/bridge-sdk'

const notifications = parseTaskNotifications(content)
// [{ taskId: 'abc', status: 'completed', summary: 'Build succeeded' }]
interface TaskNotification {
  taskId: string
  status: string
  summary: string
}

hasRichUserBlocks

Quick check for whether content contains any bridge-wrapped blocks (conversation buffer, task notifications, etc.).

import { hasRichUserBlocks } from '@oro.ad/bridge-sdk'

if (hasRichUserBlocks(message.content)) {
  // Content needs special parsing
}