api

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2026 License: AGPL-3.0-or-later Imports: 33 Imported by: 0

Documentation

Overview

Package api exposes a JSON HTTP API over an agencycli workspace for the web UI and integrations.

Index

Constants

View Source
const (
	RoleAdmin  = "admin"
	RoleMember = "member"
)

System roles.

View Source
const (
	ProjectRoleViewer   = "viewer"
	ProjectRoleOperator = "operator"
	ProjectRoleManager  = "manager"
)

Project-level roles (ascending privilege).

Variables

This section is empty.

Functions

func ResolveAPIKey

func ResolveAPIKey(flag string) string

ResolveAPIKey returns the API key from flag or AGENCYCLI_WEB_API_KEY.

Types

type DaemonStatusFunc

type DaemonStatusFunc func() map[string]any

DaemonStatusFunc returns daemon status as a JSON-friendly map.

type SchedulerManager

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

func (*SchedulerManager) Cleanup

func (m *SchedulerManager) Cleanup()

func (*SchedulerManager) Start

func (m *SchedulerManager) Start(project, agent string) error

func (*SchedulerManager) Status

func (m *SchedulerManager) Status() []schedStatus

func (*SchedulerManager) Stop

func (m *SchedulerManager) Stop(project, agent string) error

type Server

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

Server serves JSON for one workspace root.

func NewServer

func NewServer(root, apiKey string) *Server

NewServer builds an API server for the given workspace root. If apiKey is non-empty, requests must send Authorization: Bearer <apiKey>.

func (*Server) Handler

func (s *Server) Handler() http.Handler

Handler returns the root HTTP handler (includes optional auth).

func (*Server) SetDaemonStatus

func (s *Server) SetDaemonStatus(fn DaemonStatusFunc)

SetDaemonStatus sets the function used to get daemon status.

func (*Server) SetUpdateChecker

func (s *Server) SetUpdateChecker(fn UpdateChecker)

SetUpdateChecker sets the function used to check for updates.

func (*Server) SetVersion

func (s *Server) SetVersion(v string)

SetVersion sets the build version string exposed via /api/v1/health.

func (*Server) Shutdown

func (s *Server) Shutdown()

Shutdown stops all managed scheduler processes.

type UpdateChecker

type UpdateChecker func() (latestVersion, releaseNotes string, hasUpdate bool)

UpdateChecker returns latest version info. Set by the caller.

type UserStore

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

func (*UserStore) Authenticate

func (s *UserStore) Authenticate(username, password string) *userRecord

func (*UserStore) ChangePassword

func (s *UserStore) ChangePassword(username, oldPass, newPass string) error

func (*UserStore) CreateUser

func (s *UserStore) CreateUser(username, password, role, displayName, email, avatar, phone, bio string) error

func (*UserStore) DeleteUser

func (s *UserStore) DeleteUser(username string) error

func (*UserStore) GetUser

func (s *UserStore) GetUser(username string) *userRecord

func (*UserStore) HasProjectAccess

func (s *UserStore) HasProjectAccess(username, project string) (string, bool)

func (*UserStore) IssueToken

func (s *UserStore) IssueToken(username string, dur time.Duration) string

func (*UserStore) ListUsers

func (s *UserStore) ListUsers() []userRecord

func (*UserStore) Secret

func (s *UserStore) Secret() string

func (*UserStore) UpdateUser

func (s *UserStore) UpdateUser(username string, role, displayName, email, avatar, phone, bio *string, disabled *bool, projects []projectAccess, linkedAgents []string, newPassword *string) error

func (*UserStore) ValidateToken

func (s *UserStore) ValidateToken(token string) (string, bool)

Jump to

Keyboard shortcuts

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