Help us shape the future of Go! Take the 2026 Go Developer Survey

server

package
v0.19.2 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: MIT Imports: 71 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EvtTextDelta           = "text_delta"
	EvtImage               = "image"
	EvtReasoningDelta      = "reasoning_delta"
	EvtToolCall            = "tool_call"
	EvtToolResult          = "tool_result"
	EvtToolProgress        = "tool_progress"
	EvtStreamReset         = "stream_reset"
	EvtPhase               = "phase"
	EvtError               = "error"
	EvtFilesChanged        = "files_changed"
	EvtDiffsChanged        = "diffs_changed"
	EvtGitIndexChanged     = "git_index_changed"
	EvtSessionsChanged     = "sessions_changed"
	EvtDiagnosticsChanged  = "diagnostics_changed"
	EvtCapabilitiesChanged = "capabilities_changed"
	EvtModelChanged        = "model_changed"
	EvtTurnInput           = "turn_input"
	EvtTasksChanged        = "tasks_changed"
	EvtTerminalsChanged    = "terminals_changed"
	EvtSkillsChanged       = "skills_changed"
)
View Source
const (
	// The prompt wire kind predates the tool rename to elicit. Keep "ask"
	// for existing web clients; it is not an executable tool name.
	PromptKindAsk      = "ask"
	PromptKindConfirm  = "confirm"
	PromptScopeSession = "session"
)
View Source
const DefaultPort = 9000

DefaultPort is the preferred port used when no explicit port is requested.

Variables

View Source
var StaticFS, _ = fs.Sub(staticFiles, "static")

Functions

func LocalHostOnly added in v0.16.10

func LocalHostOnly(next http.Handler) http.Handler

LocalHostOnly guards local HTTP entry points while permitting authenticated relay transports. Same-origin checks do not prevent DNS rebinding: the browser's origin can still match a hostile Host after its DNS starts resolving to loopback. The unauthenticated local transport only serves literal loopback hosts.

Types

type AgentEntry added in v0.7.0

type AgentEntry struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type Command added in v0.16.4

type Command struct {
	ID         string               `json:"id"`
	Epoch      string               `json:"epoch,omitempty"`
	Type       string               `json:"type"`
	InputID    string               `json:"inputId,omitempty"`
	Text       string               `json:"text,omitempty"`
	Files      []string             `json:"files,omitempty"`
	Images     []string             `json:"images,omitempty"`
	Intent     code.TurnInputIntent `json:"intent,omitempty"`
	ClearQueue bool                 `json:"clearQueue,omitempty"`
	PromptID   string               `json:"promptId,omitempty"`
	Action     string               `json:"action,omitempty"`
	Scope      string               `json:"scope,omitempty"`
	Content    map[string]any       `json:"content,omitempty"`
	Model      *string              `json:"model,omitempty"`
	Effort     *string              `json:"effort,omitempty"`
	Mode       *string              `json:"mode,omitempty"`
	Unattended *bool                `json:"unattended,omitempty"`
	Source     string               `json:"source,omitempty"`
	Title      string               `json:"title,omitempty"`
}

type CompactionView added in v0.19.0

type CompactionView struct {
	TokensBefore int64 `json:"tokensBefore"`
	TokensAfter  int64 `json:"tokensAfter"`
}

type ConversationContent

type ConversationContent struct {
	Text       string                 `json:"text,omitempty"`
	TextID     string                 `json:"text_id,omitempty"`
	Image      *ConversationImage     `json:"image,omitempty"`
	Reasoning  *ConversationReasoning `json:"reasoning,omitempty"`
	ToolCall   *ConversationTool      `json:"tool_call,omitempty"`
	ToolResult *ConversationResult    `json:"tool_result,omitempty"`
}

type ConversationImage added in v0.6.9

type ConversationImage struct {
	Data string `json:"data"`
	Name string `json:"name,omitempty"`
}

type ConversationMessage

type ConversationMessage struct {
	InputID string                `json:"input_id,omitempty"`
	Role    string                `json:"role"`
	Content []ConversationContent `json:"content"`
}

type ConversationReasoning

type ConversationReasoning struct {
	ID      string `json:"id,omitempty"`
	Summary string `json:"summary,omitempty"`
}

type ConversationResult

type ConversationResult struct {
	ID        string                 `json:"id,omitempty"`
	Name      string                 `json:"name"`
	Kind      string                 `json:"kind,omitempty"`
	Args      string                 `json:"args,omitempty"`
	Locations []harness.ToolLocation `json:"locations,omitempty"`
	Content   string                 `json:"content"`
}

type ConversationTool

type ConversationTool struct {
	ID        string                 `json:"id,omitempty"`
	Name      string                 `json:"name"`
	Kind      string                 `json:"kind,omitempty"`
	Args      string                 `json:"args,omitempty"`
	Locations []harness.ToolLocation `json:"locations,omitempty"`
	Hint      string                 `json:"hint,omitempty"`
}

type DiffEntry

type DiffEntry struct {
	Path         string `json:"path"`
	OriginalPath string `json:"original_path,omitempty"`
	Status       string `json:"status"`
	Patch        string `json:"patch"`
	Original     string `json:"original,omitempty"`
	Modified     string `json:"modified,omitempty"`
	Language     string `json:"language,omitempty"`
}

type FileContent

type FileContent struct {
	Path     string `json:"path"`
	Content  string `json:"content,omitempty"`
	Language string `json:"language,omitempty"`
	Revision string `json:"revision"`

	Binary bool   `json:"binary,omitempty"`
	Mime   string `json:"mime,omitempty"`
	Size   int64  `json:"size"`
}

type FileEntry

type FileEntry struct {
	Name  string `json:"name"`
	Path  string `json:"path"`
	IsDir bool   `json:"is_dir"`
	Size  int64  `json:"size"`
}

type Frame added in v0.6.9

type Frame struct {
	Type    string `json:"type"`
	Session string `json:"session,omitempty"`
	Backend string `json:"backend,omitempty"`

	Text      string                 `json:"text,omitempty"`
	ID        string                 `json:"id,omitempty"`
	Name      string                 `json:"name,omitempty"`
	Kind      string                 `json:"kind,omitempty"`
	Args      string                 `json:"args,omitempty"`
	Locations []harness.ToolLocation `json:"locations,omitempty"`
	Hint      string                 `json:"hint,omitempty"`
	Content   string                 `json:"content,omitempty"`
	Phase     string                 `json:"phase,omitempty"`
	Message   string                 `json:"message,omitempty"`
	Part      int                    `json:"part,omitempty"`
	Partial   bool                   `json:"partial,omitempty"`
	Input     *TurnQueueEntry        `json:"input,omitempty"`
}

Frame carries internal adapter updates and workspace resource invalidations. Session frames are projected by sessionController; only sessionEvent is public.

type GitBranch added in v0.12.6

type GitBranch struct {
	Name    string `json:"name"`
	Remote  string `json:"remote,omitempty"`
	Current bool   `json:"current,omitempty"`
}

type GitBranches added in v0.12.6

type GitBranches struct {
	Branches []GitBranch `json:"branches"`
	Warning  string      `json:"warning,omitempty"`
}

type GitCommit added in v0.14.2

type GitCommit struct {
	Hash       string   `json:"hash"`
	Parents    []string `json:"parents"`
	Summary    string   `json:"summary"`
	Author     string   `json:"author"`
	AuthoredAt string   `json:"authored_at"`
	Refs       []string `json:"refs"`
}

type GitCompare added in v0.14.2

type GitCompare struct {
	Base          string      `json:"base"`
	Head          string      `json:"head"`
	BaseHash      string      `json:"base_hash"`
	HeadHash      string      `json:"head_hash"`
	MergeBaseHash string      `json:"merge_base_hash,omitempty"`
	Files         []DiffEntry `json:"files"`
}

type GitFileStatus added in v0.12.6

type GitFileStatus struct {
	Path           string `json:"path"`
	OriginalPath   string `json:"original_path,omitempty"`
	IndexStatus    string `json:"index_status,omitempty"`
	WorktreeStatus string `json:"worktree_status,omitempty"`
	Staged         bool   `json:"staged"`
	Changed        bool   `json:"changed"`
	Conflict       bool   `json:"conflict,omitempty"`
}

type GitStatus added in v0.12.6

type GitStatus struct {
	Branch    string          `json:"branch"`
	Head      string          `json:"head"`
	Upstream  string          `json:"upstream,omitempty"`
	Ahead     int             `json:"ahead"`
	Behind    int             `json:"behind"`
	HasRemote bool            `json:"has_remote"`
	Files     []GitFileStatus `json:"files"`
}

type PromptView added in v0.16.4

type PromptView struct {
	ID      string             `json:"id"`
	Kind    string             `json:"kind"`
	Message string             `json:"message"`
	Fields  []tool.ElicitField `json:"fields,omitempty"`
}

type Receipt added in v0.16.4

type Receipt struct {
	ID      string     `json:"id"`
	Ref     SessionRef `json:"ref"`
	Epoch   string     `json:"epoch"`
	Outcome string     `json:"outcome"`
}

type ScheduleEntry added in v0.12.19

type ScheduleEntry struct {
	ID       string `json:"id"`
	Prompt   string `json:"prompt"`
	Schedule string `json:"schedule"`
	Status   string `json:"status"`
	Script   bool   `json:"script,omitempty"`
	NextRun  string `json:"next_run,omitempty"`
	NextIn   string `json:"next_in,omitempty"`
	LastRun  string `json:"last_run,omitempty"`
	Failures int    `json:"failures,omitempty"`
}

type Server

type Server struct {
	*harness.Config
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, workDir string, opts *ServerOptions) (_ *Server, err error)

func (*Server) Close added in v0.6.9

func (s *Server) Close()

func (*Server) InstanceID added in v0.16.4

func (s *Server) InstanceID() string

func (*Server) LaunchTerminal added in v0.14.10

func (s *Server) LaunchTerminal(_ context.Context, launch dap.TerminalLaunch) (dap.TerminalProcess, error)

LaunchTerminal implements dap.TerminalLauncher with Wingman's existing PTY service. DAP owns the reviewed command; the browser terminal API remains limited to the user's configured shells.

func (*Server) Run

func (s *Server) Run(ctx context.Context, port int) error

func (*Server) ServeHTTP added in v0.6.4

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

type ServerOptions added in v0.6.9

type ServerOptions struct {
	NoBrowser   bool
	RemoteURL   string
	RemoteToken string
	// contains filtered or unexported fields
}

type SessionChange added in v0.16.4

type SessionChange struct {
	Type    string            `json:"type"`
	Entry   *TranscriptEntry  `json:"entry,omitempty"`
	Entries []TranscriptEntry `json:"entries,omitempty"`
	ID      string            `json:"id,omitempty"`
	Text    string            `json:"text,omitempty"`
	IDs     []string          `json:"ids,omitempty"`
	State   *SessionState     `json:"state,omitempty"`
}

type SessionEntry

type SessionEntry struct {
	ID        string `json:"id"`
	Title     string `json:"title,omitempty"`
	UpdatedAt string `json:"updated_at"`
}

type SessionRef added in v0.16.4

type SessionRef struct {
	WorkspaceID string `json:"workspaceId"`
	BackendID   string `json:"backendId"`
	SessionID   string `json:"sessionId"`
}

type SessionSettings added in v0.16.4

type SessionSettings struct {
	Models      []modelOption `json:"models"`
	Model       string        `json:"model"`
	Effort      string        `json:"effort"`
	Efforts     []string      `json:"efforts"`
	Mode        string        `json:"mode"`
	Modes       []modeOption  `json:"modes"`
	Unattended  *bool         `json:"unattended,omitempty"`
	CanDelete   bool          `json:"canDelete"`
	CanFork     bool          `json:"canFork"`
	CanCompact  bool          `json:"canCompact"`
	ModelsError string        `json:"modelsError,omitempty"`
}

type SessionState added in v0.16.4

type SessionState struct {
	Status        string             `json:"status"`
	Phase         string             `json:"phase"`
	Retry         *harness.RetryInfo `json:"retry,omitempty"`
	Error         *string            `json:"error"`
	Compaction    *CompactionView    `json:"compaction,omitempty"`
	Usage         UsageView          `json:"usage"`
	Prompts       []PromptView       `json:"prompts"`
	PendingInputs []TurnQueueEntry   `json:"pendingInputs"`
	QueuePaused   bool               `json:"queuePaused"`
	CanSteer      bool               `json:"canSteer"`
	Settings      SessionSettings    `json:"settings"`
	ToolProgress  map[string]string  `json:"toolProgress"`
}

type SkillEntry

type SkillEntry struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	InputHint   string `json:"input_hint,omitempty"`
}

type TaskEntry added in v0.11.2

type TaskEntry struct {
	ID          string `json:"id"`
	Description string `json:"description"`
	AgentType   string `json:"agent_type"`
	Status      string `json:"status"`
	Activity    string `json:"activity,omitempty"`
	Elapsed     int64  `json:"elapsed_seconds"`
	Seq         int    `json:"seq"`
}

type TerminalEntry added in v0.11.9

type TerminalEntry struct {
	ID    string `json:"id"`
	Title string `json:"title"`
	Shell string `json:"shell"`
	Cols  int    `json:"cols"`
	Rows  int    `json:"rows"`
	Busy  bool   `json:"busy"`
}

type TranscriptEntry added in v0.16.4

type TranscriptEntry struct {
	ID            string                 `json:"id"`
	Type          string                 `json:"type"`
	Content       string                 `json:"content"`
	MessageID     string                 `json:"messageId,omitempty"`
	InputID       string                 `json:"inputId,omitempty"`
	Files         []string               `json:"files,omitempty"`
	Images        []string               `json:"images,omitempty"`
	ToolID        string                 `json:"toolId,omitempty"`
	ToolName      string                 `json:"toolName,omitempty"`
	ToolKind      string                 `json:"toolKind,omitempty"`
	ToolArgs      string                 `json:"toolArgs,omitempty"`
	ToolLocations []harness.ToolLocation `json:"toolLocations,omitempty"`
	ToolHint      string                 `json:"toolHint,omitempty"`
	ToolResult    *string                `json:"toolResult,omitempty"`
	ToolPartial   bool                   `json:"toolPartial,omitempty"`
	ReasoningID   string                 `json:"reasoningId,omitempty"`
}

TranscriptEntry is the visible Wingman model. Provider messages, retry bookkeeping, hidden instructions and journal events never cross this boundary.

type TurnQueueEntry added in v0.10.9

type TurnQueueEntry struct {
	Origin   string   `json:"origin,omitempty"`
	ID       string   `json:"id"`
	State    string   `json:"state"`
	Intent   string   `json:"intent"`
	Position int      `json:"position,omitempty"`
	Text     string   `json:"text,omitempty"`
	Files    []string `json:"files,omitempty"`
	Images   []string `json:"images,omitempty"`
}

type UsageView added in v0.16.4

type UsageView struct {
	InputTokens     int64 `json:"inputTokens"`
	CachedTokens    int64 `json:"cachedTokens"`
	OutputTokens    int64 `json:"outputTokens"`
	LastInputTokens int64 `json:"lastInputTokens"`
	ContextWindow   int64 `json:"contextWindow"`
}

type WorkspaceScope added in v0.16.4

type WorkspaceScope struct {
	WorkspaceID string `json:"workspaceId"`
	InstanceID  string `json:"instanceId"`
}

Jump to

Keyboard shortcuts

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