Bridge SDK
Types
Core type definitions for sessions, messages, attachments, and content blocks.
Core Types
All types are exported from @oro.ad/bridge-sdk.
Session Types
SessionSummary
Returned by listSessions() and sessions:list events.
interface SessionSummary {
conversationId: string
title?: string
projectName?: string
cwd?: string
gitBranch?: string
gitRemote?: string
entrypoint?: string
status: SessionStatus
claudeSessionId: string | null
model: string | null
messageCount: number
lastActivity: string
queueLength: number
lastMessagePreview?: string
loop?: LoopSummary
}
SessionStatus
type SessionStatus = 'idle' | 'processing' | 'active'
LoopConfig
Configuration for autonomous loop mode.
interface LoopConfig {
trigger?: LoopTrigger // 'idle_timeout' | 'immediate' | 'external'
idleTimeoutSec?: number // seconds before auto-resume
resumePrompt?: string // prompt sent on each iteration
resumePromptPath?: string // file path to read prompt from
maxRestartsPerHour?: number // rate limit
cooldownSec?: number // pause between iterations
maxCostUsdPerHour?: number // cost guardrail
maxTurnsPerLoop?: number // turns per iteration
}
LoopSummary
interface LoopSummary {
enabled: boolean
trigger: LoopTrigger
iteration: number
totalCostUsd: number
paused: boolean
pauseReason?: string
}
Message Types
BridgeMessage
interface BridgeMessage {
id: string
role: MessageRole // 'user' | 'assistant' | 'system'
content: string
contentBlocks?: ContentBlock[]
timestamp: string
model?: string
senderId?: string
senderNickname?: string
attachments?: MessageAttachment[]
replyTo?: string
metadata?: Record<string, unknown>
}
MessageResult
Returned by getMessageResult() — the complete assistant response.
interface MessageResult {
messageId: string
status: MessageResultStatus // 'processing' | 'complete' | 'error' | 'stopped'
content: string
contentBlocks: ContentBlock[]
model: string
claudeSessionId: string
usage: UsageSummary
costUsd: number | null
durationMs: number | null
isError: boolean
error?: string
}
UsageSummary
interface UsageSummary {
inputTokens: number
outputTokens: number
cacheReadInputTokens: number
cacheCreationInputTokens: number
}
Content Blocks
Claude responses contain typed content blocks.
type ContentBlock = TextBlock | ToolUseBlock | ToolResultBlock | ThinkingBlock
interface TextBlock {
type: 'text'
text: string
}
interface ToolUseBlock {
type: 'tool_use'
id: string
name: string
input: Record<string, unknown>
}
interface ToolResultBlock {
type: 'tool_result'
tool_use_id: string
content: string | unknown[]
is_error?: boolean
}
interface ThinkingBlock {
type: 'thinking'
thinking: string
}
Attachment Types
type AttachmentType = 'image' | 'document' | 'code' | 'audio' | 'video'
interface MessageAttachment {
id: string
type: AttachmentType
path: string
filename: string
mimeType: string
size: number
thumbnailPath?: string
duration?: number
metadata?: Record<string, unknown>
}
Server Info
interface ServerInfo {
version: string
uptime: number
claudeVersion: string
workDir: string
activeSessions: number
}