gateway

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeUserMessage = "user_message"
	TypeHeartbeat   = "heartbeat"

	MethodConnect       = "connect"
	MethodSubscribe     = "subscribe"
	MethodSend          = "send"
	MethodToolApproval  = "tool_approval"
	MethodRecreateAgent = "recreate_agent"
	MethodHeartbeat     = TypeHeartbeat

	MsgFromUserMessage = "user.message"

	JSONRPCResType   = "res"
	MsgFromServer    = "server"
	MsgFromWSErr     = "error"
	HeartbeatAckType = "heartbeat_ack"
)

Variables

View Source
var (
	ErrSessionIDRequired = errors.New("session_id is required")
	ErrChatBodyEmpty     = errors.New("text or content required")
)

Functions

func IsLocalDevOrigin

func IsLocalDevOrigin(origin string) bool

func MustHeartbeatAckMsg

func MustHeartbeatAckMsg() string

func MustJSONRPCWSResMsg

func MustJSONRPCWSResMsg(id string, ok bool, err string) string

func NewLocalDevWebSocketUpgrader

func NewLocalDevWebSocketUpgrader() websocket.Upgrader

Types

type ChatBody

type ChatBody struct {
	SessionID   string                   `json:"session_id"`
	Content     string                   `json:"content"`
	Text        string                   `json:"text"`
	Parts       []agenttypes.MessagePart `json:"parts,omitempty"`
	Attachments []dinopkg.UserAttachment `json:"attachments,omitempty"`
}

func ParseChatBody

func ParseChatBody(c *gin.Context, pathSessionID string) (ChatBody, types.Message, error)

type ClientWSMessage

type ClientWSMessage struct {
	Type string          `json:"type"`
	Data json.RawMessage `json:"data"`
}

type ConnectParams

type ConnectParams struct {
	Auth    map[string]string `json:"auth"`
	Client  map[string]any    `json:"client"`
	AgentID string            `json:"agent_id"`
}

type CreateSessionBody

type CreateSessionBody struct {
	SessionID string       `json:"session_id"`
	Config    *dino.Config `json:"config"`
}

func ParseCreateSessionBody

func ParseCreateSessionBody(c *gin.Context) (CreateSessionBody, error)

type HeartbeatAckBody

type HeartbeatAckBody struct {
	Type string `json:"type"`
}

type JSONRPCWSReq

type JSONRPCWSReq struct {
	Type   string          `json:"type"`
	ID     string          `json:"id"`
	Method string          `json:"method"`
	Params json.RawMessage `json:"params"`
}

type JSONRPCWSResBody

type JSONRPCWSResBody struct {
	Type  string `json:"type"`
	ID    string `json:"id"`
	Ok    bool   `json:"ok"`
	Error string `json:"error,omitempty"`
}

type SubscribeParams

type SubscribeParams struct {
	SessionID string `json:"session_id"`
}

type ToolApprovalParams

type ToolApprovalParams struct {
	RequestID string `json:"request_id"`
	Approved  bool   `json:"approved"`
}

type UserMessageBroadcast

type UserMessageBroadcast struct {
	Type      string             `json:"type"`
	Event     string             `json:"event"`
	Role      string             `json:"role"`
	SessionID string             `json:"session_id"`
	Payload   UserMessageContent `json:"payload"`
}

type UserMessageContent

type UserMessageContent struct {
	Content     string                   `json:"content"`
	Text        string                   `json:"text,omitempty"`
	Parts       []agenttypes.MessagePart `json:"parts,omitempty"`
	Attachments []dinopkg.UserAttachment `json:"attachments,omitempty"`
}

type UserMessageInput

type UserMessageInput struct {
	Content string                   `json:"content,omitempty"`
	Text    string                   `json:"text,omitempty"`
	Parts   []agenttypes.MessagePart `json:"parts,omitempty"`
}

Jump to

Keyboard shortcuts

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