Documentation
¶
Index ¶
- Constants
- Variables
- type Department
- type DepartmentBrief
- type DepartmentTree
- type EnvConfig
- type ExecutionStatus
- type FailureInfo
- type Role
- type RoleWithPermissions
- type SystemConfig
- type Task
- type TokenStats
- type User
- type UserWithRoles
- type Worker
- type WorkerDepartment
- type WorkerExecution
- type WorkerStatus
- type WorkerWithDepartments
Constants ¶
const ( TaskTypeImmediate = "immediate" TaskTypeCountdown = "countdown" TaskTypeScheduled = "scheduled" TaskStatusPending = "pending" TaskStatusRunning = "running" TaskStatusCompleted = "completed" TaskStatusFailed = "failed" TaskStatusCancelled = "cancelled" TaskStatusActive = TaskStatusPending + "," + TaskStatusRunning )
const ( UserStatusActive = "active" UserStatusDisabled = "disabled" )
User status constants.
const RoleIDSuperAdmin = "sysrole_superadmin"
RoleIDSuperAdmin is the sole seed system role (inserted by migration v47).
const SystemConfigKeyDefaultEngine = "default_engine"
SystemConfigKeyDefaultEngine is the key for the default bee engine.
const SystemConfigKeyEngineArgsBee = "engine_args_bee"
SystemConfigKeyEngineArgsBee is the key for bee-level engine args.
const SystemConfigKeyEngineArgsGlobal = "engine_args_global"
SystemConfigKeyEngineArgsGlobal is the key for global engine args (applied to all workers).
Variables ¶
var TaskStatuses = []string{ TaskStatusPending, TaskStatusRunning, TaskStatusCompleted, TaskStatusFailed, TaskStatusCancelled, }
Functions ¶
This section is empty.
Types ¶
type Department ¶
type Department struct {
ID string `json:"id" db:"id"`
Name string `json:"name" db:"name"`
ParentID *string `json:"parent_id" db:"parent_id"`
SortOrder int `json:"sort_order" db:"sort_order"`
CreatedAt int64 `json:"created_at" db:"created_at"`
UpdatedAt int64 `json:"updated_at" db:"updated_at"`
}
Department represents a department node in a tree hierarchy.
type DepartmentBrief ¶ added in v0.0.22
DepartmentBrief is a lightweight department summary used in list and detail responses.
func ToDepartmentBriefs ¶ added in v0.0.22
func ToDepartmentBriefs(depts []Department) []DepartmentBrief
ToDepartmentBriefs converts a slice of Department to a slice of DepartmentBrief.
type DepartmentTree ¶
type DepartmentTree struct {
Department
Children []DepartmentTree `json:"children"`
}
DepartmentTree is a Department with its nested children for tree responses.
type EnvConfig ¶ added in v0.0.24
type EnvConfig struct {
ID string `json:"id" db:"id"`
Scope string `json:"scope" db:"scope"`
ScopeID *string `json:"scope_id" db:"scope_id"`
Key string `json:"key" db:"key"`
EncValue string `json:"-" db:"enc_value"`
Masked string `json:"masked" db:"masked"`
CreatedAt int64 `json:"created_at" db:"created_at"`
UpdatedAt int64 `json:"updated_at" db:"updated_at"`
}
type ExecutionStatus ¶
type ExecutionStatus string
const ( ExecStatusPending ExecutionStatus = "pending" ExecStatusRunning ExecutionStatus = "running" ExecStatusCompleted ExecutionStatus = "completed" ExecStatusFailed ExecutionStatus = "failed" )
type FailureInfo ¶
type FailureInfo struct {
Reason string // raw error (exec.Result or err.Error())
WorkerName string // worker or bee name for identification
}
FailureInfo carries context for a task failure notification sent to the user.
type Role ¶ added in v0.0.42
type Role struct {
ID string `json:"id" db:"id"`
Name string `json:"name" db:"name"`
Description string `json:"description" db:"description"`
IsSystem bool `json:"is_system" db:"is_system"`
CreatedAt int64 `json:"created_at" db:"created_at"`
UpdatedAt int64 `json:"updated_at" db:"updated_at"`
}
Role is an RBAC role.
type RoleWithPermissions ¶ added in v0.0.42
RoleWithPermissions is a role plus its permission keys.
type SystemConfig ¶ added in v0.0.26
type SystemConfig struct {
Key string `db:"key"`
Value string `db:"value"`
UpdatedAt int64 `db:"updated_at"`
}
SystemConfig is a global key/value system setting.
type Task ¶
type Task struct {
ID string
MessageID string
SessionKey string
Platform string
WorkerID string
Instruction string
Type string // TaskTypeImmediate | TaskTypeCountdown | TaskTypeScheduled
Status string // TaskStatus*
ScheduledAt *int64 // ms; countdown: absolute trigger time
CronExpr string
NextRunAt *int64 // ms; scheduled tasks only
CreatedAt int64
UpdatedAt int64
}
Task represents a unit of work created by bee and dispatched to a worker.
type TokenStats ¶ added in v0.0.32
type TokenStats struct {
ID string `json:"id" db:"id"`
SessionID string `json:"session_id" db:"session_id"`
AgentType string `json:"agent_type" db:"agent_type"`
Model string `json:"model" db:"model"`
InputTokens int64 `json:"input_tokens" db:"input_tokens"`
OutputTokens int64 `json:"output_tokens" db:"output_tokens"`
CacheCreationTokens int64 `json:"cache_creation_tokens" db:"cache_creation_tokens"`
CacheReadTokens int64 `json:"cache_read_tokens" db:"cache_read_tokens"`
TotalTokens int64 `json:"total_tokens" db:"total_tokens"`
SyncedAt int64 `json:"synced_at" db:"synced_at"`
}
type User ¶ added in v0.0.42
type User struct {
ID string `json:"id" db:"id"`
Username string `json:"username" db:"username"`
PasswordHash string `json:"-" db:"password_hash"`
DisplayName string `json:"display_name" db:"display_name"`
Status string `json:"status" db:"status"`
CreatedBy string `json:"created_by" db:"created_by"`
CreatedAt int64 `json:"created_at" db:"created_at"`
UpdatedAt int64 `json:"updated_at" db:"updated_at"`
// PasswordChangedAt is the millisecond timestamp (floored to the second) of
// the last password change. Access/refresh tokens issued before this instant
// are rejected, forcing a re-login after any password change or admin reset.
PasswordChangedAt int64 `json:"-" db:"password_changed_at"`
}
User is a human account that can log in to the web console.
type UserWithRoles ¶ added in v0.0.42
UserWithRoles is a user plus its assigned roles, for list/detail responses.
type Worker ¶
type Worker struct {
ID string `json:"id" db:"id"`
Name string `json:"name" db:"name"`
Description string `json:"description" db:"description"`
Constraints string `json:"constraints" db:"constraints"`
WorkDir string `json:"work_dir" db:"work_dir"`
Engine string `json:"engine" db:"engine"`
EngineArgs string `json:"engine_args" db:"engine_args"`
Status WorkerStatus `json:"status" db:"status"`
PermissionScopes string `json:"permission_scopes" db:"permission_scopes"`
CreatedAt int64 `json:"created_at" db:"created_at"`
UpdatedAt int64 `json:"updated_at" db:"updated_at"`
}
type WorkerDepartment ¶
type WorkerDepartment struct {
WorkerID string `json:"worker_id" db:"worker_id"`
DepartmentID string `json:"department_id" db:"department_id"`
CreatedAt int64 `json:"created_at" db:"created_at"`
}
WorkerDepartment represents the many-to-many link between a Worker and a Department.
type WorkerExecution ¶
type WorkerExecution struct {
ID string `json:"id" db:"id"`
TaskID string `json:"task_id,omitempty" db:"task_id"`
WorkerID *string `json:"worker_id,omitempty" db:"worker_id"`
WorkerName string `json:"worker_name,omitempty" db:"-"`
SessionID string `json:"session_id" db:"session_id"`
Engine string `json:"engine,omitempty" db:"engine"`
TriggerInput string `json:"trigger_input,omitempty" db:"trigger_input"`
Status ExecutionStatus `json:"status" db:"status"`
Result string `json:"result,omitempty" db:"result"`
LogPath string `json:"log_path,omitempty" db:"log_path"`
AIProcessPID int `json:"ai_process_pid,omitempty" db:"ai_process_pid"`
StartedAt *int64 `json:"started_at,omitempty" db:"started_at"`
CompletedAt *int64 `json:"completed_at,omitempty" db:"completed_at"`
}
type WorkerStatus ¶
type WorkerStatus string
const ( WorkerStatusIdle WorkerStatus = "idle" WorkerStatusWorking WorkerStatus = "working" WorkerStatusError WorkerStatus = "error" )
type WorkerWithDepartments ¶ added in v0.0.22
type WorkerWithDepartments struct {
Worker
Departments []DepartmentBrief `json:"departments"`
}
WorkerWithDepartments is a Worker with its associated department summaries.