server

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: MIT Imports: 50 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsPathWithin added in v0.5.1

func IsPathWithin(path, root string) bool

IsPathWithin 校验 path 是否在 root 目录内(公开方法)。

func SafeJoin added in v0.5.1

func SafeJoin(root, rel string) (string, error)

SafeJoin 在 root 目录内安全拼接 rel 路径,防止路径穿越。 返回绝对路径;若结果路径不在 root 内则返回错误。

func SanitizeName added in v0.5.1

func SanitizeName(name string) error

SanitizeName 校验名称只包含安全字符(字母、数字、下划线、连字符),用于 profile/kanban 等名称字段。

Types

type ActionStatus added in v0.3.0

type ActionStatus struct {
	Name      string     `json:"name"`
	Running   bool       `json:"running"`
	ExitCode  *int       `json:"exit_code"`
	Lines     []string   `json:"lines"`
	StartTime time.Time  `json:"start_time"`
	EndTime   *time.Time `json:"end_time,omitempty"`
}

type LogEntry added in v0.3.0

type LogEntry struct {
	Timestamp time.Time `json:"timestamp"`
	Level     string    `json:"level"`
	Message   string    `json:"message"`
	Source    string    `json:"source"`
}

type Message

type Message struct {
	ID         string                   `json:"id"`
	SessionID  string                   `json:"session_id"`
	Role       string                   `json:"role"`
	Content    string                   `json:"content"`
	Timestamp  int64                    `json:"timestamp"`
	ToolCalls  []map[string]interface{} `json:"tool_calls,omitempty"`
	ToolName   string                   `json:"tool_name,omitempty"`
	ToolCallID string                   `json:"tool_call_id,omitempty"`
}

type PlatformStatus added in v0.3.0

type PlatformStatus struct {
	ErrorCode    string `json:"error_code,omitempty"`
	ErrorMessage string `json:"error_message,omitempty"`
	State        string `json:"state"`
	UpdatedAt    int64  `json:"updated_at"`
}

type ProgressAnalysis added in v0.4.8

type ProgressAnalysis struct {
	SuggestedProgress int    `json:"suggested_progress"`
	Reason            string `json:"reason"`
	Completed         bool   `json:"completed"`
}

type ProviderInfo added in v0.3.0

type ProviderInfo struct {
	Name    string   `json:"name"`
	Label   string   `json:"label"`
	BaseURL string   `json:"base_url"`
	Models  []string `json:"models"`
	APIKey  string   `json:"api_key,omitempty"`
}

type QRStatus added in v0.4.0

type QRStatus struct {
	Platform  string `json:"platform"`
	Status    string `json:"status"`            // pending, scanning, confirmed, expired, error
	QRCode    string `json:"qr_code,omitempty"` // base64 encoded PNG
	Message   string `json:"message,omitempty"`
	ExpiresIn int    `json:"expires_in,omitempty"` // seconds remaining
}

type Server

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

func NewServer

func NewServer(dbPath string) *Server

func (*Server) Start

func (s *Server) Start(port int) error

func (*Server) Stop

func (s *Server) Stop()

Stop gracefully shuts down the HTTP server. It is safe to call from signal handlers when the server is no longer needed.

type Session

type Session struct {
	ID              string  `json:"id"`
	Profile         string  `json:"profile"`
	Source          string  `json:"source"`
	Model           string  `json:"model"`
	Title           string  `json:"title"`
	WorkDir         string  `json:"work_dir"`
	WorkDirUserSet  bool    `json:"work_dir_user_set"`
	StartedAt       int64   `json:"started_at"`
	EndedAt         *int64  `json:"ended_at"`
	LastActive      int64   `json:"last_active"`
	IsActive        bool    `json:"is_active"`
	MessageCount    int     `json:"message_count"`
	ToolCallCount   int     `json:"tool_call_count"`
	InputTokens     int     `json:"input_tokens"`
	OutputTokens    int     `json:"output_tokens"`
	Preview         string  `json:"preview"`
	ParentSessionID *string `json:"parent_session_id"`
}

type ShareToken added in v0.4.23

type ShareToken struct {
	Path      string    `json:"path"`
	Name      string    `json:"name"`
	IsDir     bool      `json:"is_dir"`
	CreatedAt time.Time `json:"created_at"`
	ExpiresAt time.Time `json:"expires_at"`
}

type Skill added in v0.3.0

type Skill struct {
	ID          string   `json:"id"`
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Category    string   `json:"category"`
	Tags        []string `json:"tags"`
	Enabled     bool     `json:"enabled"`
	Source      string   `json:"source"`           // "default" or "user"
	Status      string   `json:"status,omitempty"` // auto-skill status: pending/approved/archived/rejected
}

type Toolset added in v0.3.0

type Toolset struct {
	ID      string   `json:"id"`
	Name    string   `json:"name"`
	Tools   []string `json:"tools"`
	Enabled bool     `json:"enabled"`
}

Jump to

Keyboard shortcuts

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