Documentation
¶
Index ¶
- Constants
- func ParsePayload[T any](msg BridgeMessage) (T, error)
- type AllowedUserPayload
- type AllowedUsersListPayload
- type Bridge
- func (b *Bridge) BroadcastTunnelStatus(running bool, url string, keyedURL ...string)
- func (b *Bridge) BroadcastWorktrees(worktrees []WorktreeSummary)
- func (b *Bridge) HandleSharedWS(w http.ResponseWriter, r *http.Request, sessionName string, mode string)
- func (b *Bridge) HandleWS(w http.ResponseWriter, r *http.Request)
- func (b *Bridge) SendWorktreesTo(client *wsClient, worktrees []WorktreeSummary)
- type BridgeMessage
- type CloseSessionPayload
- type CompactionCompletePayload
- type CompactionPayload
- type ContentDeltaPayload
- type CreateSessionPayload
- type DashboardConfigPayload
- type ElicitationCompletedPayload
- type ElicitationRequestedPayload
- type ErrorPayload
- type ForkSessionPayload
- type GetHistoryPayload
- type HookEndPayload
- type HookStartPayload
- type IntentChangedPayload
- type MessageSummary
- type ModeChangedPayload
- type ModelChangePayload
- type PermissionCompletedPayload
- type PermissionRequestedPayload
- type PersistedSessionSummary
- type PersistedSessionsListPayload
- type PlanChangedPayload
- type ReasoningDeltaPayload
- type ResumeSessionPayload
- type SendMessagePayload
- type Server
- type SessionHistoryPayload
- type SessionInfoPayload
- type SessionSummary
- type SessionWarningPayload
- type SessionsListPayload
- type SetTunnelConfigPayload
- type ShareToken
- type SkillInvokedPayload
- type SubagentCompletedPayload
- type SubagentDeselectedPayload
- type SubagentFailedPayload
- type SubagentSelectedPayload
- type SubagentStartedPayload
- type TaskCompletePayload
- type TitleChangedPayload
- type ToolCompletedPayload
- type ToolPartialResultPayload
- type ToolProgressPayload
- type ToolStartedPayload
- type TunnelStatusPayload
- type TurnPayload
- type UserInputCompletedPayload
- type UserInputRequestedPayload
- type WatchSessionPayload
- type WorktreeSummary
- type WorktreesListPayload
Constants ¶
const ( MsgSessionsList = "sessions_list" MsgSessionHistory = "session_history" MsgContentDelta = "content_delta" MsgToolStarted = "tool_started" MsgToolCompleted = "tool_completed" MsgIntentChanged = "intent_changed" MsgTurnStart = "turn_start" MsgTurnEnd = "turn_end" MsgSessionError = "error" MsgTunnelStatus = "tunnel_status" MsgWorktreesList = "worktrees_list" MsgReasoningDelta = "reasoning_delta" MsgPersistedSessionsList = "persisted_sessions_list" MsgUserMessage = "user_message" MsgDashboardConfig = "dashboard_config" MsgWatchHistory = "watch_history" MsgWatchEvent = "watch_event" // Subagent lifecycle. MsgSubagentStarted = "subagent_started" MsgSubagentCompleted = "subagent_completed" MsgSubagentFailed = "subagent_failed" MsgSubagentSelected = "subagent_selected" MsgSubagentDeselected = "subagent_deselected" // Tool progress. MsgToolProgress = "tool_progress" MsgToolPartialResult = "tool_partial_result" // Session lifecycle. MsgTitleChanged = "title_changed" MsgCompactionStart = "compaction_start" MsgCompactionComplete = "compaction_complete" MsgPlanChanged = "plan_changed" MsgTaskComplete = "task_complete" MsgContextChanged = "context_changed" MsgModelChange = "model_change" MsgModeChanged = "mode_changed" MsgSessionWarning = "session_warning" MsgSessionInfo = "session_info" // User input / elicitation. MsgUserInputRequested = "user_input_requested" MsgUserInputCompleted = "user_input_completed" MsgElicitationRequested = "elicitation_requested" MsgElicitationCompleted = "elicitation_completed" // Permissions. MsgPermissionRequested = "permission_requested" MsgPermissionCompleted = "permission_completed" // Hooks & skills. MsgHookStart = "hook_start" MsgHookEnd = "hook_end" MsgSkillInvoked = "skill_invoked" )
Server → Client message types.
const ( MsgGetSessions = "get_sessions" MsgGetHistory = "get_history" MsgSendMessage = "send_message" MsgCreateSession = "create_session" MsgResumeSession = "resume_session" MsgCloseSession = "close_session" MsgListWorktrees = "list_worktrees" MsgStartTunnel = "start_tunnel" MsgStopTunnel = "stop_tunnel" MsgGetPersistedSessions = "get_persisted_sessions" MsgSetTunnelConfig = "set_tunnel_config" MsgAddAllowedUser = "add_allowed_user" MsgRemoveAllowedUser = "remove_allowed_user" MsgGetAllowedUsers = "get_allowed_users" MsgRestartServer = "restart_server" MsgUpgradeServer = "upgrade_server" MsgWatchSession = "watch_session" MsgForkSession = "fork_session" MsgAbortSession = "abort_session" )
Client → Server message types.
const (
MsgAllowedUsersList = "allowed_users_list"
)
Server → Client
Variables ¶
This section is empty.
Functions ¶
func ParsePayload ¶
func ParsePayload[T any](msg BridgeMessage) (T, error)
ParsePayload unmarshals the raw payload of a BridgeMessage into T.
Types ¶
type AllowedUserPayload ¶
type AllowedUserPayload struct {
Email string `json:"email"`
}
type AllowedUsersListPayload ¶
type Bridge ¶
type Bridge struct {
// contains filtered or unexported fields
}
Bridge manages WebSocket connections and broadcasts session events to clients.
func NewBridge ¶
NewBridge creates a Bridge wired to the given copilot Manager. serverCtx should be the long-lived server context (not per-client).
func (*Bridge) BroadcastTunnelStatus ¶
BroadcastTunnelStatus sends tunnel status to all clients.
func (*Bridge) BroadcastWorktrees ¶
func (b *Bridge) BroadcastWorktrees(worktrees []WorktreeSummary)
BroadcastWorktrees sends the worktrees list to all clients.
func (*Bridge) HandleSharedWS ¶
func (b *Bridge) HandleSharedWS(w http.ResponseWriter, r *http.Request, sessionName string, mode string)
HandleSharedWS is the HTTP handler for /ws/shared/{token} — read-only, single session.
func (*Bridge) HandleWS ¶
func (b *Bridge) HandleWS(w http.ResponseWriter, r *http.Request)
HandleWS is the HTTP handler for the /ws endpoint.
func (*Bridge) SendWorktreesTo ¶
func (b *Bridge) SendWorktreesTo(client *wsClient, worktrees []WorktreeSummary)
SendWorktreesTo sends the worktrees list to a single client.
type BridgeMessage ¶
type BridgeMessage struct {
Type string `json:"type"`
Payload json.RawMessage `json:"payload,omitempty"`
}
BridgeMessage is the envelope for all WebSocket messages between the dashboard server and browser clients.
func NewMessage ¶
func NewMessage[T any](msgType string, payload T) (BridgeMessage, error)
NewMessage constructs a BridgeMessage by marshaling the given payload.
type CloseSessionPayload ¶
type CloseSessionPayload struct {
SessionName string `json:"session_name"`
}
type CompactionPayload ¶
type CompactionPayload struct {
SessionName string `json:"session_name"`
}
type ContentDeltaPayload ¶
type CreateSessionPayload ¶
type DashboardConfigPayload ¶
type DashboardConfigPayload struct {
OwnerNickname string `json:"owner_nickname"`
}
type ErrorPayload ¶
type ForkSessionPayload ¶
type GetHistoryPayload ¶
type GetHistoryPayload struct {
SessionName string `json:"session_name"`
}
type HookEndPayload ¶
type HookStartPayload ¶
type IntentChangedPayload ¶
type MessageSummary ¶
type ModeChangedPayload ¶
type ModelChangePayload ¶
type PersistedSessionSummary ¶
type PersistedSessionsListPayload ¶
type PersistedSessionsListPayload struct {
Sessions []PersistedSessionSummary `json:"sessions"`
}
type PlanChangedPayload ¶
type ReasoningDeltaPayload ¶
type ResumeSessionPayload ¶
type SendMessagePayload ¶
type Server ¶
type Server struct {
ListPRsFn func() (any, error)
GetPRFn func(id string) (any, error)
AddPRFn func(ctx context.Context, url string) (any, error)
RemovePRFn func(id string) error
// contains filtered or unexported fields
}
Server is the dashboard HTTP server that serves the web UI, REST API, and WebSocket bridge.
func (*Server) SetRestartHandler ¶
SetRestartHandler sets the callback for restarting the server from the dashboard.
func (*Server) SetUpgradeHandler ¶
SetUpgradeHandler sets the callback for upgrading the server from the dashboard.
type SessionHistoryPayload ¶
type SessionHistoryPayload struct {
SessionName string `json:"session_name"`
Messages []MessageSummary `json:"messages"`
}
type SessionInfoPayload ¶
type SessionSummary ¶
type SessionSummary struct {
Name string `json:"name"`
Model string `json:"model"`
SessionID string `json:"session_id"`
WorkingDir string `json:"working_dir"`
CreatedAt time.Time `json:"created_at"`
MessageCount int `json:"message_count"`
IsProcessing bool `json:"is_processing"`
Intent string `json:"intent"`
State string `json:"state"`
}
type SessionWarningPayload ¶
type SessionsListPayload ¶
type SessionsListPayload struct {
Sessions []SessionSummary `json:"sessions"`
ActiveSession string `json:"active_session"`
}
type SetTunnelConfigPayload ¶
type ShareToken ¶
type ShareToken struct {
}
ShareToken represents a time-limited share link for a single session.
type SkillInvokedPayload ¶
type SubagentDeselectedPayload ¶
type SubagentDeselectedPayload struct {
SessionName string `json:"session_name"`
}
type SubagentFailedPayload ¶
type SubagentSelectedPayload ¶
type SubagentStartedPayload ¶
type TaskCompletePayload ¶
type TitleChangedPayload ¶
type ToolCompletedPayload ¶
type ToolProgressPayload ¶
type ToolStartedPayload ¶
type TunnelStatusPayload ¶
type TurnPayload ¶
type TurnPayload struct {
SessionName string `json:"session_name"`
}
type WatchSessionPayload ¶
type WatchSessionPayload struct {
SessionID string `json:"session_id"`
}
type WorktreeSummary ¶
type WorktreesListPayload ¶
type WorktreesListPayload struct {
Worktrees []WorktreeSummary `json:"worktrees"`
}