启动项目逻辑

This commit is contained in:
2026-06-09 22:43:29 +08:00
parent d5a28b11a3
commit f4a7c770af
43 changed files with 3797 additions and 42 deletions
+41
View File
@@ -0,0 +1,41 @@
// Package run 实现 workspace run profiles:每个 workspace 下可配置多个运行档
// (dev/prod/test),后端把每个 profile 作为长驻进程在 workspace 主工作区
// (main_path)拉起并托管其完整生命周期(start/stop/restart + 实时日志)。
//
// 运行态(running/stopped/crashed)只在 RunSupervisor 内存中维护,不落库;
// 仅最近一次运行的 last_started_at/last_exit_code/last_error 落行供历史回溯。
package run
import (
"time"
"github.com/google/uuid"
)
// RunStatus 是 profile 的内存运行态(不持久化)。
type RunStatus string
const (
StatusStopped RunStatus = "stopped"
StatusRunning RunStatus = "running"
StatusCrashed RunStatus = "crashed"
)
// RunProfile 是一个 workspace 下的运行档(持久化实体)。
type RunProfile struct {
ID uuid.UUID
WorkspaceID uuid.UUID
Slug string
Name string
Description string
Command string
Args []string
EncryptedEnv []byte
Enabled bool
LastStartedAt *time.Time
LastExitCode *int32
LastError string
CreatedBy uuid.UUID
CreatedAt time.Time
UpdatedAt time.Time
}