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
createdAt?: string
queueLength: number
lastMessagePreview?: string
loop?: LoopSummary
archived?: boolean
contextSummary?: string
contextSummaryPinned?: boolean
kind?: SessionKind // 'console' | 'dispatcher' | 'work'
}
SessionDetail
Returned by getSession() — the list card plus accumulated spend. null means unknown, not zero.
interface SessionDetail extends SessionSummary {
usage: UsageSummary | null
costUsd: number | null
}
UpdateSessionBody
Body of updateSession(). Absent fields are not touched; null is a value.
interface UpdateSessionBody {
title?: string
model?: string | null // null — bridge default
contextSummary?: string | null // null — unpin
loop?: { enabled: boolean; config?: LoopConfig }
}
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
}
Other Types
Also exported; see the TSDoc in @oro.ad/bridge-sdk for fields.
| Type | Used by |
|---|---|
BridgeHealth | health() |
LoopState | setLoopMode(), updateSession() |
SessionSearchHit | searchSessions() |
SessionReviveResult | reviveSession() |
SessionMcpServer | setSessionMcpServers() |
ConnectedUser | share:users |
AttachmentPreview | getAttachmentPreview() |
VoiceProfile, VoiceRoute | readVoiceProfile() / writeVoiceProfile(), routeVoice() |
BridgeIdentity, AgentAppearance, AgentCard | getIdentity(), getAppearance() / setAppearance(), setCard() |
SkillInfo, SkillScope, SkillsList, ApmTarget, ApmResult, SkillSyncPayload | skills methods |
ConnectedClient | listClients(), clients:list |
HubLinkState, HubLinkStatus, ReactiveStatus, DispatchEntry | getHubLink(), getReactiveStatus(), inbox:dispatch |
InboxDelivery, InboxDeliveryResult | deliverInbox() |
CredentialStatus, CredentialReauthResult | getCredentialStatus(), reauthCredentials(), credentials:reauth_required |
SessionCreatedEvent, SessionIdChangedEvent, SessionAutoChangedEvent | session:created, session:id_changed, session:auto_changed |
AttachmentUploadedEvent, AttachmentErrorEvent, AttachmentTranscribedEvent | attachment:* events |
SkillsChangedEvent | skills:changed |
BridgeValidationErrorEvent | bridge:validation_error |