daemon

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatRequest

type ChatRequest struct {
	Prompt    string `json:"prompt"`
	SessionID string `json:"session_id,omitempty"`
	Model     string `json:"model,omitempty"`
	MaxTurns  int    `json:"max_turns,omitempty"`
	Autonomy  string `json:"autonomy,omitempty"`
	CWD       string `json:"cwd,omitempty"`
	Agent     string `json:"agent,omitempty"`
}

ChatRequest is the JSON body for POST /v1/chat.

type ChatResponse

type ChatResponse struct {
	SessionID  string `json:"session_id"`
	Response   string `json:"response"`
	TokensIn   int    `json:"tokens_in"`
	TokensOut  int    `json:"tokens_out"`
	TurnsTaken int    `json:"turns_taken"`
	Duration   string `json:"duration"`
}

ChatResponse is the JSON response from POST /v1/chat.

type Config

type Config struct {
	Port    int    `json:"port"`
	Host    string `json:"host"`
	LogFile string `json:"log_file"`
}

Config holds daemon configuration.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns reasonable defaults.

type HealthResponse

type HealthResponse struct {
	Status    string `json:"status"`
	Version   string `json:"version"`
	Uptime    string `json:"uptime"`
	Sessions  int    `json:"active_sessions"`
	StartedAt string `json:"started_at"`
}

HealthResponse is the JSON response from GET /v1/health.

type Server

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

Server is the hawk daemon HTTP server for programmatic/CI access.

func New

func New(cfg Config, factory SessionFactory) *Server

New creates a new daemon server. If factory is nil, chat endpoint returns an error.

func (*Server) Addr

func (s *Server) Addr() string

Addr returns the listening address.

func (*Server) Start

func (s *Server) Start() (string, error)

Start begins serving in the background. Returns the listening address.

func (*Server) Stop

func (s *Server) Stop(ctx context.Context) error

Stop gracefully shuts down the daemon.

type Session

type Session struct {
	ID        string    `json:"id"`
	CreatedAt time.Time `json:"created_at"`
	LastUsed  time.Time `json:"last_used"`
	Turns     int       `json:"turns"`
	CWD       string    `json:"cwd"`
}

Session tracks an active daemon session.

type SessionFactory

type SessionFactory func(req ChatRequest) (*engine.Session, error)

SessionFactory creates a configured engine session for a given request. The caller (cmd package) provides this, wiring system prompts, tools, keys.

Jump to

Keyboard shortcuts

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