Documentation
¶
Index ¶
- Constants
- Variables
- func CheckPushNotificationSetup()
- func IsValidChatID(chatID string) bool
- type AgentInfo
- type AgentStatusUpdate
- type AskUserReplyRequest
- type AskUserRequest
- type AskUserResponse
- type ChatSession
- type ConfigResponse
- type CreateSessionRequest
- type FileContentResponse
- type FileSearchResponse
- type FileSearchResult
- type FileTreeEntry
- type FileTreeResponse
- type GitActionRequest
- type GitActionResponse
- type GitCommit
- type GitDiffFile
- type GitDiffResponse
- type GitLogResponse
- type RegisterPushTokenRequest
- type Server
- func (s *Server) AddStatusListener(chatID string, match func(workflow.AgentStatusUpdate) bool) (<-chan workflow.AgentStatusUpdate, func())
- func (s *Server) Context() context.Context
- func (s *Server) EventHub() *SessionEventHub
- func (s *Server) PublishSessionEvent(chatID string, ev SessionEvent)
- func (s *Server) SendPushNotification(chatID string, questionText string, agentName string)
- func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (s *Server) Shutdown(ctx context.Context) error
- func (s *Server) Start() error
- type ServerOption
- type SessionEvent
- type SessionEventHub
- type SingleAgentExecutor
- type SingleAgentRunParams
- type SubdirsResponse
- type TriggerMessageRequest
- type WorkspaceFileResponse
Constants ¶
const ( EventTypeMessage = "message" EventTypeStatus = "status" EventTypeTitle = "title" EventTypeArtifact = "artifact" EventTypeDone = "done" EventTypeResync = "resync" EventTypeAuthExpired = "auth_expired" )
Variables ¶
var ErrServerShutdownBeforeStart = errors.New("server shut down before start completed")
ErrServerShutdownBeforeStart is returned by Start when Shutdown was called before or during Start.
Functions ¶
func CheckPushNotificationSetup ¶
func CheckPushNotificationSetup()
func IsValidChatID ¶
IsValidChatID checks whether chatID is non-empty, matches regex rules, and is within maximum length (64 chars).
Types ¶
type AgentInfo ¶
type AgentInfo struct {
ID string `json:"id"`
Type string `json:"type"`
Name string `json:"name"`
Description string `json:"description"`
Icon string `json:"icon"`
RunDirs []string `json:"run_dirs"`
MainAgent bool `json:"main_agent"`
Models []string `json:"models"`
}
AgentInfo holds details about an agent for the frontend UI.
type AgentStatusUpdate ¶
type AgentStatusUpdate = workflow.AgentStatusUpdate
AgentStatusUpdate is the JSON payload posted by aw to the internal status endpoint whenever the agent produces an incremental transcript update.
type AskUserReplyRequest ¶
type AskUserRequest ¶
type AskUserResponse ¶
type ChatSession ¶
type ChatSession struct {
ChatID string `json:"chatID"`
Title string `json:"title"`
CurrentAgent string `json:"currentAgent"`
RunDir string `json:"runDir"`
GitRoot string `json:"gitRoot,omitempty"`
IsRunning bool `json:"isRunning"`
Messages dbmodels.Messages `json:"messages,omitempty"`
Artifacts dbmodels.Artifacts `json:"artifacts,omitempty"`
}
ChatSession represents a session response/request payload for the WebUI.
type ConfigResponse ¶
type ConfigResponse struct {
FirebaseWebpushWeb *config.FirebaseWebpushWebConfig `json:"firebase_webpush_web,omitempty"`
}
ConfigResponse represents the public configuration sent to web clients.
type CreateSessionRequest ¶
type FileContentResponse ¶
type FileSearchResponse ¶
type FileSearchResponse struct {
Files []FileSearchResult `json:"files"`
}
type FileSearchResult ¶
type FileTreeEntry ¶
type FileTreeResponse ¶
type FileTreeResponse struct {
Entries []FileTreeEntry `json:"entries"`
Path string `json:"path"`
}
type GitActionRequest ¶
type GitActionRequest struct {
SessionID string `json:"session_id"`
}
GitActionRequest is the request payload for git actions like push/pull.
type GitActionResponse ¶
type GitActionResponse struct {
Success bool `json:"success"`
Output string `json:"output,omitempty"`
Error string `json:"error,omitempty"`
}
GitActionResponse is the response payload for git push/pull.
type GitCommit ¶
type GitCommit struct {
Hash string `json:"hash"`
ShortHash string `json:"shortHash"`
Author string `json:"author"`
AuthorEmail string `json:"authorEmail"`
Date string `json:"date"`
RelativeDate string `json:"relativeDate"`
Refs string `json:"refs"`
Message string `json:"message"`
}
GitCommit represents a commit entry in git log.
type GitDiffFile ¶
type GitDiffFile struct {
OldPath string `json:"oldPath"`
NewPath string `json:"newPath"`
Status string `json:"status"` // "A" | "M" | "D" | "R"
OldContent string `json:"oldContent"`
NewContent string `json:"newContent"`
Hunks []string `json:"hunks"`
}
GitDiffFile holds the before/after content and raw unified-diff hunks for one file.
type GitDiffResponse ¶
type GitDiffResponse struct {
Files []GitDiffFile `json:"files"`
}
GitDiffResponse is the response payload for GET /api/git/diff.
type GitLogResponse ¶
type GitLogResponse struct {
Commits []GitCommit `json:"commits"`
CurrentBranch string `json:"currentBranch"`
TrackingBranch string `json:"trackingBranch"`
Ahead int `json:"ahead"`
Behind int `json:"behind"`
UnstashedCount int `json:"unstashedCount"`
}
GitLogResponse is the response payload for GET /api/git/log.
type RegisterPushTokenRequest ¶
type RegisterPushTokenRequest struct {
Token string `json:"token"`
}
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server manages the HTTP server hosting agents.
func (*Server) AddStatusListener ¶
func (s *Server) AddStatusListener(chatID string, match func(workflow.AgentStatusUpdate) bool) (<-chan workflow.AgentStatusUpdate, func())
AddStatusListener registers a buffered channel that will receive AgentStatusUpdate events for the given chatID. match, when non-nil, filters which updates are delivered (e.g. by RunToken so parallel workflow nodes only receive their own updates). The returned cancel function must be called to deregister the channel and free resources.
func (*Server) EventHub ¶
func (s *Server) EventHub() *SessionEventHub
EventHub returns the Server's SessionEventHub instance.
func (*Server) PublishSessionEvent ¶
func (s *Server) PublishSessionEvent(chatID string, ev SessionEvent)
PublishSessionEvent broadcasts a session event if the event hub is initialized.
func (*Server) SendPushNotification ¶
func (*Server) ServeHTTP ¶
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP delegates HTTP requests to the current active ServeMux, adding CORS support.
type ServerOption ¶
type ServerOption func(*Server)
ServerOption mutates a Server during construction (functional options).
func WithCustomRunners ¶
func WithCustomRunners(runners ...workflow.NodeRunner) ServerOption
WithCustomRunners injects multiple custom NodeRunners.
func WithFunction ¶
func WithFunction(name string, fn workflow.WorkflowFunction) ServerOption
WithFunction injects a single Go-native function into the Server's registry. The registry is lazily created with the process-wide default registry as parent so globally registered functions remain resolvable.
func WithFunctionRegistry ¶
func WithFunctionRegistry(reg *workflow.FunctionRegistry) ServerOption
WithFunctionRegistry replaces the Server's workflow function registry.
func WithNodeRunner ¶
func WithNodeRunner(runner workflow.NodeRunner) ServerOption
WithNodeRunner injects a single custom NodeRunner, replacing the default runner for every NodeType it supports.
type SessionEvent ¶
type SessionEvent struct {
EventID int64 `json:"eventId"`
ChatID string `json:"chatId"`
Type string `json:"type"` // message | status | title | artifact | done | resync | auth_expired
Message *dbmodels.ChatMessage `json:"message,omitempty"`
Payload map[string]any `json:"payload,omitempty"`
Timestamp int64 `json:"timestamp"`
}
SessionEvent is the unified event structure broadcasted via EventHub and SSE.
type SessionEventHub ¶
type SessionEventHub struct {
// contains filtered or unexported fields
}
SessionEventHub manages per-chat event publishing and SSE subscriptions.
func NewSessionEventHub ¶
func NewSessionEventHub() *SessionEventHub
NewSessionEventHub creates a new SessionEventHub instance with background topic GC.
func NewSessionEventHubWithCapacity ¶
func NewSessionEventHubWithCapacity(capacity int) *SessionEventHub
NewSessionEventHubWithCapacity creates a new SessionEventHub with custom ring buffer capacity.
func (*SessionEventHub) Close ¶
func (h *SessionEventHub) Close()
Close gracefully stops the background GC ticker and closes all active subscriber connections.
func (*SessionEventHub) Publish ¶
func (h *SessionEventHub) Publish(chatID string, ev SessionEvent)
Publish broadcasts an event to the specified chat's topic.
func (*SessionEventHub) Subscribe ¶
func (h *SessionEventHub) Subscribe(chatID string, lastEventID int64) (<-chan SessionEvent, <-chan struct{}, func())
Subscribe registers a listener on the chat's event stream. If lastEventID > 0, missed events are replayed. If requested lastEventID was evicted from the ring buffer, or the topic is empty (e.g. after GC), a resync event is sent immediately. Returns the event channel, a done channel closed when the subscriber is disconnected, and a cancel function.
type SingleAgentExecutor ¶
type SingleAgentExecutor struct {
// contains filtered or unexported fields
}
SingleAgentExecutor handles responding to and processing single-agent tasks.
func NewSingleAgentExecutor ¶
func NewSingleAgentExecutor(agent *agents.Agent, conf *config.Config, repo *dbmodels.SessionRepository, server *Server, llmClient llm.Client) *SingleAgentExecutor
NewSingleAgentExecutor creates a SingleAgentExecutor for the given agent. llmClient may be nil; in that case a genai-backed client is created lazily for session title generation using the configured (or env) API key.
func (*SingleAgentExecutor) Execute ¶
func (e *SingleAgentExecutor) Execute(ctx context.Context, params SingleAgentRunParams) (string, error)
Execute handles the agent execution.
type SingleAgentRunParams ¶
type SingleAgentRunParams struct {
ChatID string
Prompt string
RunDir string
Model string
Metadata map[string]any
}
SingleAgentRunParams carries the parameters for a single agent execution.
type SubdirsResponse ¶
type SubdirsResponse struct {
Subdirs []string `json:"subdirs"`
GitRoot string `json:"git_root,omitempty"`
}
SubdirsResponse represents the response payload for listing subdirectories.
type TriggerMessageRequest ¶
type TriggerMessageRequest struct {
Prompt string `json:"prompt"`
ChatID string `json:"chatId,omitempty"`
RunDir string `json:"runDir,omitempty"`
Model string `json:"model,omitempty"`
Wait bool `json:"wait,omitempty"`
Headless bool `json:"-"`
Metadata map[string]any `json:"metadata,omitempty"`
}
TriggerMessageRequest represents the payload for POST /api/agents/{id}/message.
Source Files
¶
- agent_handler.go
- ask_user_handler.go
- event_hub.go
- file_handler.go
- files_handler.go
- git_diff_handler.go
- manage_handler.go
- message_trigger_handler.go
- push_handler.go
- server.go
- session_events_handler.go
- session_handler.go
- single_agent_executor.go
- single_agent_sequential.go
- status_handler.go
- subdirs_handler.go
- team_handler.go
- ttyd_handler.go
- validation.go
- workflow_handler.go
- workflow_persist.go