ws

package
v0.0.0-...-3e68f17 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0 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.

Documentation

Overview

Package ws implements the WebSocket adapter for real-time client communication.

Index

Constants

View Source
const (
	EventTaskStatus  = "task.status"
	EventTaskOutput  = "task.output"
	EventAgentStatus = "agent.status"

	// Run protocol events (Phase 4B)
	EventRunStatus      = "run.status"
	EventToolCallStatus = "run.toolcall"

	// Phase 4C events
	EventQualityGate = "run.qualitygate"
	EventDelivery    = "run.delivery"

	// Phase 5A: orchestration plan events
	EventPlanStatus     = "plan.status"
	EventPlanStepStatus = "plan.step.status"

	// Phase 5E: team + shared context events
	EventTeamStatus          = "team.status"
	EventSharedContextUpdate = "shared.updated"
)

Event type constants for WebSocket messages.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentStatusEvent

type AgentStatusEvent struct {
	AgentID   string `json:"agent_id"`
	ProjectID string `json:"project_id"`
	Status    string `json:"status"`
}

AgentStatusEvent is broadcast when an agent's status changes.

type DeliveryEvent

type DeliveryEvent struct {
	RunID      string `json:"run_id"`
	TaskID     string `json:"task_id"`
	ProjectID  string `json:"project_id"`
	Status     string `json:"status"` // "started", "completed", "failed"
	Mode       string `json:"mode"`
	PatchPath  string `json:"patch_path,omitempty"`
	CommitHash string `json:"commit_hash,omitempty"`
	BranchName string `json:"branch_name,omitempty"`
	PRURL      string `json:"pr_url,omitempty"`
	Error      string `json:"error,omitempty"`
}

DeliveryEvent is broadcast when output delivery starts, completes, or fails.

type Hub

type Hub struct {
	// contains filtered or unexported fields
}

Hub manages all active WebSocket connections and broadcasts messages.

func NewHub

func NewHub() *Hub

NewHub creates a new WebSocket hub.

func (*Hub) Broadcast

func (h *Hub) Broadcast(ctx context.Context, msg Message)

Broadcast sends a message to all connected clients.

func (*Hub) BroadcastEvent

func (h *Hub) BroadcastEvent(ctx context.Context, eventType string, payload any)

BroadcastEvent is a convenience method that marshals a typed event and broadcasts it.

func (*Hub) ConnectionCount

func (h *Hub) ConnectionCount() int

ConnectionCount returns the number of active connections.

func (*Hub) HandleWS

func (h *Hub) HandleWS(w http.ResponseWriter, r *http.Request)

HandleWS returns an http.HandlerFunc that upgrades connections to WebSocket.

type Message

type Message struct {
	Type    string          `json:"type"`
	Payload json.RawMessage `json:"payload"`
}

Message is the envelope for all WebSocket messages.

type PlanStatusEvent

type PlanStatusEvent struct {
	PlanID    string `json:"plan_id"`
	ProjectID string `json:"project_id"`
	Status    string `json:"status"`
}

PlanStatusEvent is broadcast when an execution plan's status changes.

type PlanStepStatusEvent

type PlanStepStatusEvent struct {
	PlanID    string `json:"plan_id"`
	StepID    string `json:"step_id"`
	ProjectID string `json:"project_id"`
	Status    string `json:"status"`
	RunID     string `json:"run_id,omitempty"`
	Error     string `json:"error,omitempty"`
}

PlanStepStatusEvent is broadcast when a plan step's status changes.

type QualityGateEvent

type QualityGateEvent struct {
	RunID       string `json:"run_id"`
	TaskID      string `json:"task_id"`
	ProjectID   string `json:"project_id"`
	Status      string `json:"status"` // "started", "passed", "failed"
	TestsPassed *bool  `json:"tests_passed,omitempty"`
	LintPassed  *bool  `json:"lint_passed,omitempty"`
	Error       string `json:"error,omitempty"`
}

QualityGateEvent is broadcast when a quality gate starts, passes, or fails.

type RunStatusEvent

type RunStatusEvent struct {
	RunID     string  `json:"run_id"`
	TaskID    string  `json:"task_id"`
	ProjectID string  `json:"project_id"`
	Status    string  `json:"status"`
	StepCount int     `json:"step_count"`
	CostUSD   float64 `json:"cost_usd,omitempty"`
}

RunStatusEvent is broadcast when a run's status or metrics change.

type SharedContextUpdateEvent

type SharedContextUpdateEvent struct {
	TeamID  string `json:"team_id"`
	Key     string `json:"key"`
	Author  string `json:"author"`
	Version int    `json:"version"`
}

SharedContextUpdateEvent is broadcast when a shared context item is added or updated.

type TaskOutputEvent

type TaskOutputEvent struct {
	TaskID string `json:"task_id"`
	Line   string `json:"line"`
	Stream string `json:"stream"` // "stdout" or "stderr"
}

TaskOutputEvent is broadcast when a task produces streaming output.

type TaskStatusEvent

type TaskStatusEvent struct {
	TaskID    string `json:"task_id"`
	ProjectID string `json:"project_id"`
	Status    string `json:"status"`
	AgentID   string `json:"agent_id,omitempty"`
}

TaskStatusEvent is broadcast when a task's status changes.

type TeamStatusEvent

type TeamStatusEvent struct {
	TeamID    string `json:"team_id"`
	ProjectID string `json:"project_id"`
	Status    string `json:"status"`
	Name      string `json:"name"`
}

TeamStatusEvent is broadcast when a team's status changes.

type ToolCallStatusEvent

type ToolCallStatusEvent struct {
	RunID    string `json:"run_id"`
	CallID   string `json:"call_id"`
	Tool     string `json:"tool"`
	Decision string `json:"decision,omitempty"`
	Phase    string `json:"phase"` // "requested", "approved", "denied", "result"
}

ToolCallStatusEvent is broadcast for tool call lifecycle events.

Jump to

Keyboard shortcuts

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