openclaw

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: MIT Imports: 57 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

OpenClaw Bridge

The OpenClaw bridge connects Beeper to a self-hosted OpenClaw gateway.

What it does

  • connects to a gateway over ws, wss, http, or https
  • syncs OpenClaw sessions into Beeper rooms
  • streams replies, approvals, and session updates into chat

Login flow

The bridge asks for:

  • gateway URL
  • auth mode: none, token, or password
  • optional label

If the gateway requires device pairing, the login waits for approval and surfaces the request ID.

Run

./tools/bridges run openclaw

Or:

./run.sh openclaw

Documentation

Index

Constants

View Source
const ProviderOpenClaw = "openclaw"

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Bridge   bridgeconfig.BridgeConfig `yaml:"bridge"`
	OpenClaw OpenClawConfig            `yaml:"openclaw"`
}

type GhostMetadata

type GhostMetadata struct {
	OpenClawAgentID        string `json:"openclaw_agent_id,omitempty"`
	OpenClawAgentName      string `json:"openclaw_agent_name,omitempty"`
	OpenClawAgentAvatarURL string `json:"openclaw_agent_avatar_url,omitempty"`
	OpenClawAgentEmoji     string `json:"openclaw_agent_emoji,omitempty"`
	OpenClawAgentRole      string `json:"openclaw_agent_role,omitempty"`
	LastSeenAt             int64  `json:"last_seen_at,omitempty"`
}

type MessageMetadata

type MessageMetadata struct {
	agentremote.BaseMessageMetadata
	SessionID      string           `json:"session_id,omitempty"`
	SessionKey     string           `json:"session_key,omitempty"`
	RunID          string           `json:"run_id,omitempty"`
	ErrorText      string           `json:"error_text,omitempty"`
	TotalTokens    int64            `json:"total_tokens,omitempty"`
	Attachments    []map[string]any `json:"attachments,omitempty"`
	FirstTokenAtMs int64            `json:"first_token_at_ms,omitempty"`
}

func (*MessageMetadata) CopyFrom

func (mm *MessageMetadata) CopyFrom(other any)

type OpenClawClient

type OpenClawClient struct {
	agentremote.ClientBase
	UserLogin *bridgev2.UserLogin
	// contains filtered or unexported fields
}

func (*OpenClawClient) Connect

func (oc *OpenClawClient) Connect(ctx context.Context)

func (*OpenClawClient) CreateChatWithGhost

func (oc *OpenClawClient) CreateChatWithGhost(ctx context.Context, ghost *bridgev2.Ghost) (*bridgev2.CreateChatResponse, error)

func (*OpenClawClient) Disconnect

func (oc *OpenClawClient) Disconnect()

func (*OpenClawClient) DownloadAndEncodeMedia

func (oc *OpenClawClient) DownloadAndEncodeMedia(ctx context.Context, mediaURL string, file *event.EncryptedFileInfo, maxMB int) (string, string, error)

func (*OpenClawClient) EmitStreamPart

func (oc *OpenClawClient) EmitStreamPart(ctx context.Context, portal *bridgev2.Portal, turnID, agentID, sessionKey string, part map[string]any)

func (*OpenClawClient) FetchMessages

func (*OpenClawClient) GetApprovalHandler

func (oc *OpenClawClient) GetApprovalHandler() agentremote.ApprovalReactionHandler

func (*OpenClawClient) GetBackfillMaxBatchCount

func (oc *OpenClawClient) GetBackfillMaxBatchCount(_ context.Context, _ *bridgev2.Portal, _ *database.BackfillTask) int

func (*OpenClawClient) GetCapabilities

func (oc *OpenClawClient) GetCapabilities(ctx context.Context, portal *bridgev2.Portal) *event.RoomFeatures

func (*OpenClawClient) GetChatInfo

func (oc *OpenClawClient) GetChatInfo(ctx context.Context, portal *bridgev2.Portal) (*bridgev2.ChatInfo, error)

func (*OpenClawClient) GetContactList

func (oc *OpenClawClient) GetContactList(ctx context.Context) ([]*bridgev2.ResolveIdentifierResponse, error)

func (*OpenClawClient) GetUserInfo

func (oc *OpenClawClient) GetUserInfo(ctx context.Context, ghost *bridgev2.Ghost) (*bridgev2.UserInfo, error)

func (*OpenClawClient) GetUserLogin

func (oc *OpenClawClient) GetUserLogin() *bridgev2.UserLogin

func (*OpenClawClient) HandleMatrixDeleteChat

func (oc *OpenClawClient) HandleMatrixDeleteChat(ctx context.Context, msg *bridgev2.MatrixDeleteChat) error

func (*OpenClawClient) HandleMatrixMessage

func (*OpenClawClient) Log

func (oc *OpenClawClient) Log() *zerolog.Logger

func (*OpenClawClient) LogoutRemote

func (oc *OpenClawClient) LogoutRemote(_ context.Context)

func (*OpenClawClient) ResolveIdentifier

func (oc *OpenClawClient) ResolveIdentifier(ctx context.Context, identifier string, createChat bool) (*bridgev2.ResolveIdentifierResponse, error)

func (*OpenClawClient) SearchUsers

func (oc *OpenClawClient) SearchUsers(ctx context.Context, query string) ([]*bridgev2.ResolveIdentifierResponse, error)

func (*OpenClawClient) SetUserLogin

func (oc *OpenClawClient) SetUserLogin(login *bridgev2.UserLogin)

type OpenClawConfig

type OpenClawConfig struct {
	Enabled   *bool                   `yaml:"enabled"`
	Discovery OpenClawDiscoveryConfig `yaml:"discovery"`
}

type OpenClawConnector

type OpenClawConnector struct {
	*agentremote.ConnectorBase

	Config Config
	// contains filtered or unexported fields
}

func NewConnector

func NewConnector() *OpenClawConnector

type OpenClawDiscoveryConfig

type OpenClawDiscoveryConfig struct {
	Enabled           *bool  `yaml:"enabled"`
	TimeoutMS         int    `yaml:"timeout_ms"`
	WideAreaDomain    string `yaml:"wide_area_domain"`
	PrefillTTLSeconds int    `yaml:"prefill_ttl_seconds"`
}

type OpenClawLogin

type OpenClawLogin struct {
	agentremote.BaseLoginProcess
	User      *bridgev2.User
	Connector *OpenClawConnector
	// contains filtered or unexported fields
}

func (*OpenClawLogin) Cancel

func (ol *OpenClawLogin) Cancel()

func (*OpenClawLogin) Start

func (*OpenClawLogin) SubmitUserInput

func (ol *OpenClawLogin) SubmitUserInput(ctx context.Context, input map[string]string) (*bridgev2.LoginStep, error)

func (*OpenClawLogin) Wait

type PortalMetadata

type PortalMetadata struct {
	IsOpenClawRoom                bool           `json:"is_openclaw_room,omitempty"`
	OpenClawGatewayID             string         `json:"openclaw_gateway_id,omitempty"`
	OpenClawSessionID             string         `json:"openclaw_session_id,omitempty"`
	OpenClawSessionKey            string         `json:"openclaw_session_key,omitempty"`
	OpenClawSpawnedBy             string         `json:"openclaw_spawned_by,omitempty"`
	OpenClawDMTargetAgentID       string         `json:"openclaw_dm_target_agent_id,omitempty"`
	OpenClawDMTargetAgentName     string         `json:"openclaw_dm_target_agent_name,omitempty"`
	OpenClawDMCreatedFromContact  bool           `json:"openclaw_dm_created_from_contact,omitempty"`
	OpenClawSessionKind           string         `json:"openclaw_session_kind,omitempty"`
	OpenClawSessionLabel          string         `json:"openclaw_session_label,omitempty"`
	OpenClawDisplayName           string         `json:"openclaw_display_name,omitempty"`
	OpenClawDerivedTitle          string         `json:"openclaw_derived_title,omitempty"`
	OpenClawLastMessagePreview    string         `json:"openclaw_last_message_preview,omitempty"`
	OpenClawChannel               string         `json:"openclaw_channel,omitempty"`
	OpenClawSubject               string         `json:"openclaw_subject,omitempty"`
	OpenClawGroupChannel          string         `json:"openclaw_group_channel,omitempty"`
	OpenClawSpace                 string         `json:"openclaw_space,omitempty"`
	OpenClawChatType              string         `json:"openclaw_chat_type,omitempty"`
	OpenClawOrigin                string         `json:"openclaw_origin,omitempty"`
	OpenClawAgentID               string         `json:"openclaw_agent_id,omitempty"`
	OpenClawSystemSent            bool           `json:"openclaw_system_sent,omitempty"`
	OpenClawAbortedLastRun        bool           `json:"openclaw_aborted_last_run,omitempty"`
	ThinkingLevel                 string         `json:"thinking_level,omitempty"`
	FastMode                      bool           `json:"fast_mode,omitempty"`
	VerboseLevel                  string         `json:"verbose_level,omitempty"`
	ReasoningLevel                string         `json:"reasoning_level,omitempty"`
	ElevatedLevel                 string         `json:"elevated_level,omitempty"`
	SendPolicy                    string         `json:"send_policy,omitempty"`
	InputTokens                   int64          `json:"input_tokens,omitempty"`
	OutputTokens                  int64          `json:"output_tokens,omitempty"`
	TotalTokens                   int64          `json:"total_tokens,omitempty"`
	TotalTokensFresh              bool           `json:"total_tokens_fresh,omitempty"`
	EstimatedCostUSD              float64        `json:"estimated_cost_usd,omitempty"`
	Status                        string         `json:"status,omitempty"`
	StartedAt                     int64          `json:"started_at,omitempty"`
	EndedAt                       int64          `json:"ended_at,omitempty"`
	RuntimeMs                     int64          `json:"runtime_ms,omitempty"`
	ParentSessionKey              string         `json:"parent_session_key,omitempty"`
	ChildSessions                 []string       `json:"child_sessions,omitempty"`
	ResponseUsage                 string         `json:"response_usage,omitempty"`
	ModelProvider                 string         `json:"model_provider,omitempty"`
	Model                         string         `json:"model,omitempty"`
	ContextTokens                 int64          `json:"context_tokens,omitempty"`
	DeliveryContext               map[string]any `json:"delivery_context,omitempty"`
	LastChannel                   string         `json:"last_channel,omitempty"`
	LastTo                        string         `json:"last_to,omitempty"`
	LastAccountID                 string         `json:"last_account_id,omitempty"`
	SessionUpdatedAt              int64          `json:"session_updated_at,omitempty"`
	OpenClawPreviewSnippet        string         `json:"openclaw_preview_snippet,omitempty"`
	OpenClawDefaultAgentID        string         `json:"openclaw_default_agent_id,omitempty"`
	OpenClawToolProfile           string         `json:"openclaw_tool_profile,omitempty"`
	OpenClawToolCount             int            `json:"openclaw_tool_count,omitempty"`
	OpenClawKnownModelCount       int            `json:"openclaw_known_model_count,omitempty"`
	OpenClawLastPreviewAt         int64          `json:"openclaw_last_preview_at,omitempty"`
	HistoryMode                   string         `json:"history_mode,omitempty"`
	RecentHistoryLimit            int            `json:"recent_history_limit,omitempty"`
	LastHistorySyncAt             int64          `json:"last_history_sync_at,omitempty"`
	LastTranscriptFingerprint     string         `json:"last_transcript_fingerprint,omitempty"`
	LastLiveSeq                   int64          `json:"last_live_seq,omitempty"`
	BackgroundBackfillStartedAt   int64          `json:"background_backfill_started_at,omitempty"`
	BackgroundBackfillCompletedAt int64          `json:"background_backfill_completed_at,omitempty"`
	BackgroundBackfillCursor      string         `json:"background_backfill_cursor,omitempty"`
	BackgroundBackfillStatus      string         `json:"background_backfill_status,omitempty"`
	BackgroundBackfillError       string         `json:"background_backfill_error,omitempty"`
}

type UserLoginMetadata

type UserLoginMetadata struct {
	Provider        string `json:"provider,omitempty"`
	GatewayURL      string `json:"gateway_url,omitempty"`
	GatewayToken    string `json:"gateway_token,omitempty"`
	GatewayPassword string `json:"gateway_password,omitempty"`
	GatewayLabel    string `json:"gateway_label,omitempty"`
	DeviceToken     string `json:"device_token,omitempty"`
	SessionsSynced  bool   `json:"sessions_synced,omitempty"`
	LastSyncAt      int64  `json:"last_sync_at,omitempty"`
}

Jump to

Keyboard shortcuts

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