bridgewire

package
v0.34.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package bridgewire defines the shared Bridge Wire Protocol types and constants used by both BridgeServer (internal/server) and BridgeClient (cmd/bridge-client).

The wire protocol is a bidirectional JSON envelope. Both parties must agree on the exact field names and JSON tags documented here.

Index

Constants

View Source
const (
	MsgTypeRegister = "register"
	MsgTypeMessage  = "message"
	MsgTypeReply    = "reply"
	MsgTypeEvent    = "event"
	MsgTypeError    = "error"
)

MsgType* are the valid Type field values in a WireMessage.

View Source
const (
	CapText    = "text"
	CapImage   = "image"
	CapCard    = "card"
	CapButtons = "buttons"
	CapTyping  = "typing"
	CapEdit    = "edit"
	CapDelete  = "delete"
	CapReact   = "react"
	CapThread  = "thread"
)

Capability constants that an adapter can declare when registering.

Variables

AllCapabilities is the full set of supported capabilities.

Functions

This section is empty.

Types

type WireMessage

type WireMessage struct {
	Type         string          `json:"type"`
	Platform     string          `json:"platform,omitempty"`
	Token        string          `json:"token,omitempty"`
	SessionKey   string          `json:"session_key,omitempty"`
	Content      string          `json:"content,omitempty"`
	Metadata     json.RawMessage `json:"metadata,omitempty"`
	Event        string          `json:"event,omitempty"`
	Data         json.RawMessage `json:"data,omitempty"`
	Code         int             `json:"code,omitempty"`
	Message      string          `json:"message,omitempty"`
	Capabilities []string        `json:"capabilities,omitempty"`
}

WireMessage is the bidirectional JSON envelope for the Bridge Wire Protocol. All fields use snake_case JSON tags to match the wire format.

Direction: both client→server and server→client share the same struct, but only the relevant fields are populated for each message type.

type WireMetadata

type WireMetadata struct {
	UserID   string `json:"user_id,omitempty"`
	RoomID   string `json:"room_id,omitempty"`
	ThreadID string `json:"thread_id,omitempty"`
	Platform string `json:"platform,omitempty"`
}

WireMetadata is the metadata carried inside WireMessage.Metadata. It describes the source room, thread, and user identity.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL